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

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Tue 09 May 2006 - 02:28:41 EST


Ordinal variables should be stored as ordered factors in R. See ?ordered.

Andy

From: Knut Krueger
>
> There is a difference in the p- value from 0.000 and 0.012
> when I am
> using SPSS.
> 0.000 when I am using the independent variable as scaled
> 0.012 if I am using the variable as ordinal.
>
> The independent variable is ordinal but it seems that R is
> using the variable as an scaled, because the P- Value is
> computed with 4.66e-06
>
>
> so I am not sure which description I am misunderstanding:
> SPSS;:
> Covariates. Scale predictors
> <javascript:popup(N2C5F1_term,N2C5F1_def);>
> should be selected as covariates
> <javascript:popup(N2B079_term,N2B079_def);> in the model. Within
> combinations of factor levels (or cells
> <javascript:popup(N2AE3F_term,N2AE3F_def);>), values of
> covariates are
> assumed to be linearly correlated with values of the
> dependent variables.
> (A variable can be treated as scale when its values represent ordered
> categories with a meaningful metric, so that distance comparisons
> between values are appropriate. Examples of scale variables
> include age
> in years and income in thousands of dollars.)
>
> Factors. Categorical <javascript:popup(N2AD73_term,N2AD73_def);>
> predictors should be selected as factors
> <javascript:popup(N2B481_term,N2B481_def);> in the model. Each level
> <javascript:popup(N2B937_term,N2B937_def);> of a factor can have a
> different linear effect on the value of the dependent variable.(A
> variable with a discrete number of values; an ordinal or nominal
> variable. Categorical variables are often used as grouping
> variables or
> factors.)
>
> The data : http://biostatistic.de/temp/testr.csv
>
> lm.data<-lm( dependent ~ var2,family = gaussian)
>
> I don't know whether anybody could explain me the difference between
> SPSS and R results but if there are different results then
> one of them
> is wrong :-(
> And I do not know which of them.
> I hope I explained the problem understandable
>
> 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
>
>



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 Tue May 09 02:42:55 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.