首页 > 解决方案 > 将 R 中每个分量的方差加倍

问题描述

当我“将每个组件的方差加倍”时,我试图查看我的散点图如何变化。我知道如何找到我的样本的方差,但我对如何将它们加倍感到困惑。

library(MASS)
library(ggplot2)

x<-mvrnorm(n=100, mu=c(0,0),Sigma=diag(2)) # 100 samples from a 2D normal variable with identity covariance matrix
print(x)
colnames(x)<-c('x1','x2')
x<-data.frame(x)
ggplot(x,aes(x=x1,y=x2))+geom_point()

通常我会取 2 个变量,找出每个变量的方差,计算协方差,然后在上面的等式中使用它,但我认为这种方法是错误的。

标签: rrandomcovariancevariance

解决方案


推荐阅读