【发布时间】:2021-09-26 04:30:18
【问题描述】:
在下面的虚拟数据中,我想测试A和B的oviposition index是否与1显着不同。如果我理解正确,summary(mod)表示每个物种是否与0显着不同。怎么做我更改默认值以测试它是否不同于 1?在这里,我预计物种 B 与 1 显着不同,因为置信区间不包括 1
set.seed(111)
oviposition.index <- rnorm(20, 2, 1.3)
species <- rep(c("A","B"), each = 10)
month <- rep(c("Jan", "Feb"), times = 10)
plot <- rep(c("1", "2"), times = 10)
df <- data.frame(oviposition.index, species, month, plot)
mod <- lmer(oviposition.index ~ species + (1|month/plot), df)
summary(mod)
ggplot(df, aes(x = species, y = oviposition.index, color = species)) + geom_point() + geom_hline(yintercept = 1) + stat_summary(fun.data=mean_cl_boot, geom="errorbar", width=0.2, colour="black") + stat_summary(fun = mean, color = "black", geom ="point", size = 3,show.legend = FALSE)
【问题讨论】:
-
试试
lmer(oviposition.index ~ 0 + species + (1|month/plot), df)
标签: r ggplot2 lm lme4 mixed-models