The subject line of this email suggests you want to do this in R for
which the R-help might be more appropriate.
This might be a bit naive but if you you know X is uniformly distributed
between 0 and 1, then can you simply sample X and then calculate f(X)?
rf <- function(n=1){
x <- runif(n, min=0, max=1)
f <- 4*x^3
return(f)
}
rf(100)
Regards, Adai
Madan Kundu wrote:
> Hi,
>
> I want to simulate data from a known density function f(x,theta). I don't want to use the routines like rnorm, rcaucy etc. My intention is to provide the density function and not the distribution name.
>
> For example, I want to generate data from the distribution with density function f(x)=4*x^3, where 0<=x<=1. How can generate 100 data points from this density function?
>
> Thanks in advance.
>
> Regards
>
>
>
>
>
>
> --------------
> Madan Gopal Kundu
> PhD Scholar
> Indiana University Purdue University Indianapolis (IUPUI)
>
> Indianapolis, Indiana 46202, USA
>
> Web: http://mgkundu.webs.com/
> Cell: 317-657-1180
>
> Sir Ronald Aylmer Fisher: "To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of."
>
> Roger Brinner: "The plural of anecdote is not data."
>
> John Tukey: "The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data."
>
>
> Now, send attachments up to 25MB with Yahoo! India Mail. Learn how. http://in.overview.mail.yahoo.com/photos
|