SAS中文论坛

标题: 青椒 做1:2配对的条件Logistic回归的sas程序? [打印本页]

作者: shiyiming    时间: 2009-6-14 19:35
标题: 青椒 做1:2配对的条件Logistic回归的sas程序?
做1:2配对病例对照研究的条件Logistic回归的sas程序。有目标变量lung_cancer(=1患病即病例组有225例,=0正常即对照组450例),还有自变量x1 x2 x3 x4 x5等,均为分类变量
欲研究x1与lung_cancer(即肺癌)的关系,且x1有3个等级,同时调整x2、x3、x3、x4等混杂因素变量(各有不同等级,有的有序,有的无序)。

请问如何实现呢?
data a;
input lung_cancer x1 x2 x3 x4 x5@@;
cards;
0  1   2  3  5  4
1  1   3  2  1  2
0  2   3  2  5  3
1  2   4  1  3  2
0  3   2  1  4  1
1  3   1  1  1  2
……/*共675条记录*/

proc phreg data=a;

model lung_cancer=x1;
run;

以上程序是做非条件logistic的,做条件的话中间少了一些内容,请教高手最精华的内容。
还有且不论事非条件,还是条件logistic回归,如何调整其余的混杂变量呢?
或者还需要补充什么资料?
是直接分析好了,还是做个r*2频数表分析。
作者: shiyiming    时间: 2009-6-14 20:54
标题: Re: 青椒 做1:2配对的条件Logistic回归的sas程序?
小弟不才,你的这个是条件logistic回归?看上去怎么是生存分析的子程序?抛砖引玉吧:
1.首先,可以用proc logistic子程序。
2.由于X1是有序变量,所以直接用其值。但是对于无序变量,有两种方法解决:一种是定义class语句;一种是生成哑变量,注意哑变量个数应该是无序变量水平数-1,感觉你是学统计的,应该知道个中原因。
作者: shiyiming    时间: 2009-6-14 22:00
标题: Re: 青椒 做1:2配对的条件Logistic回归的sas程序?
phreg的确可以做条件logistic回归。只是程序的写法有点问题吧。
作者: shiyiming    时间: 2009-6-15 21:14
标题: Re: 青椒 做1:2配对的条件Logistic回归的sas程序?
to jingju11
我知道有问题,就是不会写啊,呵呵
作者: shiyiming    时间: 2009-6-15 21:59
标题: Re: 青椒 做1:2配对的条件Logistic回归的sas程序?
data a;
input lung_cancer x1 x2 x3 x4 x5;
time=2-lung_cancer;*define time;
cards;
0 1 2 3 5 4
1 1 3 2 1 2
0 2 3 2 5 3
1 2 4 1 3 2
0 3 2 1 4 1
1 3 1 1 1 2
……/*共675条记录*/

proc phreg data=a;
model time*lung_cancer(0)=x1 x1 x2 x3 x4 x5/ties=discrete;*adjusting for x2 ...;
run;
作者: shiyiming    时间: 2009-6-15 22:00
标题: Re: 青椒 做1:2配对的条件Logistic回归的sas程序?
sorry, only one x1 in last model
作者: shiyiming    时间: 2009-6-15 22:08
标题: Re: 青椒 做1:2配对的条件Logistic回归的sas程序?
"且x1有3个等级,同时调整x2、x3、x3、x4等混杂因素变量(各有不同等级,有的有序,有的无序)。.."

Sorry, I did not pay attention to those conditions.
you know, phreg only can deal with contiunous variables; that is, if you do not regard those as continuous, you have to change those variables to dummies.for example, for x, you can write two new variables ,x1=(x=1) and x2=(x=2) and so on;
i believe that proc tphreg can deal with class directly, you can do some research on that.




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2