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? Your help is highly appreciated in advance Val -------------- next part -------------- A non-text attachment was scrubbed... Name: graphs.pdf Type: application/pdf Size: 19430 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120131/ca4e0710/attachment.pdf>
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:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Tue, Jan 31, 2012 at 5:03 PM, Val <valkremk@gmail.com> 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? > > Your help is highly appreciated in advance > Val > > ______________________________________________ > 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]]
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 restricted to the shown intervals? How exactly should the densities be close to the presented curves? Is it important that the distribution of A is skewed? In other words, is it important that the flat part of the high densities of A is slightly increasing? Is B bimodal? Using mixtures of two gaussians, it is possible to achieve the following densities. 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") x <- seq(0, 3, length=1001) y1 <- dnorm(x, mean=0.5, sd=0.95) y2 <- dnorm(x, mean=2.5, sd=0.95) plot(x, (y1+y2)/2, type="l") Are these curves satisfactory? The generation then should be done differently, using rnorm(). Petr Savicky.