Hi Petr, Thank you very much for the help, >Consider also to specify directly the inverse distribution >function using an increasing piecewise polynomial. Generating >numbers from the distribution is then immediate and computing >the graph of the density may be obtained using the formula >for the derivative of the inverse function.
The problem is that I am not high level programmer. Could you please help me out? Your help will be appreciated in advance On Tue, Jan 31, 2012 at 2:36 PM, Petr Savicky <savi...@cs.cas.cz> wrote: > On Tue, Jan 31, 2012 at 01:59:13PM -0500, Val wrote: > > Hi petr, > > > > >Can the required density be understood as a piecewise > > >linear function going through 4 or 5 given points? > > > > That is my problem. The function should be nonlinear. However, we can > break > > it down to the first 3 or 4 points could be linear and then nonlinear > > function. On the later points can we apply sort of spline function or > local > > polynomials? > > Hi. > > This depends on your requirements on the shape of the function. > However, for generating numbers from the distribution, the > inverse of the distribution function is needed. If the density > is a piecewise linear function, then the distribution function > is piecewise quadratic. So, the inverse is easy to compute. > For higher degree polynomials, the inverse is harder to > compute and possibly an approximation would be better. > > Consider also to specify directly the inverse distribution > function using an increasing piecewise polynomial. Generating > numbers from the distribution is then immediate and computing > the graph of the density may be obtained using the formula > for the derivative of the inverse function. > > Petr. > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.