|
I have 2 series of variables, I want to plot the probability density function of these 2 variabels (i.e. two curves in one graph), I just want to compare these two variable distribution.
what should I do? can I use ggplot2 package? |
|
x=rnorm(100,1,0.8) # A series.
y=rnorm(100,0,0.5) # Another series with different mean and variance. plot(density(x),ylim=c(0,1)) lines(density(y),col="red") Remember that density() is a nonparametric estimator. You should properly choose the bandwith.
Juan David Ospina Arango
School of Statistics Universidad Nacional de Colombia, Colombia Laboratoire de Traitement du Signal et de l'Image Université de Rennes 1, France |
|
however, if i have an excel file, but there have 6 variables, a,b,c,d,e,f.
how to plot the probability density function of a and d in one graph, b and e in another graph? |
|
x11()
plot(density(a)) lines(density(d)) x11() plot(density(b)) lines(density(e)) 2011/10/12 pigpigmeow [via R] <[hidden email]>: > however, if i have an excel file, but there have 6 variables, a,b,c,d,e,f. > > > how to plot the probability density function of a and d in one graph, b and > e in another graph? > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://r.789695.n4.nabble.com/plot-probability-density-function-pdf-tp3897055p3898183.html > To unsubscribe from plot probability density function (pdf), click here. -- Juan David Ospina Arango
Juan David Ospina Arango
School of Statistics Universidad Nacional de Colombia, Colombia Laboratoire de Traitement du Signal et de l'Image Université de Rennes 1, France |
|
This post was updated on .
x11()
what does it mean? if my data has missing value, can I plot the graph? the missing data is shown "NA", how to handle it and plot pdf? |
|
i want to plot probability density function,predictvalue has missing value and observevalue has not missing value, I tried ..
attach(test) #test is the name of the data file names(test) plot(density(predictvalue,na.rm=TRUE)) lines(density(observevalue)) is it correct? |
|
In reply to this post by pigpigmeow
Assuming you mean you want them on the same device:
layout(1:2) plot(density(a)) lines(density(d),col=2) plot(density(b)) lines(density(e),col=2) Getting your data into R is more of a challenge, but if you want my unsolicited advice, you can do far worse than saving as CSV and using read.csv() Michael On Wed, Oct 12, 2011 at 10:31 AM, pigpigmeow <[hidden email]> wrote: > however, if i have an excel file, but there have 6 variables, a,b,c,d,e,f. > > > how to plot the probability density function of a and d in one graph, b and > e in another graph? > > > -- > View this message in context: http://r.789695.n4.nabble.com/plot-probability-density-function-pdf-tp3897055p3898183.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
|
In reply to this post by pigpigmeow
Please -- this is not your personal help advisor. Use R's Help facilities
before posting. -- Bert On Wed, Oct 12, 2011 at 8:20 AM, pigpigmeow <[hidden email]> wrote: > x11() > what does it mean? > ?x11 > > if my data has missing value, can I plot the graph? > Try it and see. > > -- > View this message in context: > http://r.789695.n4.nabble.com/plot-probability-density-function-pdf-tp3897055p3898362.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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]] ______________________________________________ [hidden email] 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. |
|
thank you all of u
|
| Powered by Nabble | Edit this page |
