Re: [R] (g)lm ordinal or scaled values?

From: Knut Krueger <Knut-krueger_at_einthal.de>
Date: Wed 10 May 2006 - 05:25:11 EST

Liaw, Andy schrieb:

>Ordinal variables should be stored as ordered factors in R. See ?ordered. >
thnk`s for your reply. I tried to store as ordered factors var <- as.ordered(var2)
but if I am calling the lm(dependent~var) I get a long list of values. If I call
var <- as.numeric(var2)
lm(dependent~var)

then I get:

Residuals:

     Min 1Q Median 3Q Max -0.93563 0.01378 0.16272 0.25546 0.57862

Coefficients:

            Estimate Std. Error t value Pr(>|t|) (Intercept) 1.79513 0.02787 64.412 < 2e-16 *** mean -0.28102 0.05993 -4.689 4.66e-06 ***

the SPSS call and Result is:

SPSS (13)
    Analyse

        General Linear Model
                Univariate
Dependent Variable -> Dependent
Fixed Factors       -> var2

OK
           



Tests of Between-Subjects Effects
Dependent Variable: dependent

 | --------------- | ------------------------- | --- | ------------- | 

-------- | ---- |
| Source | Type III Sum of Squares | df | Mean Square | F | Sig. | | --------------- | ------------------------- | --- | ------------- |
-------- | ---- |
| Corrected Model | 11,269(a) | 41 | ,275
  | 1,668 | ,012 |
 | --------------- | ------------------------- | --- | ------------- | 

-------- | ---- |
| Intercept | 361,340 | 1 | 361,340 |
2193,088 | ,000 |
 | --------------- | ----------------------- | --- | ----------- | 

-------- | ---- |
| var2 | 11,269 | 41 | ,275 |
1,668 | ,012 |
 | --------------- | ----------------------- | --- | ----------- | 

-------- | ---- |
| Error | 31,964 | 194 | ,165 | | | | --------------- | ----------------------- | --- | ----------- |
-------- | ---- |
| Total | 773,000 | 236 | | | | | --------------- | ----------------------- | --- | ----------- |
-------- | ---- |
| Corrected Total | 43,233 | 235 | | | | | --------------- | ----------------------- | --- | ----------- |

-------- | ---- |

a R Squared = ,261 (Adjusted R Squared = ,104)

Maybe anybody is able to show me the difference between SPSS and R calls because the P value ic complete different The url for the Data (if anybody would like to try)

http://biostatistic.de/temp/testr.csv

Regards Knut



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed May 10 05:29:27 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 10 May 2006 - 06:10:04 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.