Skip to content

effect.clm

2 messages · David Barron, John Fox

#
I'm having a problem using the xlevels option with effect (or Effect) with
objects of class clm, which seems to have no impact on the output (whereas
it does for models of class polr).  Can anyone suggest how to fix this?

Thanks,
David

Here's an example:

mod.wvs <- MASS::polr(poverty ~ gender + religion + degree +
country*poly(age,3), data=WVS)

 Effect('age', mod.wvs, xlevels = list(age = 1:10))

Re-fitting to get Hessian


age effect (probability) for Too Little
age
        1         2         3         4         5         6         7
  8         9        10
0.8403661 0.8270171 0.8133710 0.7995001 0.7854780 0.7713778 0.7572714
0.7432277 0.7293120 0.7155850

age effect (probability) for About Right
age
        1         2         3         4         5         6         7
  8         9        10
0.1295679 0.1399772 0.1505377 0.1611853 0.1718564 0.1824888 0.1930231
0.2034039 0.2135803 0.2235068

age effect (probability) for Too Much
age
         1          2          3          4          5          6
 7          8          9         10
0.03006598 0.03300572 0.03609134 0.03931456 0.04266563 0.04613341
0.04970548 0.05336837 0.05710766 0.06090822

But with clm:

+                 data=WVS)
age effect (probability) for Too Little
age
       20        30        40        50        60        70        80
 90
0.5980510 0.5268304 0.4936603 0.4803375 0.4674829 0.4359217 0.3684641
0.2589983

age effect (probability) for About Right
age
       20        30        40        50        60        70        80
 90
0.3031130 0.3453414 0.3629620 0.3696094 0.3757686 0.3897338 0.4129734
0.4227230

age effect (probability) for Too Much
age
        20         30         40         50         60         70
80         90
0.09883598 0.12782815 0.14337772 0.15005316 0.15674848 0.17434449
0.21856247 0.31827868
#
Dear David,

Effect.clm() isn't properly passing optional arguments like xlevels. The problem occurs in some other Effect() and effect() methods as well, and the fix seems simple. 

I've corrected these functions in the development version of effects package on R-Forge. We'll need to test more carefully before sending the revised package to CRAN. In the meantime, you should be able to install effects from R-Forge via install.packages("effects", repos="http://R-Forge.R-project.org"), after waiting a day or so for R-Forge to build the package.

Thanks for reporting this bug.

John

-----------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
Web: socserv.mcmaster.ca/jfox