[英]R extract only power from power.t.test
我正在嘗試使用curve()方法將功率繪制為增量的函數。 我能弄清楚如何從一個樣本t檢驗中找到功效的唯一方法是使用power.t.test()方法。 但是,此方法返回幾個值,但是我只對功能感興趣。 以下是我當前用於計算功率的代碼:
n1 = 5 SD = 0.10 power1 = function(x) power.t.test(n=n1, delta = x, sd = SD, sig.level = 0.05, power = NULL, type = "one.sample")
提前致謝
使用str
查看返回內容。 力量就是元素power
,因此您的代碼應該是
n1 = 5
SD = 0.10
power1 = function(x) power.t.test(n=n1, delta = x, sd = SD, sig.level = 0.05, power = NULL, type = "one.sample")$power
功率曲線將是(例如)
curve(power1, .1, .8, xlab="SMD", ylab="Power")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.