Skip to main content
deleted 11 characters in body
Source Link
Alexis
  • 30.7k
  • 8
  • 101
  • 176

I am learning to apply constrained ordination to community data using the veganvegan package in R. According to some materials, like this one, in a scaling type 2 RDA triplot:

Angles between all vectors reflect linear correlation.

It confuses me how the triplot would look like if all explanatory variables are uncorrelated. I tested in R by creating a matrix consists of 5 vectors with very low(0.001)correlations (code copied from the second answer) as explanatory variables, and two artificial response variables like below :

set.seed(42)
require(vegan)

# generate uncorrleated variables
n <- 5

R <- matrix(.001, nrow = n, ncol = n)
diag(R) <- 1

# Cholesky decompostion of correlation matrix
Lut <- chol(R)
L <- t(Lut)

# Standard deviations
sds <- seq(10, 1, length.out = n)

# VCOV matrix
Sigma <- diag(sds) %*% L %*% Lut %*% diag(sds)

# Generate variables
library(MASS)
X <- mvrnorm(50, mu= rep(0, n), Sigma, empirical = TRUE)
cor(X)

#generate response variables
b1=c(0.2,0.3,0.5,0.3,0.4)
b2=c(0.5,-0.3,-0.2,0.7,0.8)
y1=b1%*%t(X)+rnorm(10,sd=0.01)
y2=b2%*%t(X)+rnorm(10,sd=0.01)

#do RDA
y=cbind(as.vector(y1),as.vector(y2))
X=as.data.frame(X)
rd=vegan::rda(Y=X,X=y)
plot(rd,scaling=2)

And it generates plot like this, with V1V1,V4 V4 and V5V5 very close to each other though they have low correlations.

The plotThe plot

So my question is what is wrong with my understanding and how should I interpret angles between explanatory vectors in a RDA triplot?

Thanks in advance.

I am learning to apply constrained ordination to community data using the vegan package in R. According to some materials, like this one, in a scaling type 2 RDA triplot:

Angles between all vectors reflect linear correlation.

It confuses me how the triplot would look like if all explanatory variables are uncorrelated. I tested in R by creating a matrix consists of 5 vectors with very low(0.001)correlations (code copied from the second answer) as explanatory variables, and two artificial response variables like below :

set.seed(42)
require(vegan)

# generate uncorrleated variables
n <- 5

R <- matrix(.001, nrow = n, ncol = n)
diag(R) <- 1

# Cholesky decompostion of correlation matrix
Lut <- chol(R)
L <- t(Lut)

# Standard deviations
sds <- seq(10, 1, length.out = n)

# VCOV matrix
Sigma <- diag(sds) %*% L %*% Lut %*% diag(sds)

# Generate variables
library(MASS)
X <- mvrnorm(50, mu= rep(0, n), Sigma, empirical = TRUE)
cor(X)

#generate response variables
b1=c(0.2,0.3,0.5,0.3,0.4)
b2=c(0.5,-0.3,-0.2,0.7,0.8)
y1=b1%*%t(X)+rnorm(10,sd=0.01)
y2=b2%*%t(X)+rnorm(10,sd=0.01)

#do RDA
y=cbind(as.vector(y1),as.vector(y2))
X=as.data.frame(X)
rd=vegan::rda(Y=X,X=y)
plot(rd,scaling=2)

And it generates plot like this, with V1,V4 and V5 very close to each other though they have low correlations.

The plot

So my question is what is wrong with my understanding and how should I interpret angles between explanatory vectors in a RDA triplot?

Thanks in advance.

I am learning to apply constrained ordination to community data using the vegan package in R. According to some materials, like this one, in a scaling type 2 RDA triplot:

Angles between all vectors reflect linear correlation.

It confuses me how the triplot would look like if all explanatory variables are uncorrelated. I tested in R by creating a matrix consists of 5 vectors with very low(0.001)correlations (code copied from the second answer) as explanatory variables, and two artificial response variables like below :

set.seed(42)
require(vegan)

# generate uncorrleated variables
n <- 5

R <- matrix(.001, nrow = n, ncol = n)
diag(R) <- 1

# Cholesky decompostion of correlation matrix
Lut <- chol(R)
L <- t(Lut)

# Standard deviations
sds <- seq(10, 1, length.out = n)

# VCOV matrix
Sigma <- diag(sds) %*% L %*% Lut %*% diag(sds)

# Generate variables
library(MASS)
X <- mvrnorm(50, mu= rep(0, n), Sigma, empirical = TRUE)
cor(X)

#generate response variables
b1=c(0.2,0.3,0.5,0.3,0.4)
b2=c(0.5,-0.3,-0.2,0.7,0.8)
y1=b1%*%t(X)+rnorm(10,sd=0.01)
y2=b2%*%t(X)+rnorm(10,sd=0.01)

#do RDA
y=cbind(as.vector(y1),as.vector(y2))
X=as.data.frame(X)
rd=vegan::rda(Y=X,X=y)
plot(rd,scaling=2)

And it generates plot like this, with V1, V4 and V5 very close to each other though they have low correlations.

The plot

So my question is what is wrong with my understanding and how should I interpret angles between explanatory vectors in a RDA triplot?

added 33 characters in body
Source Link

I am learning to apply constrained ordination to community data using the vegan package in R. According to some materials, like this one, in a scaling type 2 RDA triplot:

Angles between all vectors reflect linear correlation.

It confuses me how the triplot would look like if all explanatory variables are uncorrelated. I tested in R by creating a matrix consists of 5 vectors with very low(0.001)correlations (code copied from the second answer) as explanatory variables using code, and two artificial response variables like below :

set.seed(42)
require(vegan)

# generate uncorrleated variables
n <- 5

R <- matrix(.001, nrow = n, ncol = n)
diag(R) <- 1

# Cholesky decompostion of correlation matrix
Lut <- chol(R)
L <- t(Lut)

# Standard deviations
sds <- seq(10, 1, length.out = n)

# VCOV matrix
Sigma <- diag(sds) %*% L %*% Lut %*% diag(sds)

# Generate variables
library(MASS)
X <- mvrnorm(50, mu= rep(0, n), Sigma, empirical = TRUE)
cor(X)

#generate response variables
b1=c(0.2,0.3,0.5,0.3,0.4)
b2=c(0.5,-0.3,-0.2,0.7,0.8)
y1=b1%*%t(X)+rnorm(10,sd=0.01)
y2=b2%*%t(X)+rnorm(10,sd=0.01)

#do RDA
y=cbind(as.vector(y1),as.vector(y2))
X=as.data.frame(X)
rd=vegan::rda(Y=X,X=y)
plot(rd,scaling=2)

And it generates plot like this, with V1,V4 and V5 very close to each other though they have low correlations.

The plot

So my question is what is wrong with my understanding and how should I interpret angles between explanatory vectors in a RDA triplot?

Thanks in advance.

I am learning to apply constrained ordination to community data using the vegan package in R. According to some materials, like this one, in a scaling type 2 RDA triplot:

Angles between all vectors reflect linear correlation.

It confuses me how the triplot would look like if all explanatory variables are uncorrelated. I tested in R by creating a matrix consists of 5 vectors with very low(0.001)correlations (code copied from the second answer) as explanatory variables using code below :

set.seed(42)
require(vegan)

# generate uncorrleated variables
n <- 5

R <- matrix(.001, nrow = n, ncol = n)
diag(R) <- 1

# Cholesky decompostion of correlation matrix
Lut <- chol(R)
L <- t(Lut)

# Standard deviations
sds <- seq(10, 1, length.out = n)

# VCOV matrix
Sigma <- diag(sds) %*% L %*% Lut %*% diag(sds)

# Generate variables
library(MASS)
X <- mvrnorm(50, mu= rep(0, n), Sigma, empirical = TRUE)
cor(X)

#generate response variables
b1=c(0.2,0.3,0.5,0.3,0.4)
b2=c(0.5,-0.3,-0.2,0.7,0.8)
y1=b1%*%t(X)+rnorm(10,sd=0.01)
y2=b2%*%t(X)+rnorm(10,sd=0.01)

#do RDA
y=cbind(as.vector(y1),as.vector(y2))
X=as.data.frame(X)
rd=vegan::rda(Y=X,X=y)
plot(rd,scaling=2)

And it generates plot like this, with V1,V4 and V5 very close to each other though they have low correlations.

The plot

So my question is what is wrong with my understanding and how should I interpret angles between explanatory vectors in a RDA triplot?

Thanks in advance.

I am learning to apply constrained ordination to community data using the vegan package in R. According to some materials, like this one, in a scaling type 2 RDA triplot:

Angles between all vectors reflect linear correlation.

It confuses me how the triplot would look like if all explanatory variables are uncorrelated. I tested in R by creating a matrix consists of 5 vectors with very low(0.001)correlations (code copied from the second answer) as explanatory variables, and two artificial response variables like below :

set.seed(42)
require(vegan)

# generate uncorrleated variables
n <- 5

R <- matrix(.001, nrow = n, ncol = n)
diag(R) <- 1

# Cholesky decompostion of correlation matrix
Lut <- chol(R)
L <- t(Lut)

# Standard deviations
sds <- seq(10, 1, length.out = n)

# VCOV matrix
Sigma <- diag(sds) %*% L %*% Lut %*% diag(sds)

# Generate variables
library(MASS)
X <- mvrnorm(50, mu= rep(0, n), Sigma, empirical = TRUE)
cor(X)

#generate response variables
b1=c(0.2,0.3,0.5,0.3,0.4)
b2=c(0.5,-0.3,-0.2,0.7,0.8)
y1=b1%*%t(X)+rnorm(10,sd=0.01)
y2=b2%*%t(X)+rnorm(10,sd=0.01)

#do RDA
y=cbind(as.vector(y1),as.vector(y2))
X=as.data.frame(X)
rd=vegan::rda(Y=X,X=y)
plot(rd,scaling=2)

And it generates plot like this, with V1,V4 and V5 very close to each other though they have low correlations.

The plot

So my question is what is wrong with my understanding and how should I interpret angles between explanatory vectors in a RDA triplot?

Thanks in advance.

edited tags
Link
Post Migrated Here from stackoverflow.com (revisions)
Source Link
Loading