library(truncdist)
When running the following code, the output from extrunc() and vartrunc() is
correct:
# Mean and variance of Gamma distribution
m <- 40; v <- 9
# Derive shape and scale parameters
a <- m^2/v; s <- v/m
# Checks: mean=shape*scale, variance=mean*scale^2
a*s; a*s^2
# Generate 1M random samples from Gamma distribution
x <- rgamma(10^6,shape=a,rate=1/s)
# Checks
mean(x); var(x)
# Mean and variance of corresponding theoretical Gamma
extrunc("gamma",a=0,b=Inf,shape=a,rate=1/s)
vartrunc("gamma",a=0,b=Inf,shape=a,rate=1/s)
However, changing the mean from 40 to 44:
m <- 44; v <- 9
and running the code again, the output is as follows:
extrunc("gamma",a=0,b=Inf,shape=a,rate=1/s) # = 3.8101e-06
vartrunc("gamma",a=0,b=Inf,shape=a,rate=1/s) # = 1945
________________________________
This message is for the designated recipient only and ma...{{dropped:16}}
> On Dec 3, 2015, at 2:03 AM, <dario.romare at accenture.com> <dario.romare at accenture.com> wrote: > > > library(truncdist) > > When running the following code, the output from extrunc() and vartrunc() is correct: >snipped> > However, changing the mean from 40 to 44: > m <- 44; v <- 9 > > and running the code again, the output is as follows: > > extrunc("gamma",a=0,b=Inf,shape=a,rate=1/s) # = 3.8101e-06 > vartrunc("gamma",a=0,b=Inf,shape=a,rate=1/s) # = 1945You are sending this report to the wrong address. There is no assurance that the author of this package will ever see it. You should instead do this (with the package loaded). maintainer(?truncdist?) And send that code to whatever address that might return.> ________________________________ > > This message is for the designated recipient only and ma...{{dropped:16}}David Winsemius Alameda, CA, USA