12 1 15 1 ;
PROC GENMOD;
MODEL y=x/DIST=POISSON LINK=id INTERCEPT=7.5 ITPRINT; Run;
T 7_3解答 DATA ex7_3;
INPUT y quality yanzheng age center f; IF quality = 1 ? yanzhneg=1 THEN bingsi=1; IF quality = 2 ? yanzhneg=1 THEN bingsi=2; IF quality = 1 ? yanzhneg=2 THEN bingsi=3; IF quality = 2 ? yanzhneg=2 THEN bingsi=4; CARDS;
1 1 1 1 1 9 1 1 2 1 1 4 ……
0 2 1 3 3 11 0 2 2 3 3 1 ;
PROC GENMOD; FREQ f;
INITIAL=5.0 MODEL y=bingsi age center/LINK=LOG DIST=NORMAL; PROC GENMOD; FREQ f;
MODEL y=bingsi age center/LINK=LOG DIST=BINORMIAL; PROC GENMOD; FREQ f;
MODEL y=bingsi age center/LINK=LOG DIST=POISSON; RUN;
T7-4解答 DATA ex7_4; INPUT r n x1 x2; a1=log(x1+1); a2=log(x2+1); t=a1*a2; CARDS; 11 200 0 0 ……
193 200 100 100 ;
PROC LOGISTIC; MODEL r/n=a1 a2 t; RUN; DATA a; SET ex7_4; Ln=log(n); PROC GENMOD;
MODEL r=a1 a2 t/DIST=POISSON OFFSET=ln; RUN;
负二项回归SAS不能解决,建议使用stata.
例7.5
TITLE’Poisson 回归’;
OPTION LS=150; DATA EX7_5;
INPUT d age sex month year @@; _pi=301415926;
M1=cos(_pi/6*month); M2=sin(_pi/6*month); Datalines;
0 0 1 1 78 1 0 1 1 81 ……..
4 2 0 12 80 2 2 0 12 83 ;
Proc genmod;
Model d=age sex/DIST=POISSON LINK =LOG; RUN;
PROC GENMOD;.
MODEL d=age sex M1 M2/DIST=POISSON LINK=LOG; RUN;
负二项回归SAS 不能解决,建议使用stata。
练习8.1
?0.65ts(t)?e(1)生存函数:曲线如下:
s(t)?e?0.65t
t??1
(3)生存大于两个单位时间的概率:
??1.5385tm?ln0.5?1.0664?0.65
s(t)t?2?e?0.65tt?2?e?0.65?2?0.27253719?(?t)m
8.2(1)生存函数:s?t??e?e?(0.8t)3曲线如下:
m?1 危险度函数:h(t)?m?(?t)?3?0.8(0.8t)2