library(psych)
library(ltm)
## Loading required package: MASS
## Loading required package: msm
## Loading required package: polycor
## 
## Attaching package: 'polycor'
## The following object is masked from 'package:psych':
## 
##     polyserial
## 
## Attaching package: 'ltm'
## The following object is masked from 'package:psych':
## 
##     factor.scores
library(knitr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
## 
##     select
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
data<-read.csv("/home/heru/Desktop/Mybfi.csv", header=TRUE, sep=",")
bfidata<-data[2:6]
bfidata2<-na.omit(bfidata)



#Global item
fit1 <- grm(bfidata2, constrained = TRUE)

fit2 <- grm(bfidata2, constrained = FALSE)


#Uji model unconstrained vs constrained)
anova(fit1,fit2)
## 
##  Likelihood Ratio Table
##           AIC      BIC   log.Lik     LRT df p.value
## fit1 40608.97 40768.39 -20277.49                   
## fit2 38783.65 38966.69 -19360.83 1833.32  4  <0.001
thetagrm<-factor.scores.grm(fit2, resp.patterns = bfidata2)
bfidata2$score <- rowSums(bfidata2[,1:5])
theta2<-thetagrm$score.dat$z1
mydf1 <- data.frame(bfidata2, theta = theta2)
options(digits = 3)

knitr::kable(subset(mydf1,bfidata2$score == 25), caption = 'There are several different patterns all with a score of 25')
There are several different patterns all with a score of 25
A1 A2 A3 A4 A5 score theta
2354 5 5 5 5 5 25 -0.040
2355 5 5 5 5 5 25 -0.040
2356 5 5 5 5 5 25 -0.040
2357 5 5 5 5 5 25 -0.040
2358 5 5 5 5 5 25 -0.040
2359 5 5 5 5 5 25 -0.040
2360 5 5 5 5 5 25 -0.040
2361 5 5 5 5 5 25 -0.040
2362 5 5 5 5 5 25 -0.040
2363 5 5 5 5 5 25 -0.040
2364 5 5 5 5 5 25 -0.040
2365 5 5 5 5 5 25 -0.040
2366 5 5 5 5 5 25 -0.040
2367 5 5 5 5 5 25 -0.040
2368 5 5 5 5 5 25 -0.040
2369 5 5 5 5 5 25 -0.040
2370 5 5 5 5 5 25 -0.040
2371 5 5 5 5 5 25 -0.040
2372 5 5 5 5 5 25 -0.040
2373 5 5 5 5 5 25 -0.040
2374 5 5 5 5 5 25 -0.040
2375 5 5 5 5 5 25 -0.040
2376 5 5 5 5 5 25 -0.040
2377 5 5 5 5 5 25 -0.040
2378 5 5 5 5 5 25 -0.040
2379 5 5 5 5 5 25 -0.040
2393 1 6 6 6 6 25 -1.583
2394 5 6 5 4 5 25 -0.215
2395 1 6 6 6 6 25 -1.583
2396 6 1 6 6 6 25 -0.687
2397 1 6 6 6 6 25 -1.583
2398 1 6 6 6 6 25 -1.583
2399 5 5 5 5 5 25 -0.040
2400 3 6 5 6 5 25 -0.495
2401 1 6 6 6 6 25 -1.583
2402 1 6 6 6 6 25 -1.583
2403 4 5 5 6 5 25 -0.188