[R] Creating a specific skewed distribution
Greg Snow
Greg.Snow at imail.org
Mon Jun 15 23:01:52 CEST 2009
Your question is somewhat vague, there are probably an infinite number of distributions that fit your description.
Here are 2 possibilities:
> tmp <- sample( c(1,30,60), 10000000, replace=TRUE,
+ prob=c(0.10344, 0.9-0.10344, 0.1))
> mean(tmp)
[1] 30.00041
> mean(tmp>=60)
[1] 0.1001004
>
> tmp2 <- rgamma(10000000, shape=1.777666, scale=30/1.777666)
> mean(tmp2)
[1] 29.99674
> mean(tmp2>=60)
[1] 0.0999903
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of David Arnold
> Sent: Tuesday, June 09, 2009 11:49 PM
> To: r-help at r-project.org
> Subject: [R] Creating a specific skewed distribution
>
> All,
> Can someone help me create a skewed distribution, mean = 30, with
> probability of selecting a random number from the distribution greater
> than or equal 60 equal to 10%?
>
> I need the probability density function to equal zero at zero, and
> have a maximum height at or near 30.
>
> Is this possible?
>
> And if it is possible, how can I adjust the distribution so that the
> probability of selecting a random number greater than or equal to 60
> is p.
>
> Thanks. No idea how to start.
>
> David
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list