[Distr-commits] r1260 - branches/distr-2.8/pkg/distrMod/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 8 02:55:06 CEST 2018


Author: ruckdeschel
Date: 2018-08-08 02:55:06 +0200 (Wed, 08 Aug 2018)
New Revision: 1260

Modified:
   branches/distr-2.8/pkg/distrMod/R/SimpleL2ParamFamilies.R
Log:
[distrMod] 2.8 : increase accuracy in Fisher information for Negbinom parameter size 

Modified: branches/distr-2.8/pkg/distrMod/R/SimpleL2ParamFamilies.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/SimpleL2ParamFamilies.R	2018-08-08 00:04:51 UTC (rev 1259)
+++ branches/distr-2.8/pkg/distrMod/R/SimpleL2ParamFamilies.R	2018-08-08 00:55:06 UTC (rev 1260)
@@ -187,7 +187,7 @@
 }
 
 
-NbinomwithSizeFamily <- function(size = 1, prob = 0.5, trafo,
+ NbinomwithSizeFamily <- function(size = 1, prob = 0.5, trafo,
                 withL2derivDistr = TRUE){
     name <- "Negative Binomial family"
     distribution <- Nbinom(size = size, prob = prob)
@@ -240,8 +240,8 @@
     FisherInfo.fct <- function(param){
                    prob.0 <- main(param)["prob"]
                    size.0 <- main(param)["size"]
-                   xn <- 0:min(max(support(Nbinom(size = size.0, prob = prob.0))),
-                               qnbinom(1e-6,size=size.0,prob=prob.0,lower.tail=FALSE),
+                   xn <- 1:min(max(max(support(Nbinom(size = size.0, prob = prob.0))),
+                               qnbinom(1e-6,size=size.0,prob=prob.0,lower.tail=FALSE)),
                                1e5)
                    I11 <- -sum((trigamma(xn+size.0)-trigamma(size.0))*dnbinom(xn,size=size.0,prob=prob.0))
                    I12 <- -1/prob.0
@@ -338,8 +338,8 @@
                    mean.0 <- main(param)["mean"]
                    size.0 <- main(param)["size"]
                    prob.00 <- size.0/(size.0+mean.0)
-                   xn <- 0:min(max(support(Nbinom(size = size.0, prob = prob.00))),
-                               qnbinom(1e-6,size=size.0,prob=prob.00,lower.tail=FALSE),
+                   xn <- 1:min(max(max(support(Nbinom(size = size.0, prob = prob.0))),
+                               qnbinom(1e-6,size=size.0,prob=prob.0,lower.tail=FALSE)),
                                1e5)
                    I11 <- -sum((trigamma(xn+size.0)-trigamma(size.0))*dnbinom(xn,size=size.0,prob=prob.00))
                    I12 <- -1/prob.00



More information about the Distr-commits mailing list