我有以下 LME 代码:
IDRTlme <- lme(Score ~ Group*Condition, random = ~1|ID, data=IDRT)
我想检查正态性假设,因此我完成了以下测试:
shapiro.test(resid(IDRTlme))
这是对 lme 的输出进行夏皮罗测试的正确方法吗?如果不是,那么我们将非常感谢任何帮助?
将非常感谢任何帮助!
这是数据 IDRT:
structure(list(ID = c("1993", "1993", "1993", "1993", "1993",
"1993", "1997", "1997", "1997", "1997", "1997", "1997", "19998",
"19998", "19998", "19998", "19998", "19998", "3122", "3122",
"3122", "3122", "3122", "3122", "3152", "3152", "3152", "3152",
"3152", "3152", "3182", "3182", "3182", "3182", "3182", "3182",
"330", "330", "330", "330", "330", "330", "354", "354", "354",
"354", "354", "354", "363", "363", "363", "363", "363", "363",
"369", "369", "369", "369", …Run Code Online (Sandbox Code Playgroud) 我有以下命令:
import pandas as pd
import numpy as np
from scipy import stats
np.random.seed(12345)
standarderrors1992 = stats.sem(np.random.normal(32000,200000,3650))
standarderrors1993 = stats.sem(np.random.normal(43000,100000,3650))
standarderrors1994 = stats.sem(np.random.normal(43500,140000,3650))
standarderrors1995 = stats.sem(np.random.normal(48000,70000,3650))
mean1992 = np.random.normal(32000,200000,3650).mean()
mean1993 = np.random.normal(43000,100000,3650).mean()
mean1994 = np.random.normal(43500,140000,3650).mean()
mean1995 = np.random.normal(48000,70000,3650).mean()
Run Code Online (Sandbox Code Playgroud)
在这里,我找到了一组随机选择的值的平均值和标准误差。
limit = 3000
dict = {mean1992:standarderrors1992,mean1993:standarderrors1993,mean1994:standarderrors1994,mean1995:standarderrors1995}
for key,value in dict:
if limit > (key+(1.96*value)):
colour = 1
elif limit < (key+(1.96*value)):
colour = 0
elif (limit !> (key+(1.96*value))) && (limit !< (key-(1.96*value))):
colour = ((key+(1.96*value))-limit)/((key+(1.96*value))-(key-(1.96*value)))
Run Code Online (Sandbox Code Playgroud)
在这里,我尝试将与均值和标准误差相对应的值放入字典中,以便我可以循环遍历它们。
理想情况下,我想根据特定年份的平均值和标准误差值,为变量“颜色”分配一个特定值。即 1992 年的平均值和 …
analytics ×1
boolean ×1
dataframe ×1
dictionary ×1
lme4 ×1
loops ×1
pandas ×1
python ×1
r ×1
statistics ×1