0

これはやや漠然とした質問である危険を冒して、私は先に進み、とにかくそれを尋ねます:

R で 2 つの結果変数を使用して多変量回帰を実行しており、共分散行列の均一性を評価したいと考えていますが、残念ながら、カルバック テストでエラーがスローされます。

Error in cov(Y[X == lev.X[k], ]) : 
  supply both 'x' and 'y' or a matrix-like 'x'

現在、x と y は両方とも行列であるため、何をすべきか本当にわかりません。どんな種類の入力も歓迎します。

library(psych)

y <- cbind(health_demo.z$years.of.life.lost.to.communicable.diseases......2002, health_demo.z$years.of.life.lost.to.non.communicable.diseases......2002)
x <- as.matrix(health_demo.z$population.in.urban.areas....)
Kullback(y, x) 

head(x)
           [,1]
[1,] -0.6723010
[2,]  1.4475329
[3,]  1.3543534
[4,]  0.3526736
[5,] -1.6040962
[6,]  0.6089173

head(y)
       [,1]       [,2]
[1,] -0.5076484  0.3191182
[2,] -0.4722119  0.4345915
[3,] -0.9328864  0.8579938
[4,] -1.0037594  1.0889405
[5,]  1.0161210 -1.0280708
[6,] -0.8620134  0.5115738

問題の説明に役立つことを願っています。

4

0 に答える 0