You are here

Regarding Cor2DataFrame Function

5 posts / 0 new
Last post
Aman Asija's picture
Offline
Joined: 03/04/2021 - 15:55
Regarding Cor2DataFrame Function

Dear Professor Cheung,

I am writing to seek your help regarding the Cor2DataFrame function.While converting correlation matrices into a dataframe using the function Cor2DataFrame (a list of 7 X 7 correlation matrices, list of corresponding sample sizes), we are receiving the following error: "Error in if (!is.pd(x.new)) stop("x is not positive definite!\n"): missing value where TRUE/FALSE needed". The error mentions that the matrices in the list are not positive definite. Further, we observed that the function is.pd(Matrix) outputs "NA" rather than TRUE/FALSE.

Please let us know your suggestions on how to overcome this issue.

Thank you for your time and help!

Best regards,
Aman Asija

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear Aman,

Dear Aman,

Please attach the data and R code.

Best,
Mike

Aman Asija's picture
Offline
Joined: 03/04/2021 - 15:55
Sample Data and Code

Dear Professor Cheung,

Please find attached the following files:
(1) Sample data
(2) R code
(3) Screenshots of the data and the error

Knowing your thoughts on the error would be very helpful.

Thank you for your time and help!

Best regards,
Aman Asija

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear Aman,

Dear Aman,

There are errors because there are not enough data for the analysis.

> pattern.na(MatrixList$data, show.na = FALSE)
   V1 V2 V3 V4 V5 V6 V7
V1  5  3  3  1  0  0  1
V2  3  5  0  0  0  0  0
V3  3  0  5  0  0  0  0
V4  1  0  0  5  0  0  0
V5  0  0  0  0  5  0  0
V6  0  0  0  0  0  5  0
V7  1  0  0  0  0  0  5

Best,
Mike

Aman Asija's picture
Offline
Joined: 03/04/2021 - 15:55
Thank you!

Dear Professor Cheung,

Thank you for helping!

Best regards,
Aman Asija