[R] Is possible, on biological grounds, suggest to fitdistr (MASS library) that the estimated parameters must be between two values?

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Thu Oct 30 13:41:49 CET 2008

Doesn't use of a 95% CI of the mean give you a better handle on this issue.
It then might be interesting to compare the CI range with the values
obtained by the fitdist function.

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Office (305) 224 - 4282
Steve_Friedman at nps.gov

             <drbn at yahoo.com>                                              
             Sent by:                                                   To 
             r-help-bounces at r-         r-help at r-project.org                
             project.org                                                cc 
             10/30/2008 02:53          [R]  Is possible, on biological     
             AM MST                    grounds, suggest to fitdistr (MASS  
                                       library) that the estimated         
                                       parameters must be between two      

Sorry if it is a silly question, I haven't found documentation on this and
don't know if it is possible.

library(MASS) ## for fitdistr
library(msm) ## for dtnorm

#prepare truncated normal distribution
dtnorm0 <- function(x, mean, sd , log = FALSE) {
   dtnorm(x, mean, sd, 105, 135, log)


#Generate normal distribution with the TRUE population mean (day 106 of the
year) that I don't know a priori
x <- rnorm(100, mean=106, sd=40)

#truncated sample simulating those records that I was able to observe
x<-x[x>105 & x<=135]

#fit truncated normal distribution to the data
fitdistr(x, dtnorm0, start = list(mean = mean(x), sd = sd(x)))

The result of the estimated true mean=132.8, sd=25.9, far from the true

Can I, on biological grounds, suggest to fitdistr that the mean must be a
value, for example, between 90 and 110?



View this message in context:

Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list