[Distr-commits] r556 - branches/distr-2.2/pkg/distr/R branches/distr-2.2/pkg/distr/chm branches/distr-2.2/pkg/distr/inst/doc branches/distr-2.2/pkg/distrEx/R branches/distr-2.2/pkg/distrEx/chm branches/distr-2.2/pkg/distrMod/inst/scripts pkg/distr/R pkg/distrEx/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 27 21:15:47 CEST 2009


Author: ruckdeschel
Date: 2009-08-27 21:15:46 +0200 (Thu, 27 Aug 2009)
New Revision: 556

Modified:
   branches/distr-2.2/pkg/distr/R/internalUtils_trunc.R
   branches/distr-2.2/pkg/distr/chm/Distr.chm
   branches/distr-2.2/pkg/distr/inst/doc/Rplots.pdf
   branches/distr-2.2/pkg/distrEx/R/KolmogorovDist.R
   branches/distr-2.2/pkg/distrEx/chm/distrEx.chm
   branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R
   pkg/distr/R/internalUtils_trunc.R
   pkg/distrEx/R/KolmogorovDist.R
Log:
--- noticed by looking at example censoredPois.R:
distrEx
+Definition for KolmogorovDist for numeric, UnivariateDistribution 
 by means of ks.test was only oK for AbscontDistributions; changed to
 KolmogorovDist(DiscreteDistribution(e1),e2)
distr:
+ internal helper function .trunc.low wronly used p.l and q.r ...

changed in both trunc and branches/distr-2.2

Modified: branches/distr-2.2/pkg/distr/R/internalUtils_trunc.R
===================================================================
--- branches/distr-2.2/pkg/distr/R/internalUtils_trunc.R	2009-08-27 14:31:58 UTC (rev 555)
+++ branches/distr-2.2/pkg/distr/R/internalUtils_trunc.R	2009-08-27 19:15:46 UTC (rev 556)
@@ -81,7 +81,7 @@
            p0[ind] <- if(lower.tail) 0 else 1
            if(log.p) p0[ind] <- log(p0[ind])
            q1 <- q[!ind]
-           p1 <- Pl(q1, lower.tail=FALSE,
+           p1 <- p(object)(q1, lower.tail=FALSE,
                            log.p = TRUE)-plN
            p0[!ind] <- if(!log.p || lower.tail) exp(p1) else p1
            if(lower.tail) p0[!ind] <- 1-p0[!ind]
@@ -120,7 +120,7 @@
            if(log.p && !lower.tail) p1l <- plN + p1
            else{ if(log.p) p1 <- exp(p1)
                  p1l <- plN + if(lower.tail) log(1-p1) else log(p1) }
-           q0[in01] <- Qr(p1l, lower.tail = FALSE, log.p = TRUE)
+           q0[in01] <- q(object)(p1l, lower.tail = FALSE, log.p = TRUE)
            q0[indNA] <- NA
            return(q0)
    }

Modified: branches/distr-2.2/pkg/distr/chm/Distr.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/distr/inst/doc/Rplots.pdf
===================================================================
--- branches/distr-2.2/pkg/distr/inst/doc/Rplots.pdf	2009-08-27 14:31:58 UTC (rev 555)
+++ branches/distr-2.2/pkg/distr/inst/doc/Rplots.pdf	2009-08-27 19:15:46 UTC (rev 556)
@@ -2,8 +2,8 @@
 %âãÏÓ\r
 1 0 obj
 <<
-/CreationDate (D:20090809210541)
-/ModDate (D:20090809210541)
+/CreationDate (D:20090827210848)
+/ModDate (D:20090827210848)
 /Title (R Graphics Output)
 /Producer (R 2.10.0)
 /Creator (R)
@@ -275,7 +275,7 @@
 65.15 74.45 l
 65.25 74.75 l
 65.35 75.05 l
-65.45 75.37 l
+65.45 75.36 l
 65.55 75.68 l
 65.65 76.01 l
 65.75 76.34 l
@@ -315,7 +315,7 @@
 69.19 93.26 l
 69.29 93.95 l
 69.39 94.66 l
-69.49 95.37 l
+69.49 95.38 l
 69.59 96.11 l
 69.70 96.85 l
 69.80 97.61 l
@@ -344,15 +344,15 @@
 72.12 119.17 l
 72.22 120.30 l
 72.32 121.44 l
-72.43 122.60 l
+72.43 122.61 l
 72.53 123.78 l
 72.63 124.98 l
 72.73 126.19 l
 72.83 127.42 l
 72.93 128.67 l
 73.03 129.93 l
-73.13 131.21 l
-73.23 132.51 l
+73.13 131.22 l
+73.23 132.52 l
 73.34 133.83 l
 73.44 135.17 l
 73.54 136.52 l
@@ -380,13 +380,13 @@
 75.76 170.77 l
 75.86 172.53 l
 75.96 174.31 l
-76.06 176.10 l
+76.06 176.11 l
 76.17 177.92 l
-76.27 179.75 l
+76.27 179.74 l
 76.37 181.59 l
 76.47 183.45 l
 76.57 185.33 l
-76.67 187.22 l
+76.67 187.23 l
 76.77 189.14 l
 76.87 191.06 l
 76.97 193.01 l
@@ -401,7 +401,7 @@
 77.88 211.18 l
 77.99 213.27 l
 78.09 215.38 l
-78.19 217.49 l
+78.19 217.50 l
 78.29 219.63 l
 78.39 221.77 l
 78.49 223.93 l
@@ -416,7 +416,7 @@
 79.40 243.87 l
 79.50 246.13 l
 79.60 248.41 l
-79.70 250.70 l
+79.70 250.69 l
 79.81 252.99 l
 79.91 255.29 l
 80.01 257.60 l
@@ -431,13 +431,13 @@
 80.92 278.66 l
 81.02 281.02 l
 81.12 283.39 l
-81.22 285.75 l
+81.22 285.76 l
 81.32 288.13 l
 81.42 290.50 l
 81.52 292.87 l
 81.63 295.25 l
 81.73 297.62 l
-81.83 300.00 l
+81.83 299.99 l
 81.93 302.37 l
 82.03 304.74 l
 82.13 307.11 l
@@ -453,7 +453,7 @@
 83.14 330.60 l
 83.24 332.92 l
 83.34 335.23 l
-83.44 337.52 l
+83.44 337.53 l
 83.55 339.82 l
 83.65 342.10 l
 83.75 344.37 l
@@ -468,9 +468,9 @@
 84.66 364.26 l
 84.76 366.40 l
 84.86 368.52 l
-84.96 370.62 l
+84.96 370.63 l
 85.06 372.71 l
-85.16 374.79 l
+85.16 374.78 l
 85.26 376.84 l
 85.37 378.87 l
 85.47 380.89 l
@@ -493,7 +493,7 @@
 87.19 411.66 l
 87.29 413.24 l
 87.39 414.79 l
-87.49 416.32 l
+87.49 416.31 l
 87.59 417.81 l
 87.69 419.27 l
 87.79 420.70 l
@@ -556,7 +556,7 @@
 93.55 443.69 l
 93.66 443.01 l
 93.76 442.29 l
-93.86 441.53 l
+93.86 441.54 l
 93.96 440.74 l
 94.06 439.92 l
 94.16 439.06 l
@@ -579,7 +579,7 @@
 95.88 419.32 l
 95.98 417.88 l
 96.08 416.41 l
-96.18 414.92 l
+96.18 414.91 l
 96.28 413.39 l
 96.39 411.84 l
 96.49 410.26 l
@@ -609,7 +609,7 @@
 98.91 365.56 l
 99.01 363.46 l
 99.11 361.36 l
-99.22 359.24 l
+99.22 359.23 l
 99.32 357.10 l
 99.42 354.96 l
 99.52 352.80 l
@@ -643,11 +643,11 @@
 102.35 289.59 l
 102.45 287.30 l
 102.55 285.02 l
-102.65 282.74 l
+102.65 282.73 l
 102.75 280.46 l
 102.86 278.18 l
 102.96 275.91 l
-103.06 273.64 l
+103.06 273.65 l
 103.16 271.38 l
 103.26 269.12 l
 103.36 266.87 l
@@ -661,7 +661,7 @@
 104.17 249.11 l
 104.27 246.93 l
 104.37 244.75 l
-104.47 242.58 l
+104.47 242.59 l
 104.57 240.43 l
 104.68 238.28 l
 104.78 236.14 l
@@ -670,7 +670,7 @@
 105.08 229.80 l
 105.18 227.71 l
 105.28 225.63 l
-105.38 223.56 l
+105.38 223.55 l
 105.48 221.50 l
 105.59 219.45 l
 105.69 217.42 l
@@ -700,8 +700,8 @@
 108.11 172.83 l
 108.21 171.16 l
 108.31 169.51 l
-108.42 167.87 l
-108.52 166.26 l
+108.42 167.88 l
+108.52 166.25 l
 108.62 164.65 l
 108.72 163.06 l
 108.82 161.49 l
@@ -724,7 +724,7 @@
 110.54 137.28 l
 110.64 136.00 l
 110.74 134.74 l
-110.84 133.50 l
+110.84 133.49 l
 110.94 132.27 l
 111.04 131.05 l
 111.15 129.85 l
@@ -734,7 +734,7 @@
 111.55 125.21 l
 111.65 124.09 l
 111.75 122.99 l
-111.85 121.90 l
+111.85 121.89 l
 111.95 120.82 l
 112.06 119.76 l
 112.16 118.71 l

Modified: branches/distr-2.2/pkg/distrEx/R/KolmogorovDist.R
===================================================================
--- branches/distr-2.2/pkg/distrEx/R/KolmogorovDist.R	2009-08-27 14:31:58 UTC (rev 555)
+++ branches/distr-2.2/pkg/distrEx/R/KolmogorovDist.R	2009-08-27 19:15:46 UTC (rev 556)
@@ -81,11 +81,8 @@
     function(e1, e2){
         o.warn <- getOption("warn")
         options(warn = -1)
-        on.exit(options(warn=o.warn))
-        res <- ks.test(e1, e2 at p)$statistic
-        names(res) <- "Kolmogorov distance"
-
-        return(res)
+        emp <- DiscreteDistribution(e1)
+        return(KolmogorovDist(emp,e2))
     })
 
 setMethod("KolmogorovDist", signature(e1 = "UnivariateDistribution",

Modified: branches/distr-2.2/pkg/distrEx/chm/distrEx.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R	2009-08-27 14:31:58 UTC (rev 555)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R	2009-08-27 19:15:46 UTC (rev 556)
@@ -6,7 +6,7 @@
 require(distrMod)
 options("newDevice"=TRUE)
 
-CensoredPoisFamily <- function(lambda = 1, trunc.pt = 2){
+CensoredPoisFamily <- function(lambda = 1, trunc.pt = 2, trafo=1){
     ## name
     name <- "Censored Poisson family"
     ## central distribution
@@ -69,3 +69,9 @@
 confint(md.CvM)
 plot(profile(md.CvM))
 
+if(require(ROptEst)){
+CP.data0 <- r(CP)(10000)
+CP.data1 <- CP.data0; CP.data1[sample(1:100,10)] <- NA
+(md.ropt<- roptest(CP.data0, CP, eps=0.1, initial.est=md.CvM))
+confint(md.ropt,symmetricBias())
+}
\ No newline at end of file

Modified: pkg/distr/R/internalUtils_trunc.R
===================================================================
--- pkg/distr/R/internalUtils_trunc.R	2009-08-27 14:31:58 UTC (rev 555)
+++ pkg/distr/R/internalUtils_trunc.R	2009-08-27 19:15:46 UTC (rev 556)
@@ -81,7 +81,7 @@
            p0[ind] <- if(lower.tail) 0 else 1
            if(log.p) p0[ind] <- log(p0[ind])
            q1 <- q[!ind]
-           p1 <- Pl(q1, lower.tail=FALSE,
+           p1 <- p(object)(q1, lower.tail=FALSE,
                            log.p = TRUE)-plN
            p0[!ind] <- if(!log.p || lower.tail) exp(p1) else p1
            if(lower.tail) p0[!ind] <- 1-p0[!ind]
@@ -120,7 +120,7 @@
            if(log.p && !lower.tail) p1l <- plN + p1
            else{ if(log.p) p1 <- exp(p1)
                  p1l <- plN + if(lower.tail) log(1-p1) else log(p1) }
-           q0[in01] <- Qr(p1l, lower.tail = FALSE, log.p = TRUE)
+           q0[in01] <- q(object)(p1l, lower.tail = FALSE, log.p = TRUE)
            q0[indNA] <- NA
            return(q0)
    }

Modified: pkg/distrEx/R/KolmogorovDist.R
===================================================================
--- pkg/distrEx/R/KolmogorovDist.R	2009-08-27 14:31:58 UTC (rev 555)
+++ pkg/distrEx/R/KolmogorovDist.R	2009-08-27 19:15:46 UTC (rev 556)
@@ -81,11 +81,8 @@
     function(e1, e2){
         o.warn <- getOption("warn")
         options(warn = -1)
-        on.exit(options(warn=o.warn))
-        res <- ks.test(e1, e2 at p)$statistic
-        names(res) <- "Kolmogorov distance"
-
-        return(res)
+        emp <- DiscreteDistribution(e1)
+        return(KolmogorovDist(emp,e2))
     })
 
 setMethod("KolmogorovDist", signature(e1 = "UnivariateDistribution",



More information about the Distr-commits mailing list