[R] multiple density function

David Barron mothsailor at googlemail.com
Tue Sep 19 17:03:00 CEST 2006


Would this do what you want:

>  m=seq(10,1,length=10)
>  v=seq(3,1,length=10)
> x <- seq(-5,20,length=500)
> plot(x,dnorm(x,m[1],v[1]))
> for (i in 1:10) plot(x,dnorm(x,m[i],v[i]),type="l",col=i)

On 19/09/06, Anupam Tyagi <AnupTyagi at yahoo.com> wrote:
> march <marcella.marinelli <at> uniroma1.it> writes:
>
> >
> >
> > Hi everybody
> > I'm new in R so the question will be easy for you
> > I'm running multiple density functions taking account of the following
> > conditions:
> > mean=seq(10,1,length=10)
> > var=seq(3,1,length=10)
> >
> > How can I describe the density functions on the same chart?
> > thanks
> > Marcella
>
> Hi Marcella, I am not sure of what you are specifically trying to do, but if you
> want more than one set of points on the same graph (chart) use "points" after
> "plot". See examples in the graphics part of R documentation.
> e.g.
>
> > plot(...)
> > points(...)
>
> Anupam.
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP



More information about the R-help mailing list