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

drbn drbn at yahoo.com
Thu Oct 30 10:53:55 CET 2008


Sorry if it is a silly question, I haven't found documentation on this and I
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) 
} 

set.seed(1) 

#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
values.

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

Thanks

David



-- 
View this message in context: http://www.nabble.com/Is-possible%2C-on-biological-grounds%2C-suggest-to-fitdistr-%28MASS-library%29-that-the-estimated-parameters-must-be-between-two-values--tp20243667p20243667.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list