jerry2605
jerry2605

Reputation: 457

non-conformable arrays in matrix multiply R

> dim(ginv(cov_mat_month))
[1] 495 495
> class(mu_hat_month)
[1] "matrix"
> class(cov_mat_month)
[1] "matrix"
> dim(mu_hat_month)
[1] 495   1
> c = ginv(cov_mat_month) * mu_hat_month

Error in ginv(cov_mat_month) * mu_hat_month : non-conformable arrays

Matrix(495*495) * Matrix(495*1), why there always has error "non-conformable arrays"? Totally confused.

Upvotes: 1

Views: 10265

Answers (1)

caped114
caped114

Reputation: 745

Use this

c = ginv(cov_mat_month) %*% mu_hat_month

instead of this

c = ginv(cov_mat_month) * mu_hat_month

hope this solves your problem.

Upvotes: 4

Related Questions