多元统计分析方法练习题 下载本文

logitp=log(p/(1-p)); run;

Proc gplot data =temp3; Plot chd *age logitp *agrp; Run;

Proc logistic descending data ex6-4; Model chd=age ; Run;

Proc logistic descending data ex6-4; Model chd=agrp ; Run;

Proc reg data=temp3 graphics; Model logitp=agrp ; Run;

Output out=temp4 predicted=lp; Plot logitp*agrp; Run;

Data temp5 ; Set temp4;

Pp=exp(lp)/(1+exp(lp)); Proc gplot data=temp5; Plot pp*agrp; Run;

6-5解:

TITLE’多类结果的logistic回归’; DATA ex6_5; INPUT y x1 x2 f; y1=2-y; CARDS;

0 0 0 658 0 1 0 3 0 0 1 7 0 1 1 2 1 0 0 130 1 1 0 8 1 0 1 1 1 1 1 2 2 0 0 156 2 1 0 4 2 0 1 14 2 1 1 3 ;

PROC CATMOD;

WEIGHT f; DIRECT x1 x2;

MODEL y1=x1 x2/FREQ ONEWAY COVB CORRB; RUN;

检验睾丸癌与隐睾症的同侧性和异侧性,需比较不同变量之间的系数,SAS无法解决,建议使用stata 6-6 解:

Title ex6-6;

Input treat bangage dressing heal freq @@; Cards;

0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 2 0 1 0 0 0 1 0 1 0 1 0 2 0 1 1 0 0 1 1 1 0 1 1 2 RUN;

Proc logistic descending ; Freq freq;

Model heal=treat bangage dressing /clodds=wald; Run;

Proc catmod; Weight freq;

Direct treat bandage dressing; Response alogits;

Model heal=_response_treat bandage dressing ; Run; 6-7 解:

TITLE’1:3配对资料条件logistic回归’; DATA ex6_7;

INPUT match obs low age lwt smoke ht ui ptl; time=2-low; CARDS;

19 1 4 1 4 1 21 1 3 1 2 1 9 1 8 1 6 1 10 1 10 1 5 1 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 1 0 1 1 1 1 1 1 0 1 2 0 1 2 0 1 2 0 1 2

1 1 1 16 130 0 0 0 0 1 2 0 16 112 0 0 0 0 1 3 0 16 135 1 0 0 0 1 4 0 16 95 0 0 0 0 ………

29 1 1 32 105 1 0 0 0 29 2 0 32 121 0 0 0 0 29 3 0 32 132 0 0 0 0 29 4 0 32 134 1 0 0 1 ;

PROC PHREG;

MODEL time*low(0)=lwt smoke ht ui ptl/TIES=DISCRETE; STRATA age; RUN;

7-1 发病 不发病 合计 发病率 暴露 a 非暴 c 露 合计 a+c 证明:

b+d N p=a+c/N B D a+b c+d p1=a/a+b p2=c/c+d 2?G?(a???a?)2V?a?(c???c?)2(a?Ta)2(c?Tc)2???V?c?(a?b)p(1?p)(c?d)p(1?p)(a?Ta)2(c?Tc)2??a?cb?d(a?b)/N/N(c?d)a?c/Nb?d/N(a?Ta)2(a?b)(c?Tc)2(c?d)??(a?b)(a?c)(a?b)(c?d)(c?d)(a?c)(b?d)(c?d)NNNN(a?Ta)2(a?b)(c?Tc)2(c?d)??TaTbTcTd(a?Ta)2(Ta?Tb)(c?Tc)2(Tc?Td)??TaTbTcTd(a?b?Ta?Tb;c?d?Tc?Td)(a?Ta)2(a?Ta)2(c?Tc)2(c?Tc)2???TaTbTcTd(a?Ta)2(b?Tb)2(c?Tc)2(d?Td)2??????2p,得证.TaTbTcTd(a?Ta)2?(b?Tb)2?(c?Tc)2?(d?Td)2)

7-2

DATA exp7_2; INPUT y x; CARDS; 2 -1 3 -1 6 0 7 0 8 0 9 0 10 1