y: 交通事故的危险度
x1: 年龄 (1=teenager)
x2: 饮酒 (1=yes, 0=no)
x3: 性别 (1=male, 0=female)
proc reg data=old;
model y=x1 x2 x3;
run;
没有交叉变量时 y=1.5*x1 + 2*x2 + 1.2*x3
此方程说明,你假定无论年龄大小只要喝酒,交通事故的危险度就增大2倍,同时无论是否喝酒,只要是年轻人,交通事故的危险度就增大1.5倍。如果又是年轻人又喝酒,危险度就增大2+1.5=3.5倍.
但是data 显示如果是年轻人又喝酒,该组的危险度就比非年轻人不喝酒增大6倍之多,说明方程存在x1*x2的交叉变量, 系数为2.5, 因为 1.5+2+2.5=6
所以,正确的方程应该是:
y=1.5*x1 +2*x2 + 2.5*x1x2 + 1.2*x3
SAS code:
data new;
set old;
x1x2new=x1*x2;
run;
proc reg data=new;
model y=x1 x2 x1x2new x3;
run;
补充:interation terms can be x1*x2, x1*x3, x2*x3 (two way interactions) and x1*x2*x3 (three way interaction),你要一项一项的检验它们是否有意义。
For more reading, here is a pdf file for interaction in regression:
http://online.mq.edu.au/pub/PSYSTAT/documents/interaction.pdf
[此贴子已经被作者于2007-4-11 3:30:32编辑过]