楼主: syh002008
19799 4

求助:sas如何做交互作用 [推广有奖]

  • 0关注
  • 1粉丝

本科生

60%

还不是VIP/贵宾

-

威望
0
论坛币
59 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
5733 点
帖子
105
精华
0
在线时间
101 小时
注册时间
2008-12-4
最后登录
2014-5-5

楼主
syh002008 发表于 2010-5-22 13:14:12 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
现在有些数据要分析,要做交互作用,不知道怎么分析,请大家帮忙。

数据包括:基因型(分三类),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实现。如果我想知道交互作用的大小(具体的值)该怎么算?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:交互作用 Weight Eight weigh model 求助 SAS 交互作用

回帖推荐

bobguy 发表于3楼  查看完整内容

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. Th ...

本帖被以下文库推荐

沙发
crackman 发表于 2010-5-22 23:02:13
MODEL里面直接用*引入交互效应的变量

藤椅
bobguy 发表于 2010-5-23 00:16:02
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;
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

板凳
syh002008 发表于 2010-5-23 01:00:28
感谢crackman 版主和bobguy。不好意思,由于我水平差,bobguy提供的方法我没有完全看明白,但还是要感谢。我已经询问了我的老师,他给我做了解释,问题已经解决。其实他给我的解释非常简单,就是和版主说的一样,他给我的解释很详细,可以使我理解这样做的原因。
解释大概是这样的:在基因型中,我只关心其中一种表型和男性的交互作用,所以他让我把基因型分成TT(我关心的表型)和非TT型的,性别男性和女性,然后做交互作用,算出beta值,和or值。

报纸
jingju11 发表于 2010-5-24 13:28:57
Likelihood Ratio test (LR test) is typical and easy to understand in statistics. Many procedures in SAS have implemented such test. The calculation yourself is not necessary. For example, if you want to give a LR test on an interaction term, you can use

  1. Proc genmod; Model  y = x1 x2 x1*x2/type3; Run;
复制代码

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-26 16:21