Rmisc: summarySE

2023-08-18  本文已影响0人  LET149

按分组统计 均值标准差均值的标准误差置信区间

Gives count, mean, standard deviation, standard error of the mean, and confidence interval (default 95%).

summarySE(data, measureva=, groupvars=)

measureva=: 对哪个列进统计
groupvars=: 按照哪个列名进行分组,可以是一个列名,也可以是多个列名(以字符串向量形式展示).

1. 示例一

> head(kk)
                 Age       Tau
1    pre_Drosophilid 0.7387884
2      pre-Bilateria 0.9258429
3      pre-Bilateria 0.9087641
4          Eukaryota 0.4034435
5 Cellular_Organisms 0.8659606
6            Diptera 0.8138230
> pp <- summarySE(kk_male, measurevar = "Tau", groupvars = c("Age"))
> pp
                  Age    N       Tau        sd          se          ci
1  Cellular_Organisms  906 0.6623005 0.1815530 0.006031693 0.011837733
2           Eukaryota 2337 0.6274537 0.1840021 0.003806217 0.007463915
3       pre-Bilateria 2131 0.7323985 0.1856260 0.004021121 0.007885733
4             Diptera 1713 0.8108724 0.1711374 0.004134911 0.008110010
5     pre_Drosophilid 2852 0.8731310 0.1522043 0.002850047 0.005588362
6            Branch_1  199 0.9044271 0.1368329 0.009699826 0.019128227
7            Branch_2  209 0.9198845 0.1208336 0.008358233 0.016477711
8            Branch_3  199 0.9399845 0.1118269 0.007927202 0.015632581
9            Branch_4  330 0.9153882 0.1331260 0.007328346 0.014416327
10           Branch_5   71 0.9288153 0.1154977 0.013707058 0.027337865
11           Branch_6   43 0.9199780 0.1286013 0.019611520 0.039577651

ci = confidence interval; +-ci95% (默认) 置信区间

上一篇下一篇

猜你喜欢

热点阅读