多元统计分析方法练习题(8)

2019-08-03 13:14

Y=y-1 ;

s1=0; If sbp=2 then s1=1; s2=0; If sbp=3 then s2=1; s3=0; If sbp=4 then s2=1; c1=0; If cho=2 then c1=1; c2=0; If cho=3 then c2=1; c3=0; If cho=4 then c2=1; run;

Proc logistic descending; Weight f;

Model y=sbp cho ;; Run;

Proc logistic descending; Weight f;

Model y=s1-s3 c1-c3; Test1: test s2-s1=s1; Test2: test s3-s2=s2-s1; Test3: test c2-c1=c1; Test4: test c3-c2=c2-c1; Run; 6-4解: Data ex6-4;

Input id chd age agrp@@; Cards;

1

0 20

… …34

0

38

; Run;

Proc gplot; Plot chd *age; Run;

/*计算条件均数p*/ Proc sort out =temp; By agrp;

Proc univariate data =temp noprint; By agrp; Var chd;

Output out=temp2 N=n sum=n1 mean=p; Run;

Proc print data =temp2; Run;

data =temp3; set temp2;

1 35

3

0 38

3 68

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


多元统计分析方法练习题(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:关于鼓励员工考取职称及职业资格证书的奖励办法

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: