Re: [R] cdplot error

2011-08-03 Thread Allan Engelhardt (CYBAEA)

On 03/08/11 05:52, wildernessness wrote:

Fairly new at this.
Trying to create a conditional density plot.


cdplot(status~harvd.l,data=phy)

Error in cdplot.formula(status~harvd.l,data=phy):
dependent variable should be a factor

What does this error mean?  Status is a binary response of infestation (0/1)


Probably status is a numerical variable rather than a factor**.  Try 
print(is.factor(phy$status)) and if that is FALSE then


phy$status - factor(phy$status, labels=c(N, Y))
cdplot(status~harvd.l,data=phy)

Hope this helps a little.

Allan


and harvd.l is the log of timber harvest density per catchment.

Thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/cdplot-error-tp3714454p3714454.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


__
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.


Re: [R] cdplot error

2011-08-03 Thread Peter Ehlers

On 2011-08-02 21:52, wildernessness wrote:

Fairly new at this.
Trying to create a conditional density plot.


cdplot(status~harvd.l,data=phy)

Error in cdplot.formula(status~harvd.l,data=phy):
dependent variable should be a factor

What does this error mean?  Status is a binary response of infestation (0/1)
and harvd.l is the log of timber harvest density per catchment.


Your question suggests that have not looked at help(cdplot)
which clearly says just what the error message says and/or
you aren't aware that 'factor' has a specific meaning in R
in which case a look at chapter 4 of 'An Introduction to R'
likely would be profitable.

Peter Ehlers



Thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/cdplot-error-tp3714454p3714454.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


__
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.


Re: [R] cdplot????

2009-10-01 Thread Achim Zeileis

On Thu, 1 Oct 2009, kayj wrote:


I am having difficulties interpreting a cdplot, I have a binary variable y
that I want to cdplot against a continuous variable x,below is the R command

cdplot(y~x, data=mydata)

you get a plot with a dark shaded area and a light shaded area. what do
these areas mean? and how to interpret the plot?

you help is greatly appreciated


See ?cdplot. It's a display that graphs (an approximation of) P(y | x) 
against x. The areas above and below the line are simply shaded in 
different levels of gray.


To obtain P(y | x), the idea is to use

  f(y | x) = f(x | y) * f(x)/f(y)

where for f(x) and f(x | y) are obtained by (unconditional and 
conditional, respectively) kernel density smoothers from density().

f(y) is simply the unconditional proportion of the category y.

hth,
Z



--
View this message in context: 
http://www.nabble.com/cdplot-tp25696905p25696905.html
Sent from the R help mailing list archive at Nabble.com.

__
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.




__
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.