Alex
☆    

Austria,
2015-03-17 11:19
(3299 d 22:31 ago)

Posting: # 14566
Views: 6,929
 

 Simulations of a truncated normal distri­bution [General Sta­tis­tics]

Dear all!

I just stumbled over the generation of random draws from a truncated normal distribution whilst thinking about possible scenarios for a PK simulation study.

Does anybody know how to draw from a truncated normal distribution with prespecified (fixed) mean and variance - not in the underlying normal distribution, but in the consequent truncated normal distribution? In R function truncnorm (or other functions) you can only specify the mean and sd of the underlying normal distribution...

In more detail, I want to generate draws X with l < X < u ~ truncNorm(m,v) where m and v are fixed mean and variance, l=0 is the lower, u=Inf the upper bound. m and v are functions of mu and delta, the mean and variance of the underlying normal distribution N(mu,delta) without truncation.

Theoretically, solving the system of equations m=f(mu,delta) and v=g(mu,delta) for mu and delta should give me the desired result, i.e. the mean and variance in the underlying normal distribution so that, after truncation, i will have mean m and variance v in the truncated normal distribution. f() and g() represent the functions describing the relationship of the mean and the variance, respectively, between normal and truncated normal distribution. As f() and g() are rather complex, including the CDF of the normal distribution, my algebraic skills are insufficient...

Can anybody help?

Thanks for your efforts,
All the best,
Alex
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2015-03-17 13:48
(3299 d 20:02 ago)

@ Alex
Posting: # 14568
Views: 5,899
 

 Simulations of a truncated normal distribution

Hi Alex,

❝ Theoretically, solving the system of equations m=f(mu,delta) and v=g(mu,delta) for mu and delta should give me the desired result […] my algebraic skills are insufficient...


Not only yours. Consider contacting the authors of truncnorm

Heike Trautmann <trautmann[image]statistik.uni-dortmund.de>
Detlef Steuer <detlef.steuer[image]hsu-hamburg.de>
Olaf Mersmann <olafm[image]statistik.uni-dortmund.de> (maintainer)
Björn Bornkamp <bornkamp[image]statistik.tu-dortmund.de>

or cross-post at R-help.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
ElMaestro
★★★

Denmark,
2015-03-17 16:20
(3299 d 17:31 ago)

@ Alex
Posting: # 14569
Views: 5,752
 

 Simulations of a truncated normal distribution

Hi Alex,

❝ Does anybody know how to draw from a truncated normal distribution with prespecified (fixed) mean and variance - not in the underlying normal distribution, but in the consequent truncated normal distribution? In R function truncnorm (or other functions) you can only specify the mean and sd of the underlying normal distribution...


Never did something like that. I believe you can get the relationship between underlying mean and variance and truncated mean and variance here. Perhaps this relation is what you need to draw appropriately for your application.

Pass or fail!
ElMaestro
nobody
nothing

2015-03-17 16:24
(3299 d 17:26 ago)

@ ElMaestro
Posting: # 14570
Views: 5,712
 

 Simulations of a truncated normal distribution

eeehhm, stupid question: Why not "sampling" on the log scale for your simulations and transform afterwards? Or do I get something completely wrong here?

Kindest regards, nobody
Alex
☆    

Austria,
2015-03-17 16:56
(3299 d 16:54 ago)

@ nobody
Posting: # 14571
Views: 5,659
 

 Simulations of a truncated normal distri­bution

Dear all!

Thanks for your fast responses.

@Helmut: Thanks for the hint, I just contacted the authors of the package.

@ElMaestro: Thanks. Relationships are known (but complex). I tried to invert the equations by using the substitution mehtod without success. I was just surprised that the web showed no solution..

@nobody: Of course, a log-normal distribution is another possible scenario. And in fact its the same issue with function lnorm in R: you can only specify mean and sd for the underlying normal distribution. BUT: Relationships for mean and variance are much simpler between normal and log-normal distribution and therefore, solving is not that tricky:

rlnorm(n=n, meanlog=log(mu)-0.5*log(1+cv^2), sdlog=sqrt(log(1+cv^2)))

where mu and cv represent the mean and the cv for the resulting log-normal distribution (not for the underlying normal distribution).

Thanks again,
Alex
UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,636 registered users;
114 visitors (0 registered, 114 guests [including 5 identified bots]).
Forum time: 09:51 CET (Europe/Vienna)

With four parameters I can fit an elephant,
and with five I can make him wiggle his trunk.    John von Neumann

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5