Little's MCAR Test in R BaylorEdPsych package does not work

社会主义新天地 提交于 2019-12-24 17:44:06

问题


Okay so here's the deal. I have to use the BaylorEdPsych package in R to test whether the dataset that I have is MCAR or not.

I ran the LittleMCAR function in it with the sample dataset (EndersTable1_1) and it worked flawlessly.

When I try to run the dataset that I have into the function I get this error:

Error in eigen(sampmat, symmetric = TRUE) : 
    infinite or missing values in 'x'

I don't understand why this would throw an error when my dataset conforms to the structure of the sample data.

My dataset by the way is a time series that details climate variables for the year 2000 with daily resolution. Here's my dataset for anyone who wants to reproduce this problem. https://drive.google.com/open?id=0B8hGFkkZ5DlfZFl4MGxXY1Y2dlE

My code is below:

install.packages("BaylorEdPsych")
install.packages("mvnmle")

library(BaylorEdPsych)
library(mvnmle)

#<update>
data(EndersTable1_1) #retrieve the enders dataset
view(EndersTable1_1) #view the dataset on R's data viewer
LittleMCAR(EndersTable1_1)
#</update>

LittleMCAR(year_2000) #this is what I named the imported dataset

What am I doing wrong? Thanks to anyone who replies.


回答1:


After taking out the blocks of rows that were all NA and the column that was all NA, this succeeds:

LittleMCAR(year_2000[ !apply(year_2000, 1, function(x) all(is.na(x))), -10])


来源:https://stackoverflow.com/questions/43954856/littles-mcar-test-in-r-bayloredpsych-package-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!