Re: [R] Generate data - function

2012-02-01 Thread Val
Hi Petr, Thank you very much . I will let you know my progress! Do you think that sampling from the traingular distribution will also be good enough? Will it provides similar results? Val On Wed, Feb 1, 2012 at 12:48 PM, Petr Savicky wrote: > On Wed, Feb 01, 2012 at 11:01:21AM -0500, Val

Re: [R] Generate data - function

2012-02-01 Thread Petr Savicky
On Wed, Feb 01, 2012 at 11:01:21AM -0500, Val wrote: > Hi Petr, > > Thank you very much. It looks we are almost there. > > > #an example, use a function approximating your graphs > * f <- function(x) { 0.7 - 1.25*((x - 1)^2 - 0.4)^2 } > f <- function(x) { 0.2 - 1.5*((x - 1)^2 - 0.1)^2 } > >

Re: [R] Generate data - function

2012-02-01 Thread Val
Hi Petr, Thank you very much. It looks we are almost there. #an example, use a function approximating your graphs * f <- function(x) { 0.7 - 1.25*((x - 1)^2 - 0.4)^2 } f <- function(x) { 0.2 - 1.5*((x - 1)^2 - 0.1)^2 } #plot function f(x) # x <- seq(0, 2, length=51) x <- seq(0.01, 1.75, len

Re: [R] Generate data - function

2012-02-01 Thread Petr Savicky
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 cou

Re: [R] Generate data - function

2012-02-01 Thread Petr Savicky
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 cou

Re: [R] Generate data - function

2012-01-31 Thread Val
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

Re: [R] Generate data - function

2012-01-31 Thread Petr Savicky
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 cou

Re: [R] Generate data - function

2012-01-31 Thread Val
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 w

Re: [R] Generate data - function

2012-01-31 Thread Petr Savicky
On Tue, Jan 31, 2012 at 12:40:35PM -0500, Val wrote: [...] > What I want is, > > 1- let the plot star from 0.2 in Y-axis rather than the minimum value, Then > goes up to 0.23 then stay flat. A slow drop when it reaches to 0.25 on > X-axis. Finally, when it reaches at the coordinate of (0.21,0.3)

Re: [R] Generate data - function

2012-01-31 Thread Val
Petr, Thank you very much for help. Graph A, >Are the distributions restricted to the shown intervals? Not necessarily. Based on your suggested R-code, x <- seq(0, 3, length=1001) y1 <- dnorm(x, mean=0.5, sd=1) y2 <- dnorm(x, mean=2.5, sd=1) plot(x, (y1+1.05*y2)/2.05, type="l") The follo

Re: [R] Generate data - function

2012-01-31 Thread Petr Savicky
On Tue, Jan 31, 2012 at 10:03:39AM -0500, Val wrote: > Hi All, > > I want generate data using R that follows the shape of graphs (A and B) in > the attached file. Can anybody suggest me what function fits for each > graph? Hi. The graphs leave open several questions. Are the distributions restr

Re: [R] Generate data - function

2012-01-31 Thread Tal Galili
Hi Val Look at the help file for ?curve To get the plot. You also need to decide what relevant function will fit the graphs you need. Without knowing what your purpose is, I can not help you on that. Contact Details:--- Conta