0

I'm in the middle of doing some research and using R Studio (version 3.6.1) platform to analyze the data gathered. The data comprises of continuous item responses ranging from 0 to 100. Because the nature of the data is continuous responses, I have to use CRM in R to perform the Item Response Theory (IRT) analysis. So I decided to use the EstCRM package (version 1.4) created by Cengiz Zpopluoglu.

Below is an example of the data I use. In this example the data set consists of 3 variables or items that I used, it is named PA1 through PA3. Also, I've set that there's 5 participants involved. The actual data set consists of 100+ items and 100+ participants.

> str(Data_ManDown) Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   5 obs. of  3 variables:
$ PA1: num  100 75 20 49 90
$ PA2: num  100 75 80 100 80
$ PA3: num  0 30 40 100 80

The data which I named "Data_ManDown" is to be run in this EstCRM package, particularly EstCRMitem.

CRM <- EstCRMitem(Data_ManDown[,1:3], 
                  max.item=c(100,100,100), 
                  min.item=c(0,0,0),
                  max.EMCycle=500, 
                  converge=.01,
                  type="Wang&Zeng",
                  BFGS=TRUE)

CRM$param

The problem I encountered starts when running the EstCRMitem command. The console shows this notification.

The column vectors are not numeric. Please check your data

When I checked the data, it seems that the data that I uploaded from excel is considered as a list.

> class(Data_ManDown)
[1] "tbl_df"     "tbl"        "data.frame"
> typeof(Data_ManDown)
[1] "list"
> is.numeric(Data_ManDown)
[1] FALSE

Then I decided to coerce my data into numeric by using as.numeric and put it back into the data frame so it can be run in the EstCRMitem command. I found that not also the data have to be numeric, but also data frame.

> iPA1 <- as.numeric(Data_ManDown[[1]])
> iPA2 <- as.numeric(Data_ManDown[[2]])
> iPA3 <- as.numeric(Data_ManDown[[3]])
> 
> is.numeric(iPA1)
[1] TRUE
> is.numeric(iPA2)
[1] TRUE
> is.numeric(iPA3)
[1] TRUE
> ManDown_Num <- as.data.frame(cbind(PA1 = iPA1, PA2 = iPA2, PA3 = iPA3))
> 
> is.numeric(ManDown_Num)
[1] FALSE
> class(ManDown_Num)
[1] "data.frame"
> typeof(ManDown_Num)
[1] "list"

Unfortunately, the data came back as a list when I combined it back as one data frame that consists of 3 said variables. So the EstCRMitem failed to run. Alternatively, I have also tried a few other ways such as using unlist or put iPA1 through iPA3 as a separate data.frame. It worked but considerably not effective because I have to analyze it one by one per variable. Considering the large number of data taken, this method is preferably the last resort.

All in all, the main question would be, is there (or possibly) an alternate method that can put these kinds of data to be a data.frame consisting many elements (many rows of the participant and many columns of items) and also valued as numeric at the same time? In order to be analyzed in the EstCRMitem command.

On a side note, I also have looked for references in other questions that may be similar and might help such as:

Although I find that in this case may be a bit different, so there's no apparent solution yet. Also thank you for taking the time to look into this question and for the help.

Abolfazl Panbehkar
  • 700
  • 2
  • 7
  • 21
  • 1
    You should check the `class` (not `typeof`) to check the class of data. Your data is correct and as expected as shown from `str` of the data. Try restarting R and see if the error goes away. – Ronak Shah Sep 21 '20 at 05:48
  • yes, I have checked that too as posted in the question. by using class and it showed that ManDown_Num that will be analysed is a data.frame. Unfortunately the error is still there. – Adji Pradana Sep 21 '20 at 09:35

0 Answers0