syh002008 发表于 2010-5-22 13:14 
现在有些数据要分析,要做交互作用,不知道怎么分析,请大家帮忙。
数据包括:基因型(分三类),hcy(连续性变量),性别(2分类变量),年龄(连续性变量),身高(连续性变量),体重(连续性变量)。
现在要做:基因型和性别的交互作用对hcy的影响,调整性别,年龄,身高,体重。
自己查了下书,不知道说的对不对,也不知道如何操作。
1)Y(hcy)=a+性别+年龄+身高+体重+基因型+性别*基因型
2)Y(hcy)=a+性别+年龄+身高+体重+基因型
(1和2都把系数省略了)
1)和2)分别得到对数似然函数值,然后 G= -2*(模型P的对数似然函数值-模型K的对数似然函数值) ,符合自由度为K-P的卡方分布。
现在我有些糊涂了,sas程序 2) model y=sex height weight geno sex*geno;
1) model y=sex height weight geno ;
可以求出1)和2)的对数似然函数值,然后按上面的公式后怎么做符合K-P 的卡方分布,如何用sas实现。如果我想知道交互作用的大小(具体的值)该怎么算?
Since you do not provide data, I use simulated one to illustrate the key points.
Note: Continuous variavle=z, genno=x, sex=x2
By construction in my simulation, there is a interaction
x * x2= {1 , 2 , 3,
2, 4 , 6}
1) you need to test which model is better explaned by data.
(y= x*x2 z or y= x x2 x*x2) vs y=x x2 z
This can be done likelihood ratio test. The model (y= x*x2 z or y= x x2 x*x2) is better because the data is generated by interaction of x*x2, so the simple linear approximation is rejected.
2) you may test if the cell of (x=1, x2=2) and the cell of (x=2, x2=1) is the same, it should be the same by construction.
3) Then should be interpret your results, the interaction exists. That is to say each cell (x*x2) has differenct effect except for the cell of (x=1, x2=2) and the cell of (x=2, x2=1).
Run the following program and check the results.
Hope this helps.
data t1;
do x=1 to 3;
do x2=1 to 2;
do obs=1 to 10;
z=rannor(123);
y= 1+ x*x2 +1*z+ rannor(7789);
output;
end;
end;
end;
run;
proc mixed data=t1 method=ML;
class x x2;
model y= x*x2 z /solution;
run;
proc mixed data=t1 method=ML;
class x x2;
model y=x x2 z/solution;
run;