MPOWER

上传人:206****923 文档编号:40492281 上传时间:2018-05-26 格式:DOC 页数:4 大小:43KB
返回 下载 相关 举报
MPOWER_第1页
第1页 / 共4页
MPOWER_第2页
第2页 / 共4页
MPOWER_第3页
第3页 / 共4页
MPOWER_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《MPOWER》由会员分享,可在线阅读,更多相关《MPOWER(4页珍藏版)》请在金锄头文库上搜索。

1、/*-* Name: MPOWER.SAS * Title: retrospective power analysis for multivariate GLMs. *| | The program reads the OUTSTAT= data set constructed in a PROC GLM | step. For each effect tested, the program calculates the nominal | power of the test, if the sample means were population values. | | Usage: | %

2、include mpower; | proc glm data= outstat=STATS; | class classvars; | model depvars = independents / options; * use SSn option; | contrast name effect coefficients; | Examples: | %mpower(data=STATS, yvar=depvars) | %mpower(data=STATS, yvar=depvars, alpha=.01, tests=WILKS ROY) | |*-* Author: Michael F

3、riendly * Created: 11 Aug 1991 14:12:31 * Revised: 14 Dec 1991 10:00:22 * Version: 1.0 * *-*/ %macro mpower(yvar=, /* list of dependent varriables */data=_last_, /* outstat= data set from GLM */out=_data_, /* name of output data set with results */alpha=.05, /* error rate for each test */tests=WILKS

4、 PILLAI LAWLEY ROY /* tests to compute power for */);%if %length(%put MPOWER: YVAR= must specify list of dependent variables;%goto exit;%end; proc iml; start mstats(h, e, dfh, dfe, stats, df, alpha, tests, power)global(verbose);call geneig(roots, vectors, h, e);theta = roots / (1+roots);p = nrow(h);

5、s = min(p,dfh); * non-zero roots;m = .5#(abs(p-dfh)-1) ;n = (dfe - p - 1)/2;reset name fuzz;if verbose0 then print roots theta s m n;free stats df pow;*- Wilks lambda -;if any(tests=1) then do;lambda = (1/(1+roots1:s)#;pdf = p#2 + dfh#2 -5;if pdf 0 then do;sname = “Wilks Lambda“ “Pillais Trace“ “Law

6、ley Trace“Roys max. Root“union(tests);reset noname;print statsr=sname c=“Value“ “F“ f=8.3df c=“df1“ “df2“ f=5.0powc=“Eta#2“ “Non-Cent.“ “Power“ f=best6.;end;power = pow; finish; start mpower(f, dfh, df1, df2, alpha, nc, power);nc = f # dfh;fcrit = finv(1-alpha, df1, df2);if nc 100 then power=1;else

7、power = 1 - probf(fcrit, df1, df2, nc ); finish;use read all varread all vardf where(_type_=ERROR) into dfer=_name_;dfe = dfe1;read all varread all vardf where(_type_=ERROR) into dfsr=_source_;read all varf where(_type_=ERROR) into ufr=_source_;read all var_source_ _type_where (_type_=ERROR) into id

8、;close slabl=WILKS PILLAI LAWLEY ROY;t = do i = 1 to 4;if ncol(union(slabl,ti) = ncol(slabl) then do;tests=tests | i;sl = sl / slabli;end;end;p = nrow(e);effects = nrow(ssh) / p;verbose = 1;do i = 1 to effects;r1 = 1 + p#(i-1);r2 = p#i;dfh= dfsr1;f = uf r1;h = sshr1:r2,;effect = trim(idr1,);reset na

9、me;rlabl = repeat(effect,nrow(sl),1) | sl;alpha = print Power analysis for effect alpha;run mstats(h, e, dfh, dfe, stats, df, alpha, tests, power);out = out / (repeat(alpha,nrow(sl),1)|power);rlab= rlab/ rlabl;* end;end;create _out_ from outc=ALPHA ETA2 NC POWER;append from out;create _lab_ from rlablc=_SOURCE_ _TYPE_ STAT;append from rlab; quit; data merge _lab_ _out_;label nc=Non Centralityeta2=Eta Squaredstat=Statistic;%exit: %mend;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号