R BaylorEdPsych软件包中的Little's MCAR测试不起作用 [英] Little's MCAR Test in R BaylorEdPsych package does not work
问题描述
好的,这是交易.我必须在R中使用BaylorEdPsych包来测试我拥有的数据集是否为MCAR.
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.
我使用示例数据集(EndersTable1_1)运行了LittleMCAR函数,它运行正常.
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.
顺便说一句,我的数据集是一个时间序列,详细列出了2000年的气候变量和每日分辨率. 这是我的数据集,适合任何想重现此问题的人. https://drive.google.com/open?id=0B8hGFkkZ5DlfZFl4MGxXY1Y2dlE
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
我的代码如下:
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.
推荐答案
取出全部为NA的行和全部为NA的列的块之后,此操作成功完成:
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])
这篇关于R BaylorEdPsych软件包中的Little's MCAR测试不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!