0

我想使用 pingouin rm_anova 重复测量 anova。我的数据是长格式的,有不同的时间点(时间),每个id是一个主题,每个主题在3个不同的时间点重复3次。DV 是 weight_loss,IVs 是组和时间。数据如下所示:

    id  group   time    weight_loss
0   1083    NOPE    b   0.000000
1   1146    Placebo b   0.000000
2   1214    Placebo b   0.000000
3   1317    Placebo b   0.000000
4   1318    NOPE    b   0.000000
... ... ... ... ...
155 1805    NOPE    pm  0.042579
156 1813    Placebo pm  -0.084606
157 1819    Placebo pm  -0.073008
158 1831    Placebo pm  -0.018574
159 1837    NOPE    pm  -0.064956

这是我的代码:

import pingouin as pg
res = pg.rm_anova(dv = 'weight_loss', within = ['group', 'time'], data = sub, subject = 'id', detailed = True)
res

但我收到这样的错误消息:

/python3.8/site-packages/numpy/lib/function_base.py:380: RuntimeWarning: Mean of empty slice.
  avg = a.mean(axis)
/python3.8/site-packages/numpy/core/_methods.py:162: RuntimeWarning: invalid value encountered in true_divide
  ret = um.true_divide(
/python3.8/site-packages/pandas/core/frame.py:8276: RuntimeWarning: Degrees of freedom <= 0 for slice
  base_cov = np.cov(mat.T, ddof=ddof)
/python3.8/site-packages/numpy/lib/function_base.py:2480: RuntimeWarning: divide by zero encountered in true_divide
  c *= np.true_divide(1, fact)
/python3.8/site-packages/numpy/lib/function_base.py:2480: RuntimeWarning: invalid value encountered in multiply
  c *= np.true_divide(1, fact)
/python3.8/site-packages/numpy/lib/function_base.py:380: RuntimeWarning: Mean of empty slice.
  avg = a.mean(axis)
/python3.8/site-packages/numpy/core/_methods.py:162: RuntimeWarning: invalid value encountered in true_divide
  ret = um.true_divide(
/python3.8/site-packages/pandas/core/frame.py:8276: RuntimeWarning: Degrees of freedom <= 0 for slice
  base_cov = np.cov(mat.T, ddof=ddof)
/python3.8/site-packages/numpy/lib/function_base.py:2480: RuntimeWarning: divide by zero encountered in true_divide
  c *= np.true_divide(1, fact)
/python3.8/site-packages/numpy/lib/function_base.py:2480: RuntimeWarning: invalid value encountered in multiply
  c *= np.true_divide(1, fact)

我尝试了 'within' variable = ['time'] 并且它有效,但它不适用于单独的 ['group'] 变量或组合。我还检查了 NA,没有 NA 也没有 0。有谁知道出了什么问题以及如何解决?

先感谢您!

4

0 回答 0