I am using TNORM - rtnorm to simulate from a truncated normal distribution. However, the current function available allows us to define the mean and SD of the non-truncated (original) distribution and then run the simulation. http://rss.acs.unt.edu/Rdoc/library/msm/html/tnorm.html I would instead like to define the mean and SD of the non-truncated distribution. Is there a way I can solve for the original mean and SD (of non-truncated distribution) from an assume mean and SD for the truncated distribution? Thanks ! [[alternative HTML version deleted]]
I have the following code, where we need to solve for mu and sigma, when we have mut and sdt. Can you suggest how to use a solve function in R to do that? I am new to R and am not sure how to go from defining the functions, to solving for them. Thanks truncated <- function(x) { mu=x[1]; sigma=x[2]; f <- function(x) (1/(sigma*sqrt(2*pi)))*exp(-(x-mu)^2/(2*sigma^2)); pdf.fun <- function(x) x*f(x); sd.fun <- function(x) (x)^2*f(x); st=integrate(sd.fun,lower=-Inf,upper=1)$value; a=integrate(pdf.fun,lower=-Inf,upper=1)$value; a1=integrate(f,lower=-Inf,upper=1)$value; mut <- a/a1; sdt <- sqrt((st/a1)-(a/a1)^2); } -- View this message in context: http://www.nabble.com/Truncated-normal-distribution-tp14348951p14361967.html Sent from the R help mailing list archive at Nabble.com.
Reasonably Related Threads
- Fitting Truncated Lognormal to a truncated data set (was: fitting truncated normal distribution)
- truncated normal
- truncated normal
- fitting truncated normal distribution
- help on sampling from the truncated normal/gamma distribution on the far end (probability is very low)