s**f 发帖数: 365 | 1 请大家帮我回答一下!感谢!
regression模型中ordinal的independent var,比如Education,有6个level:低于8年
纪,8年级毕业,一些高中,高中毕业,一些大学,大学毕业。
先想问一下,因为有6个级别,是不是先要test有没有quad,cubic,tet和quin的
function(X^2,X^3,X^4,X^5)存在?
还有一个问题就是,如果是用effect或者reference coding的话,那就损失了ordinal
的信息,是不是干脆就approximate,code为1,2,3,4,5,6?这样做需要什么条件
?
谢谢! |
A*******s 发帖数: 3942 | 2 it's usual to treat ordinal variable as categorical. In ur case, it's also
ok to code them from 1 to 6, especially since the variable look like equally
spaced in terms of "years of education".
ordinal
【在 s**f 的大作中提到】 : 请大家帮我回答一下!感谢! : regression模型中ordinal的independent var,比如Education,有6个level:低于8年 : 纪,8年级毕业,一些高中,高中毕业,一些大学,大学毕业。 : 先想问一下,因为有6个级别,是不是先要test有没有quad,cubic,tet和quin的 : function(X^2,X^3,X^4,X^5)存在? : 还有一个问题就是,如果是用effect或者reference coding的话,那就损失了ordinal : 的信息,是不是干脆就approximate,code为1,2,3,4,5,6?这样做需要什么条件 : ? : 谢谢!
|
s**f 发帖数: 365 | 3 Thank you for the reply!
In your projects, do you test quadratic and cubic functions of these
variables? Or more often, just assume they are not there?
equally
【在 A*******s 的大作中提到】 : it's usual to treat ordinal variable as categorical. In ur case, it's also : ok to code them from 1 to 6, especially since the variable look like equally : spaced in terms of "years of education". : : ordinal
|
A*******s 发帖数: 3942 | 4 it's a judgmental call. linear models are everywhere but u can always
include curvature into ur models as long as it makes sense.
【在 s**f 的大作中提到】 : Thank you for the reply! : In your projects, do you test quadratic and cubic functions of these : variables? Or more often, just assume they are not there? : : equally
|
z**********i 发帖数: 12276 | 5 越简单越好吧.
【在 s**f 的大作中提到】 : Thank you for the reply! : In your projects, do you test quadratic and cubic functions of these : variables? Or more often, just assume they are not there? : : equally
|
s**f 发帖数: 365 | 6 是的
我已经试过了,quad,cubic都drop out了。
把Education当成一个continuous的var,值是123456就可以了。应该是比code成dummy
或者effect要好。
【在 A*******s 的大作中提到】 : it's a judgmental call. linear models are everywhere but u can always : include curvature into ur models as long as it makes sense.
|
s**f 发帖数: 365 | 7 请大家帮我回答一下!感谢!
regression模型中ordinal的independent var,比如Education,有6个level:低于8年
纪,8年级毕业,一些高中,高中毕业,一些大学,大学毕业。
先想问一下,因为有6个级别,是不是先要test有没有quad,cubic,tet和quin的
function(X^2,X^3,X^4,X^5)存在?
还有一个问题就是,如果是用effect或者reference coding的话,那就损失了ordinal
的信息,是不是干脆就approximate,code为1,2,3,4,5,6?这样做需要什么条件
?
谢谢! |
A*******s 发帖数: 3942 | 8 it's usual to treat ordinal variable as categorical. In ur case, it's also
ok to code them from 1 to 6, especially since the variable look like equally
spaced in terms of "years of education".
ordinal
【在 s**f 的大作中提到】 : 请大家帮我回答一下!感谢! : regression模型中ordinal的independent var,比如Education,有6个level:低于8年 : 纪,8年级毕业,一些高中,高中毕业,一些大学,大学毕业。 : 先想问一下,因为有6个级别,是不是先要test有没有quad,cubic,tet和quin的 : function(X^2,X^3,X^4,X^5)存在? : 还有一个问题就是,如果是用effect或者reference coding的话,那就损失了ordinal : 的信息,是不是干脆就approximate,code为1,2,3,4,5,6?这样做需要什么条件 : ? : 谢谢!
|
s**f 发帖数: 365 | 9 Thank you for the reply!
In your projects, do you test quadratic and cubic functions of these
variables? Or more often, just assume they are not there?
equally
【在 A*******s 的大作中提到】 : it's usual to treat ordinal variable as categorical. In ur case, it's also : ok to code them from 1 to 6, especially since the variable look like equally : spaced in terms of "years of education". : : ordinal
|
A*******s 发帖数: 3942 | 10 it's a judgmental call. linear models are everywhere but u can always
include curvature into ur models as long as it makes sense.
【在 s**f 的大作中提到】 : Thank you for the reply! : In your projects, do you test quadratic and cubic functions of these : variables? Or more often, just assume they are not there? : : equally
|
|
|
z**********i 发帖数: 12276 | 11 越简单越好吧.
【在 s**f 的大作中提到】 : Thank you for the reply! : In your projects, do you test quadratic and cubic functions of these : variables? Or more often, just assume they are not there? : : equally
|
s**f 发帖数: 365 | 12 是的
我已经试过了,quad,cubic都drop out了。
把Education当成一个continuous的var,值是123456就可以了。应该是比code成dummy
或者effect要好。
【在 A*******s 的大作中提到】 : it's a judgmental call. linear models are everywhere but u can always : include curvature into ur models as long as it makes sense.
|
s**f 发帖数: 365 | 13 Please help
How to add a "_A" to all the names of the variables in the dataset?
Thank you! |
P****D 发帖数: 11146 | 14 Why do you want to do that?
I have done something similar before using macros. Don't know if my approach
is the easiest.
First use PROC CONTENTS to export all the variable names into a dataset, so
all these variable names are values of a string variable. Then add "_A" to
these values (Google if you don't know how to manipulate string variables).
Then use loop to generate a string macro variable whose CONTENT looks like
this "rename x = x_A; rename y=y_A;". Then you can execute that macro
variable as if it were SAS command.
Very tedious job. Don't do it until you have a good reason...
【在 s**f 的大作中提到】 : Please help : How to add a "_A" to all the names of the variables in the dataset? : Thank you!
|
P****D 发帖数: 11146 | 15 Or you can do this:
http://support.sas.com/resources/papers/proceedings09/075-2009.
【在 s**f 的大作中提到】 : Please help : How to add a "_A" to all the names of the variables in the dataset? : Thank you!
|
s**f 发帖数: 365 | 16 Thank you for the suggestion!
I have a baseline survey and a followup survey. They have identical
variables. I would like to merge the two dataset and do some analysis. So I
am thinking renaming the variables. For example, variable OC3 in the 1st and
2nd survey will be renamed to OC3_A and OC3_B, respectively.
Is there a better way to approach this problem?
approach
so
.
【在 P****D 的大作中提到】 : Why do you want to do that? : I have done something similar before using macros. Don't know if my approach : is the easiest. : First use PROC CONTENTS to export all the variable names into a dataset, so : all these variable names are values of a string variable. Then add "_A" to : these values (Google if you don't know how to manipulate string variables). : Then use loop to generate a string macro variable whose CONTENT looks like : this "rename x = x_A; rename y=y_A;". Then you can execute that macro : variable as if it were SAS command. : Very tedious job. Don't do it until you have a good reason...
|
P****D 发帖数: 11146 | 17 http://support.sas.com/resources/papers/proceedings09/075-2009
I
and
【在 s**f 的大作中提到】 : Thank you for the suggestion! : I have a baseline survey and a followup survey. They have identical : variables. I would like to merge the two dataset and do some analysis. So I : am thinking renaming the variables. For example, variable OC3 in the 1st and : 2nd survey will be renamed to OC3_A and OC3_B, respectively. : Is there a better way to approach this problem? : : approach : so : .
|
s**f 发帖数: 365 | |
P****D 发帖数: 11146 | 19 Baozi!!!
【在 s**f 的大作中提到】 : Great! Thanks!
|
s**f 发帖数: 365 | 20 Sent! Thanks!
【在 P****D 的大作中提到】 : Baozi!!!
|