[英]simr: how to specify expected effect size in lm() or aov() models?
[英]Sample size calculation for mixed models - simr package
我正在使用nlme::lme
構建模型,其中只有一個隨機效果(ID)和一個二進制自變量(x)。 我現在正嘗試使用此模型進行樣本量計算。
Linear mixed-effects model fit by REML
Data: mydata2
AIC BIC logLik
214.0042 226.7538 -103.0021
Random effects:
Formula: ~1 | ID
(Intercept) Residual
StdDev: 0.4687304 0.2979965
Fixed effects: y ~ x
Value Std.Error DF t-value p-value
(Intercept) 2.5223996 0.08830079 111 28.565991 0.0000
x -0.0357012 0.12447286 68 -0.286819 0.7751
R中的simr
包似乎可以完成這項工作。
但是,由於錯誤我實際上沒有任何結果,我也不知道這里可能有什么問題...
powerSim(model1, fixed("x", "lr"), nsim = 1000)
Power for predictor 'x', (95% confidence interval):=============================|
0.00% ( 0.00, 3.62)
Test: Likelihood ratio
Based on 1000 simulations, (0 warnings, 1000 errors)
alpha = 0.05, nrow = 2
Time elapsed: 0 h 0 m 20 s
nb: result might be an observed power calculation
我在網上發現了一些有關將測試更改為“ t”或“ z”而不是“ lr”的建議,但這一點都沒有改變...
然后我運行lastResult()$err
看看有什么問題,我得到了以下內容,我找不到確切的內容...
stage index message
1 Fitting 1 invalid type/length (symbol/0) in vector allocation
2 Fitting 2 invalid type/length (symbol/0) in vector allocation
3 Fitting 3 invalid type/length (symbol/0) in vector allocation
4 Fitting 4 invalid type/length (symbol/0) in vector allocation
5 Fitting 5 invalid type/length (symbol/0) in vector allocation
我會提供任何形式的幫助,甚至是使用此模型進行樣本計算的任何其他方式。
謝謝!
我想添加評論,但我沒有足夠的聲譽。 顯然,可以結合使用nlme和simr軟件包: https ://www.ncbi.nlm.nih.gov/pubmed/29386525
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.