polr?
On Jul 4, 2013, at 14:38 , D?niel Kehl wrote:
Dear Prof Ripley, could you be just a little more specific?
He'll likely find that difficult. It's sort of like if you had data like this 25 75 75 25 25 75 and did a trend test. The trend test _assumes_ that the effect is increasing, and constructs a test based on the slope. Since it it isn't increasing, the effect isn't found:
prop.trend.test(c(25,75,25),c(100,100,100))
Chi-squared Test for Trend in Proportions data: c(25, 75, 25) out of c(100, 100, 100) , using scores: 1 2 3 X-squared = 0, df = 1, p-value = 1 However, if you fit the implied model, you get
score <- 1:3 summary(glm(cbind(c(25,75,25),c(75,25,75)) ~ score, binomial))
Call:
glm(formula = cbind(c(25, 75, 25), c(75, 25, 75)) ~ score, family = binomial)
Deviance Residuals:
1 2 3
-3.486 6.768 -3.486
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.365e-01 3.098e-01 -1.086 0.277
score -2.548e-16 1.434e-01 0.000 1.000
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 70.115 on 2 degrees of freedom
Residual deviance: 70.115 on 1 degrees of freedom
AIC: 88.444
Number of Fisher Scoring iterations: 3
where the z-value for the score coefficient is 0, but the residual deviance reveals that the model doesn't fit the data.
Thanks a lot daniel
________________________________________
Felad?: Prof Brian Ripley [ripley at stats.ox.ac.uk]
K?ldve: 2013. j?lius 4. 14:14
To: D?niel Kehl
Cc: r-help
T?rgy: Re: [R] polr?
On 04/07/2013 12:59, D?niel Kehl wrote:
Dear R users,
I have a dataset with two ordered variables, tr_x1 and tr_y1. A crosstable of them can bee seen below.
tr_x1
tr_y1 -1 0 1
-1 629 100 629
0 1396 4353 1443
1 668 126 655
It is clear that if tr_x1 is 0, it has an effect on tr_y1. A chi-square statistic is clearly showing this with a low p-value.
Is there a regression-based method you would offer? I tried polr from MASS package but without finding a significant coefficient, because the columns for tr_x1 and tr_y1 are similar.
Your mistake is testing coefficients, not overall fit.
Thank you for your help!
daniel
[[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.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
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.
Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com