Generate covariance matrix from correlation matrix

前端 未结 4 1582
孤独总比滥情好
孤独总比滥情好 2021-02-05 20:36

I have a correlation matrix:

a <- matrix(c(1, .8, .8, .8, 1, .8, .8, .8, 1), 3)

##      [,1] [,2] [,3]
## [1,]  1.0  0.8  0.8
## [2,]  0.8  1.0  0.8
## [3,]          


        
4条回答
  •  误落风尘
    2021-02-05 21:12

    require(MBESS)
    a <- matrix(c(1,.8,.8,.8,1,.8,.8,.8,1),3)
    > cor2cov(a,c(3,10,3))
        [,1] [,2] [,3]
    [1,]  9.0   24  7.2
    [2,] 24.0  100 24.0
    [3,]  7.2   24  9.0
    

提交回复
热议问题