【问题标题】:How can I employ cluster analysis in R to identify vegetation communities given only presence-absence data?如何在 R 中使用聚类分析来识别仅给定存在-不存在数据的植被群落?
【发布时间】:2021-08-26 17:28:16
【问题描述】:

我正在尝试使用基于样方的植被调查的结果来确定大片土地上离散的草本植物群落。然而,除了给定样方中物种的简单存在或不存在外,没有记录任何数据。在这种情况下,有什么方法可以使用 TRUE/FALSE 值来代替物种丰度或潜在相关环境变量的任何定量数据?我的目标是生成一个图形,将样方显示为点,并以图形方式识别具有相似植被组合的样方集群。

到目前为止,我可以编辑这篇文章以包含我的代码,但我选择暂时不包含它,因为我不知道我的整个方法是否存在缺陷。

数据目前以 .csv 格式存储,其中列是物种,行是单个样方,单元格显示 TRUE(在样方中存在)或 FALSE(在样方中不存在)。

【问题讨论】:

  • 发布你所拥有的,这样更容易确定你是否在写轨道上

标签: r cluster-analysis


【解决方案1】:

我使用 stats::kmeans 开发了一个模拟示例

library(ggplot2)
set.seed(1235)

# Example TRUE/FALSE quadrat data:
quads = matrix(runif(400) > 0.7, nrow = 20)

# convert this to x, y data of TRUE quadrats:
xy = data.frame(which(quads, arr.ind = T))
names(xy) = c('X', 'Y')

# Number of clusters - to be determined by the data/model:
n_clusters = 5
km = kmeans(xy, n_clusters)
centers = data.frame(km$centers)

# add this to the quadrat data:
xy = cbind(xy, cluster=km$cluster)
 
# Plot
ggplot(data=xy) + 
  geom_point(aes(X,Y, col=as.factor(cluster)), size=2) + 
  geom_point(data=centers, aes(X, Y, col=as.factor(row.names(centers))),
             size = 5, shape=13, stroke=3)

有用吗?

【讨论】:

  • 谢谢!很抱歉回复慢 - 我在研究生院的早期阶段,这个学期就像一吨砖一样。我去看看再回信。
猜你喜欢
  • 2018-07-06
  • 2015-10-22
  • 2018-08-06
  • 2018-07-05
  • 2016-03-10
  • 1970-01-01
  • 1970-01-01
  • 2019-05-13
相关资源
最近更新 更多