[Distr-commits] r720 - branches/distr-2.4/pkg/distrMod/R branches/distr-2.4/pkg/distrMod/man pkg/distrMod/R pkg/distrMod/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 18 11:40:25 CET 2011


Author: ruckdeschel
Date: 2011-01-18 11:40:24 +0100 (Tue, 18 Jan 2011)
New Revision: 720

Modified:
   branches/distr-2.4/pkg/distrMod/R/SimpleL2ParamFamilies.R
   branches/distr-2.4/pkg/distrMod/man/NBinomFamily.Rd
   pkg/distrMod/R/SimpleL2ParamFamilies.R
   pkg/distrMod/man/NBinomFamily.Rd
Log:
distrMod: fixed a bug in NbinomMeanSizeFamily() discovered by M. Kohl

Modified: branches/distr-2.4/pkg/distrMod/R/SimpleL2ParamFamilies.R
===================================================================
--- branches/distr-2.4/pkg/distrMod/R/SimpleL2ParamFamilies.R	2011-01-07 15:11:10 UTC (rev 719)
+++ branches/distr-2.4/pkg/distrMod/R/SimpleL2ParamFamilies.R	2011-01-18 10:40:24 UTC (rev 720)
@@ -244,7 +244,7 @@
     return(res)
 }
 
-NbinomMeanSizeFamily <- function(size = 1, mean = 0.5, trafo){ 
+NbinomMeanSizeFamily <- function(size = 1, mean = .5, trafo){ 
     name <- "Negative Binomial family"
     prob.0 <- size/(size+mean)
     distribution <- Nbinom(size = size, prob = size/(size+mean))
@@ -274,7 +274,7 @@
                    fct1 <- function(x){}
                    fct1.2 <- function(x){}
                    fct2 <- function(x){}
-                   body(fct1) <- substitute({ trigamma(x+size)-trigamma(size)+log(prob.2)},
+                   body(fct1) <- substitute({ digamma(x+size)-digamma(size)+log(prob.2)},
                                 list(size = size.0, prob.2 = prob.0))
                    body(fct1.2)<- substitute({ (size/prob.2- x/(1-prob.2)) },
                                 list(size = size.0, prob.2 = prob.0))
@@ -284,7 +284,7 @@
     L2derivSymm <- FunSymmList(NonSymmetric(), NonSymmetric())
 
     .di1 <- function(x)  digamma(x+size)-digamma(size)+log(prob.0)
-    .di2 <- function(x) .di1(x)*(1/prob.0-1)+ (size/prob.0- x/(1-prob.0))*size/prob.0^2 
+    .di2 <- function(x) .di1(x)*(1/prob.0-1)- (size/prob.0- x/(1-prob.0))*size/prob.0^2 
     .supp1 <- support(distribution)
     .supp0 <- .di2(.supp1)
     .prob1 <- aggregate(data.frame(prob(as(distribution,"DiscreteDistribution"))),

Modified: branches/distr-2.4/pkg/distrMod/man/NBinomFamily.Rd
===================================================================
--- branches/distr-2.4/pkg/distrMod/man/NBinomFamily.Rd	2011-01-07 15:11:10 UTC (rev 719)
+++ branches/distr-2.4/pkg/distrMod/man/NBinomFamily.Rd	2011-01-18 10:40:24 UTC (rev 720)
@@ -50,6 +50,11 @@
 plot(N1.w)
 FisherInfo(N1.w)
 checkL2deriv(N1.w)
+(N2.w <- NbinomMeanSizeFamily(size = 25, mean = 75))
+plot(N2.w)
+FisherInfo(N2.w)
+checkL2deriv(N2.w)
+
 }
 \concept{Negative Binomial model}
 \keyword{models}

Modified: pkg/distrMod/R/SimpleL2ParamFamilies.R
===================================================================
--- pkg/distrMod/R/SimpleL2ParamFamilies.R	2011-01-07 15:11:10 UTC (rev 719)
+++ pkg/distrMod/R/SimpleL2ParamFamilies.R	2011-01-18 10:40:24 UTC (rev 720)
@@ -244,7 +244,7 @@
     return(res)
 }
 
-NbinomMeanSizeFamily <- function(size = 1, mean = 0.5, trafo){ 
+NbinomMeanSizeFamily <- function(size = 1, mean = .5, trafo){ 
     name <- "Negative Binomial family"
     prob.0 <- size/(size+mean)
     distribution <- Nbinom(size = size, prob = size/(size+mean))
@@ -284,7 +284,7 @@
     L2derivSymm <- FunSymmList(NonSymmetric(), NonSymmetric())
 
     .di1 <- function(x)  digamma(x+size)-digamma(size)+log(prob.0)
-    .di2 <- function(x) .di1(x)*(1/prob.0-1)+ (size/prob.0- x/(1-prob.0))*size/prob.0^2 
+    .di2 <- function(x) .di1(x)*(1/prob.0-1)- (size/prob.0- x/(1-prob.0))*size/prob.0^2 
     .supp1 <- support(distribution)
     .supp0 <- .di2(.supp1)
     .prob1 <- aggregate(data.frame(prob(as(distribution,"DiscreteDistribution"))),

Modified: pkg/distrMod/man/NBinomFamily.Rd
===================================================================
--- pkg/distrMod/man/NBinomFamily.Rd	2011-01-07 15:11:10 UTC (rev 719)
+++ pkg/distrMod/man/NBinomFamily.Rd	2011-01-18 10:40:24 UTC (rev 720)
@@ -34,9 +34,9 @@
   Kohl, M. (2005) \emph{Numerical Contributions to the 
   Asymptotic Theory of Robustness}. Bayreuth: Dissertation.
 
-  Kohl, M. and Ruckdeschel, P (both authors contributed equally). 
+  Kohl, M. and Ruckdeschel, P. (2010). 
   R Package distrMod: S4 Classes and Methods for
-  Probability Models. \emph{Journal of Statistical Software} 2010, 35(10), 1-27.
+  Probability Models. To appear in Journal of Statistical Software.
 }
 \author{Peter Ruckdeschel \email{peter.ruckdeschel at itwm.fraunhofer.de}}
 %\note{}
@@ -50,10 +50,11 @@
 plot(N1.w)
 FisherInfo(N1.w)
 checkL2deriv(N1.w)
-(N2.w <- NbinomMeanSizeFamily(size = 25, mean = 10))
+(N2.w <- NbinomMeanSizeFamily(size = 25, mean = 75))
 plot(N2.w)
 FisherInfo(N2.w)
 checkL2deriv(N2.w)
+
 }
 \concept{Negative Binomial model}
 \keyword{models}



More information about the Distr-commits mailing list