SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1098|回复: 0
打印 上一主题 下一主题

Updates to SAS® Power and Sample Size Software in SAS/STAT®

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2011-5-14 13:21:36 | 只看该作者

Updates to SAS® Power and Sample Size Software in SAS/STAT®

From LCChien's blog on blogspot

Link:&nbsp;<a href="http://www2.sas.com/proceedings/forum2008/368-2008.pdf"><!-- m --><a class="postlink" href="http://www2.sas.com/proceedings/forum2008/368-2008.pdf">http://www2.sas.com/proceedings/forum2008/368-2008.pdf</a><!-- m --></a><br /><br />PROC POWER程序從SAS 9.1版發表出來後,讓許多power和樣本計算的過程不需要靠使用者自行寫程式才能完成。但一開始的功能並不完備,不過在SAS 9.2版釋出後,PROC POWER 內建的功能就逐漸被補齊了。Wayne Watson 於 SAS Global Forum 2008 發表了一份技術文件,整理了 SAS 9.2版的 PROC POWER 一些新增的功能。<br /><br /><a name='more'></a><br /><b>(1)&nbsp;LOGISTIC REGRESSION</b><br />羅吉斯迴歸的 power analysis 在此已經可以進行了。使用前要先寫 logistic 告知 SAS 要跑這種模型的 power analysis,並把要檢定的預測變數、勝算比以及反應變數 Y=1 的機率都寫上去,重點是要把檢定的預測變數的分配設定好(藍色部分)。<br /><pre><code>proc power;<br />&nbsp;&nbsp; &nbsp;<span class="Apple-style-span" style="color: red;">logistic</span><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alpha = 0.05<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-style-span" style="color: blue;">vardist(’Duration’) = normal(4, 1.5)</span><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;testpredictor = ’Duration’<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;testoddsratio = 1.7<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;responseprob = 0.65<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ntotal = 50 60 70<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;power = . ;<br />run;</code></pre><img src="http://farm5.static.flickr.com/4111/5090414047_1fa6084d3d_z.jpg" /><br /><br /><b>(2) CONFIDENCE INTERVAL FOR ONE PROPORTION</b><br />二項變數的信賴區間也可以算了,但這結果其實跟用 PROC FREQ 算出來的結果是一樣的,所以如果你已經會用 PROC FREQ 來算二項變數的信賴區間的話,就不用多學這一段了。<br /><pre><code>proc power;<br />&nbsp;&nbsp; &nbsp;onesamplefreq ci = Wilson<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alpha = 0.05<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;proportion = 0.3<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;halfwidth = 0.1<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ntotal = 70<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;probwidth = .;<br />run;</code></pre><img src="http://farm5.static.flickr.com/4152/5090427997_40719ea898_z.jpg" /><br /><br /><b>(3) EQUIVALENCE TESTS FOR ONE PROPORTION</b><br />假設檢定中的比例檢定的 power analysis 也可以做了。重點就是要把紅色那段程式碼寫上去,其餘的參數設定跟以往都差不多。<br /><pre><code>proc power;<br />&nbsp;&nbsp; &nbsp;<span class="Apple-style-span" style="color: red;">onesamplefreq test = equiv_exact</span><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alpha = 0.05<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;proportion = 0.35<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;lower = 0.2<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;upper = 0.4<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ntotal = 500<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;power = .;<br />run;</code></pre><img src="http://farm5.static.flickr.com/4144/5090433565_6548feeb34_z.jpg" /><br /><br /><b>(4)&nbsp;WILCOXON MANN-WHITNEY TEST FOR TWO INDEPENDENT GROUPS</b><br />無母數 Wilcoxon Mann-Whitney 檢定的 power analysis 可以用 twosamplewilcoxon 呼叫出。比較麻煩的是類別變數的分配要自己將每一層的 coding 和機率值打上去(藍色部分),注意後面機率值的總和要等於一。<br /><pre><code>proc power;<br />&nbsp;&nbsp; &nbsp;<span class="Apple-style-span" style="color: red;">twosamplewilcoxon</span><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alpha = 0.05<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-style-span" style="color: blue;">vardist(’lidocaine’) =ordinal( (-3 -2 -1 0 1 2 3): (.01 .04 .20 .50 .20 .04 .01) )</span><br /><span class="Apple-style-span" style="color: blue;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;vardist(’mironel plus lidocaine’) =ordinal( (-3 -2 -1 0 1 2 3): (.01 .03 .15 .35 .30 .10 .06) )</span><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;variables = ’lidocaine’ | ’mironel plus lidocaine’<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sides = u<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ntotal = .<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;power = 0.85;<br />run;</code></pre><img src="http://farm5.static.flickr.com/4152/5091035958_1b0d85e685_z.jpg" /><br /><br />最後原文有介紹一個SAS專門拿來做 Power analysis 的副產品Power and Sample Size 3.1,簡稱 PSS。不過這個軟體並沒有附在 SAS/STAT 裡面,需要另外安裝。我自己的 SAS 9.2 光碟片裡面好像也沒有這個附加軟體,研判應該是需要另外付費才有。我想應該也不會有很多人有 PSS,所以在此略過不提。把 PROC POWER 熟用應該就可以應付大部分的 Power analysis 以及相關繪圖。<br /><br /><b>CONTACT INFORMATION</b><br />Wayne Watson<br />Building S, Room 3040<br />SAS Institute, Inc.<br />SAS Campus Drive<br />Cary, NC 27513<br />Work Phone: 919-531-6770<br />E-mail: <!-- e --><a href="mailto:wayne.watson@sas.com">wayne.watson@sas.com</a><!-- e --><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6268919072942670865-5646856717479538395?l=sugiclub.blogspot.com' alt='' /></div>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-6-10 13:28 , Processed in 0.068058 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表