Re: [R] Truncated normal distribution

From: ravirrrr <>
Date: Sun, 16 Dec 2007 06:22:13 -0800 (PST)

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.


truncated <- function(x)


f <- function(x) (1/(sigma*sqrt(2*pi)))*exp(-(x-mu)^2/(2*sigma^2)); <- function(x) x*f(x); <- function(x) (x)^2*f(x);




mut <- a/a1;
sdt <- sqrt((st/a1)-(a/a1)^2);


View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 16 Dec 2007 - 14:26:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Dec 2007 - 02:30:19 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.