- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我测量了两种土壤类型的
丙酮
和乙醛排放量:
A和
B 94 天 3 次
```。
我已经计算并可视化了随时间推移的累积排放量,但是我在放置 CI 95% 波段 (+/-2 SD) 或什至简单的误差线时遇到了问题。
这是我设法做到的:
df_cum <- df%>%
group_by(soil_type, compound, days)%>%
summarise(mean=mean(emission))%>%
mutate(cum_emission=cumsum(mean))
plot <- ggplot(df_cum, aes(x = days, y = cum_emission, colour=soil_type)) +
geom_line(size = 1)+
geom_point()+
scale_colour_manual(values=c("#00AFBB", "brown")) +
scale_size_manual(values=c(8.4, 1.7))+
labs(x = "Time (days)",
y = "Cumulated production (umol/g dw soil)",
title = "Cumulated production") +
labs(shape="", color="") +
facet_wrap(~compound)+
theme_bw()
给这个:
我希望能够在我的绘图中放置误差线或使用 CI 绘制类似于此的绘图:
数据如下所示:
df <- structure(list(days = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94), soil = c(6, 6, 12, 12, 2,
2, 1, 1, 14, 14, 4, 4, 33, 33, 38, 38, 34, 34, 37, 37, 36, 36,
13, 13, 32, 32, 5, 5, 3, 3, 35, 35, 6, 6, 12, 12, 2, 2, 1, 1,
14, 14, 4, 4, 33, 33, 38, 38, 34, 34, 37, 37, 36, 36, 13, 13,
32, 32, 5, 5, 3, 3, 35, 35, 6, 6, 12, 12, 2, 2, 4, 4, 33, 33,
38, 38, 34, 34, 37, 37, 36, 36, 13, 13, 5, 5, 3, 3, 35, 35),
soil_type = c("B", "B", "A", "A", "B", "B", "B", "B", "A",
"A", "B", "B", "B", "B", "B", "B", "A", "A", "B", "B", "A",
"A", "A", "A", "B", "B", "A", "A", "B", "B", "B", "B", "B",
"B", "A", "A", "B", "B", "B", "B", "A", "A", "B", "B", "B",
"B", "B", "B", "A", "A", "B", "B", "A", "A", "A", "A", "B",
"B", "A", "A", "B", "B", "B", "B", "B", "B", "A", "A", "B",
"B", "B", "B", "B", "B", "B", "B", "A", "A", "B", "B", "A",
"A", "A", "A", "A", "A", "B", "B", "B", "B"), compound = c("Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde"), emission = c(0.001,
0.001, 0.009, 0.004, 0.029, 0.032, 0.066, 0.057, 0.015, 0.015,
0, 0.003, 0.015, 0.011, 0.016, 0.005, 0.046, 0.011, 0.004,
0.005, 0.015, 0.003, 0.025, 0.012, 0.001, 0.001, 0.004, 0,
0.012, 0.002, 0.003, 0.002, 0.006, 0, 0.008, 0.001, 0.061,
0.055, 0.076, 0.056, 0.056, 0.074, 0, 0, 0.018, 0.02, 0.015,
0.001, 0.064, 0, 0.012, 0.004, 0.009, 0, 0.399, 0.037, 0.002,
0.001, 0.116, 0, 0.139, 0, 0.004, 0.001, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.001, 0, 0, 0, 0, 0, 0, 0, 0.001, 0.005,
0.001, 0, 0.002, 0)), row.names = c(NA, -90L), class = c("tbl_df",
"tbl", "data.frame"))
new_df <- structure(list(daysincubated4 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 4L, 4L,
4L, 4L, 4L, 4L), soil = c(6L, 6L, 12L, 12L, 2L, 2L, 1L, 1L, 14L,
14L, 4L, 4L, 13L, 13L, 5L, 5L, 3L, 3L, 6L, 6L, 12L, 12L, 2L,
2L, 1L, 1L, 14L, 14L, 4L, 4L, 6L, 6L, 12L, 12L, 2L, 2L, 1L, 1L,
14L, 14L, 4L, 4L, 13L, 13L, 5L, 5L, 3L, 3L, 13L, 13L, 5L, 5L,
3L, 3L), soil_type = c("SOC<10", "SOC<10", "SOC>10", "SOC>10",
"SOC<10", "SOC<10", "SOC<10", "SOC<10", "SOC>10", "SOC>10", "SOC<10",
"SOC<10", "SOC>10", "SOC>10", "SOC>10", "SOC>10", "SOC<10", "SOC<10",
"SOC<10", "SOC<10", "SOC>10", "SOC>10", "SOC<10", "SOC<10", "SOC<10",
"SOC<10", "SOC>10", "SOC>10", "SOC<10", "SOC<10", "SOC<10", "SOC<10",
"SOC>10", "SOC>10", "SOC<10", "SOC<10", "SOC<10", "SOC<10", "SOC>10",
"SOC>10", "SOC<10", "SOC<10", "SOC>10", "SOC>10", "SOC>10", "SOC>10",
"SOC<10", "SOC<10", "SOC>10", "SOC>10", "SOC>10", "SOC>10", "SOC<10",
"SOC<10"), compound = c("Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde",
"Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone",
"Acetaldehyde"), emission = c(0.0011, 0.001, 0.0094, 0.0042,
0.0289, 0.0318, 0.0656, 0.0571, 0.0152, 0.0146, 0, 0.0033, 0.0247,
0.0117, 0.0038, 3e-04, 0.0124, 0.0016, 8e-04, 1e-04, 0.0188,
0.0139, 0.0728, 0.0818, 0.0883, 0.0731, 0.0251, 0.0774, 0, 0,
0.0061, 2e-04, 0.0084, 7e-04, 0.061, 0.0551, 0.0761, 0.0559,
0.0563, 0.0742, 0, 0, 0.3989, 0.0367, 0.1163, 4e-04, 0.1386,
4e-04, 0.0461, 0.0495, 0.089, 0.001, 0.1414, 0.001)), row.names = c(NA,
-54L), class = c("tbl_df", "tbl", "data.frame"))
最佳答案
如果我理解正确,您基本上需要估计不同化合物中土壤类型累积线的置信区间,如果我们查看您的数据:
ggplot(df,aes(x=days,y=cumsum(emission),col=soil_type)) +
geom_line() + facet_grid(compound ~ soil) + theme_bw()
您要做的是估计同一行(复合)中相同颜色的线条之间的误差。为此,我们从您的示例中排除了 1 和 14,因为它不完整。基本上,我们正在尝试将您的所有测量值转换为累积值,按土壤 x 化合物分组。
我们可以使用stat_summary()
来计算均值和se:
df %>% filter(!soil %in% c(1,14)) %>%
group_by(soil,compound) %>%
mutate(c_emission = cumsum(emission)) %>%
ggplot(aes(x = days, y = c_emission, col=soil_type,fill=soil_type)) +
stat_summary(geom="line", fun = mean) +
stat_summary(geom="ribbon",alpha=0.05,linetype="dotted")+
facet_wrap(~compound)
我们在上面绘制的是每个时间点的平均值,+ 1* 标准误差。如果你想要 95% 的置信区间
df %>% filter(!soil %in% c(1,14)) %>%
group_by(soil,compound) %>%
mutate(c_emission = cumsum(emission)) %>%
ggplot(aes(x = days, y = c_emission, col=soil_type,fill=soil_type)) +
stat_summary(geom="line",fun = mean) +
stat_summary(geom="ribbon",alpha=0.05,linetype="dotted",
fun.data = mean_cl_normal)+
facet_wrap(~compound)
置信区间很大,因为您的标准误差很大。当您有更多样本时可能会更好。
关于r - CI 累积值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66801918/
我们都知道ci" ci' ci( ci[ ... 做。在日常编辑中非常方便。我发现了一些奇怪的东西,并查看了帮助,没有找出原因。 说,我有一个文件: foo "target" foo 'target'
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 6年前关闭。 Improve this qu
我的本地 gitlab 安装中有许多存储库。我正在从 Jenkins 迁移到 gitlab 以进行 CI,并且毫无问题地切换了我的第一个 repo。当我添加 .gitlab-ci.yml 时,第二个
我在一个github项目中有几个文件夹,每个文件夹都有一个不同的.travis.yml文件。 设置travis-ci的正确方法是什么,以便我可以指定要构建的文件夹/子项目? 我可以添加before_s
Gitlab 文档说明了以下关于 GIT_STRATEGY: none 的内容: none also re-uses the project workspace, but skips all Git
我想用以下条件配置我的 CI: 当我创建合并请求时 而这个目标分支是 develop 我的工作运行。 我没有找到这个特定工作的文档。 谢谢 最佳答案 在 Gitlab CI 文档中几个小时后,我找到了
我有一个带有子目录 ( test ) 的 gem,其中包含用于测试项目的 Rails 3.1.1 应用程序。我正在尝试设置 Travis-CI 以进行持续集成,但是我不知道如何设置我的 .travis
如何指定:语言:.travis.yml 中的无? 我不指定语言,默认使用 Ruby。 我没有 ruby 。我正在使用 C、C++、Ocaml、Python 和 Felix。 构建脚本只是“制作”。 最
我正在使用 gitlab pages部署作业的输出。我有 3 个不同的工作产生 html输出。一项工作总是在运行。其他 2 个作业是可选的,因此它们是手动运行的。 如何将手 Action 业的输出部署
我在 gitlab.com 上有一个使用 CI 功能的私有(private)存储库。一些 CI 作业会创建存储的工件文件。我刚刚通过将其添加到 CI 配置中实现了一天后自动删除工件: expire_i
假设我为一个项目配置了多个作业,如下所示: build_win32: script: ... build_ios: script: ... unit_tests: script: ...
如何创建跨越多个阶段的 CI 作业以提高并行性? 如下图所示: 这个想法是slow_build应该最早开始build ,但是 test不依赖它,所以 test应该可以尽快启动build已经完成了。 (
我有一个 CI 管道,它可能正在做一些半变态的事情。我们不要争论这部分。 作为 CI 的一部分,我将生成一个工件 ( README.md ),我希望将其提交并推回同一存储库。只需使用 git push
我的项目同时使用nodejs和java 我尝试从 node_js 构建开始,然后安装 java(因为这是一个 npm 模块) 但是安装java的脚本失败了,而且我认为当已经存在java构建时就没有必要
我不想为了运行构建而将每一个小的更改都推送到 .travis.yml 以及对源代码所做的每一个小的更改。使用jenkins,您可以下载jenkins并在本地运行。特拉维斯提供这样的东西吗? Note:
主题。 这是否意味着在免费帐户中我的 api 请求数量有限? 响应部分示例: { "@type": "pending", "remaining_requests": 9, "reposit
有什么办法可以按顺序从舞台运行作业吗?我尝试过使用依赖项来做到这一点 job1: stage:deploy ... job2: stage:deploy dependencies:
我正在努力为多个项目设置 gitlab 运行程序,我们希望能够为所有项目设置环境变量。我尝试在 .bashrc 中为 gitlab-runner 和 root 用户设置全局变量,但在 CI 脚本过程中
Travis 有一种针对不同 PHP 版本测试项目的简单方法。 现在我想为插件运行测试。为此,我编写了一个在 .travis.yml 的安装阶段调用的脚本,它检查主项目并将我的插件源移动到正确的目录中
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 5年前关闭。
我是一名优秀的程序员,十分优秀!