[R] ordered logistic regression - cdplot and polr

Achim Zeileis Achim.Zeileis at uibk.ac.at
Mon Apr 11 19:20:05 CEST 2011


On Mon, 11 Apr 2011, Elizabeth Pringle wrote:

> Hi,
>
> I have a dataset that I am trying to analyze and plot as an ordered logistic
> regression (y = ordinal categories 1-3, x = continuous variable with values
> 3-9).
>
> First is a problem with cdplot:
> Produces a beautiful plot, with the "right" trend, but my independent factor
> values are transformed.  The factor has values from 3-9, but the plot
> produces an x-axis with values from 20-140.  When I force the xlim to be
> 3-9, it produces a plot without the trend, which can't be correct.

You transform the presumably numerical regressor "LogAntDensity" to a 
factor. Is that intended? If so, cdplot() is not suitable for 
visualization as it assumes a numerical x-variable. See ?cdplot.

A more suitable visualization may be obtained using spineplot() which 
allows both numerical and categorical x-variables. See ?spineplot.

> Second is a problem with polr:
> The output of the summary command of the model built with polr includes t
> values for lots (if not all) of my independent factor values, but does not
> produce a summary of the fit of the model or of the overall fit of the
> factor.

You could refit the model without the factor and then compare both models 
using anova().

hth,
Z

> Also, intercepts are different from those produced with a logistic
> fit in JMP...
>
> Code below, any help much appreciated.
>
> Thanks
> Beth
>
> LogAntDensityFactor<-as.factor(LogAntDensity)
>
>
> ###order ordinal variable
>
> HammerCatOrd<-ordered(HammerCat)
>
>
> ###set ordered ordinal dependent variable as factor
>
> HammerCatOrdFactor<-as.factor(HammerCatOrd)
>
>
> ###density plot with three levels
>
> cdplot(HammerCatOrdFactor~LogAntDensityFactor,xlab="Log(Ant
> Density)",ylab="Latency
> of response to disturbance (1-3)")
>
>
> require(MASS)
>
> logordered<-polr(HammerCatOrdFactor~LogAntDensityFactor,Hess=TRUE)
>
> summary(logordered,digits=3)
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list