存活曲线
2020-10-16
2020-10-16
物种生存分析
1 河口数据描述
## # A tibble: 4 x 5
## 长度 类型A 类型B 类型C 类型D
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 在0到24mm 0.494 0.419 0.667 0.737
## 2 在25到37mm 0.210 0.237 0.159 0.118
## 3 在38到50mm 0.197 0.193 0.113 0.0864
## 4 在5mm以上 0.0994 0.151 0.0608 0.0589
A- D分别代表着四个采样的河口地点,大地点的下属是不同的城市名称(比如:Boston波士顿),在波士顿有178个采样点,其中0-24mm的个体占比49.21%。Subtotal代表在这一个河口的占比,Total代表在所有的四个河口的总占比。 # 河口显著差异
layout(matrix(c(1,2),1,2,byrow = TRUE))#layout函数用于组合输出图,matrix是矩阵,widths和heights分别代表各列宽度和高度。(图形分栏)
str(data)
## Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 5 variables:
## $ 长度 : chr "在0到24mm" "在25到37mm" "在38到50mm" "在5mm以上"
## $ 类型A: num 0.4937 0.2098 0.1971 0.0994
## $ 类型B: num 0.419 0.237 0.193 0.151
## $ 类型C: num 0.6674 0.1593 0.1126 0.0608
## $ 类型D: num 0.7367 0.118 0.0864 0.0589
a=barplot(data$类型A*100,yaxt="n",xlab="Size class",ylab="%",col=c(1,2,3,4),ylim=c(0,100))#绘制条形图
m=seq(from = 0, to = 100, by=10)
axis(2,m)
text(c(2,96),c("A"))
legend("topright", bty="n",inset=0.01,c(" 0-24 mm ", " 25-37 mm "," 38-50 mm ", ">50 mm "),col=c(1,2,3,4), lty = c(2, 4))
barplot(data$类型B*100,yaxt="n",xlab="Size class",ylab="%",ylim=c(0,100),col=c(1,2,3,4),mgp=c(3,2,1))
m=seq(from = 0, to = 102, by=10)
axis(2,m)
text(c(2,96),c("B"))
legend("topright", bty="n",inset=0.01,c(" 0-24 mm ", " 25-37 mm "," 38-50 mm ", ">50 mm "),col=c(1,2,3,4), lty = c(2, 4))
上图为2个河口的大小分布直方图,A和B表示两个采样点的分布情况。A-D分别代表着四个采样的河口地点,T表示整体情况,如下所示:
layout(matrix(c(1,2),1,2,byrow = TRUE))#layout函数用于组合输出图,matrix是矩阵,widths和heights分别代表各列宽度和高度。(图形分栏)
barplot(data$类型C*100,yaxt="n",xlab="Size class",ylab="%",ylim=c(0,100),col=c(1,2,3,4))#绘制条形图
m=seq(from = 0, to = 100, by=10)
axis(2,m)
text(c(2,96),c("C"))
legend("topright", bty="n",inset=0.01,c(" 0-24 mm ", " 25-37 mm "," 38-50 mm ", ">50 mm "),col=c(1,2,3,4), lty = c(2, 4))
barplot(data$类型D*100,yaxt="n",xlab="Size class",ylab="%",ylim=c(0,100),col=c(1,2,3,4), bty="o")
m=seq(from = 0, to = 100, by=10)
axis(2,m)
text(c(2,96),c("D"))
legend("topright", bty="n",inset=0.01,c(" 0-24 mm ", " 25-37 mm "," 38-50 mm ", ">50 mm "),col=c(1,2,3,4), lty = c(2, 4))
整体比较A到D的存活情况,A的存活情况最好,D的存活情况最差,说明河口类型A最适宜物种存活,河口类型D对物种存活存在一定的限制性。
2 河口存活趋势
A-D分别代表着四个采样的河口地点,大地点的下属是不同的城市名称(比如:Boston波士顿),在波士顿有178个采样点,其中0-24mm的个体占比49.21%。Subtotal代表在这一个河口的占比,Total代表在所有的四个河口的总占比。
## Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 6 variables:
## $ 长度: num 0 10 45 80
## $ A : num 100 50 11 0
## $ B : num 100 58 16 0
## $ C : num 100 32 8 0
## $ D : num 100 28 8 0
## $ T : num 100 42 11 0
## # A tibble: 4 x 6
## 长度 A B C D T
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 100 100 100 100 100
## 2 10 50 58 32 28 42
## 3 45 11 16 8 8 11
## 4 80 0 0 0 0 0
plot(data$长度,data$A,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1)
par(new=TRUE)
plot(data$长度,data$A,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=6)
text(12, 52, "A")
par(new=TRUE)
plot(data$长度,data$B,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=10)
text(12, 60, "B")
par(new=TRUE)
plot(data$长度,data$C,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=14)
text(12, 34, "C")
par(new=TRUE)
plot(data$长度,data$D,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=18)
text(12, 24, "D")
par(new=TRUE)
plot(data$长度,data$T,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=22)
text(12, 42, "T")
上述四个直方图转变为折线图放在一个plot里 A-D分别代表着四个采样的河口地点,T是Total(总共的)
data=read_excel("C:\\Users\\Lenovo\\Desktop\\data\\存活曲线.xlsx",sheet="图2")##导入csv数据
data1 <- subset(data,长度<50)
data2 <- subset(data,长度>40)
plot(data1$长度,data1$A,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,80),ylim=c(0,100))
par(new=TRUE)
plot(data2$长度,data2$A,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,80),ylim=c(0,100))
text(12, 52, "A")
par(new=TRUE)
plot(data1$长度,data1$B,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,80),ylim=c(0,100))
text(12, 60, "B")
par(new=TRUE)
plot(data2$长度,data2$B,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,80),ylim=c(0,100))
par(new=TRUE)
plot(data1$长度,data1$C,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,80),ylim=c(0,100))
text(12, 34, "C")
par(new=TRUE)
plot(data2$长度,data2$C,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,80),ylim=c(0,100))
par(new=TRUE)
plot(data1$长度,data1$D,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,80),ylim=c(0,100))
par(new=TRUE)
plot(data2$长度,data2$D,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,80),ylim=c(0,100))
text(12, 24, "D")
par(new=TRUE)
plot(data1$长度,data1$T,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,80),ylim=c(0,100))
par(new=TRUE)
plot(data2$长度,data2$T,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,80),ylim=c(0,100))
text(12, 42, "T")
和上图意义一样,不过变为了半对数坐标,横坐标不变,纵坐标与原点的实际距离为该点对应数的对数值。
x=c(0,0.1,1.5,3,4.2,7.1)
y=c(6,2.5,2,1.8,1.5,0.5)
z=data.frame(x,y)
data1 <- subset(z,x<5)
data2 <- subset(z,x>4)
plot(data1$x,data1$y,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,9),ylim=c(0,9))
par(new=TRUE)
plot(data2$x,data2$y,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,9),ylim=c(0,9))
生物界中,很少的卵母细胞能成为幼年群体的一部分。Brousseau(1978)估计马萨诸塞州Jones River的Mya arenaria(文中所采的双壳类)的实际平均成功率在0.001%到0.0001%之间,幼虫死亡率很高。如果250万幼年到成年个体(在本研究中统计)除以0.001%,则假设有2.5×1011个卵母细胞。这个数字的对数图,结合图中来看,产生一个广义大小-存活曲线,如上所示。
x=c(0,2,3,4,5)
y=c(1,4,8,16,32)
z=data.frame(x,y)
data1 <- subset(z,x<4)
data2 <- subset(z,x>2)
plot(data1$x,data1$y,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=1,lwd=2,xlim=c(0,5),ylim=c(0,20))
par(new=TRUE)
plot(data2$x,data2$y,type="b",ylab="Precent surviviing",xlab="Length (mm)",lty=4,xlim=c(0,5),ylim=c(0,20))
为了对年龄和存活进行分析,对数据进行了相应计算和转换,如下表所示:
不同的大小对应的年龄的曲线,如下所示。
x=c(0,0.1,1.5,3,4.2,7.1)
y=c(6,2.5,2,1.8,1.5,0.5)
z=data.frame(x,y)
data1 <- subset(z,x<5)
data2 <- subset(z,x>4)
plot(data1$x,data1$y,type="b",ylab="Precent surviviing",xlab="Age (year)",lty=1,lwd=2,xlim=c(0,9),ylim=c(0,9))
par(new=TRUE)
plot(data2$x,data2$y,type="b",ylab="Precent surviviing",xlab="Age (year)",lty=4,xlim=c(0,9),ylim=c(0,9))
最后这个图就是把年龄和对应的存活数量作曲线,以之前年龄和长度、存活数量和长度的曲线为中介,得到该曲线。
3 本章汇总
参数 | 类型 | 功能 |
---|---|---|
readxl | 包 | 读取excel |
layout | 包 | 图形分栏 |
text | 函数 | 添加坐标点 |
barplot | 函数 | 绘制柱状图 |