Can you supply us with some sample data?
A handy way to supply some sample data is the dput() function. In the
case of a large dataset something like dput(head(mydata, 100)) should
supply the data we need. Just do dput(mydata) where *mydata* is your data.
Copy the output and paste it here.
On Fri, 8 Sept 2023 at 10:42, PROFESOR MADYA DR NORHAYATI BAHARUN <
norha603 at uitm.edu.my> wrote:
> Hi Sir,
>
> Could you please help me on the following errors:
>
> STEPS TO MIX IRT_RMT APPROACH IN R
>
> ?#1- Load required libraries
> library(eRm)
> library(ltm)
> library(mirt)
> library(psych)
>
> HT <- read.csv("C:/Users/User/Dropbox/Analysis
R_2023/HT2.csv")
> str(HT)
>
> ?#2- Load or create your data matrix
> response_columns <- HT[, 1:ncol(HT)]
> response_matrix <- as.matrix(response_columns)
>
> ?#3- Fit IRT model
> irt_model <- gpcm(response_matrix)
> irt_model
> summary(irt_model)
>
> ?#4- Fit Rasch model
> rasch_model <- PCM(response_matrix)
> rasch_model
> summary(rasch_model)
>
> ?#5- Compare item parameter estimates between IRT and Rasch models
> irt_item_parameters <- coef(irt_model)
> rasch_item_parameters <- coef(rasch_model)
>
> #6- Compare person ability estimates between IRT and Rasch models
> #TRY1
> irt_person_abilities <- fscores(irt_model)
###ERROR###
> #TRY2
> #a(IRT)- Fit your GPCM model using ltm
> irt_model <- gpcm(data = HT, constraint = "1PL")
>
> #a(IRT)- Calculate factor scores (IRT person abilities)
> irt_person_abilities <- factor.scores(irt_model) ###ERROR###
> irt_person_abilities_dim1 <- factor.scores(gpcm_model, f = 1)
>
> #TRY3
> # Fit your GPCM model using mirt
> irt_model <- mirt(data = HT, model = "gpcm", itemtype =
"graded")
> ###ERROR###
>
> # Calculate factor scores for dimension 1 (adjust the dimension as needed)
> irt_person_abilities_dim1 <- fscores(gpcm_model, method =
"EAP", dims = 1)
>
>
> ?#b(RMT)
> rasch_person_abilities <- person.parameter(rasch_model)$theta
>
>
> #7- Perform model comparison using fit statistics (e.g., AIC, BIC)
> irt_aic <- AIC(irt_model)
> rasch_aic <- AIC(rasch_model)
>
> irt_bic <- BIC(irt_model)
> rasch_bic <- BIC(rasch_model)
>
> #8- Print or visualize the results for comparison
> print("Item Parameter Estimates:")
> print(irt_item_parameters)
> print(rasch_item_parameters)
>
> print("Person Ability Estimates:")
> print(irt_person_abilities) ###ERROR###
> print(rasch_person_abilities)
>
> print("Model Fit Statistics:")
> print(paste("IRT AIC:", irt_aic))
> print(paste("Rasch AIC:", rasch_aic))
>
> print(paste("IRT BIC:", irt_bic))
> print(paste("Rasch BIC:", rasch_bic))
>
> Hope to get your response.
>
> Many thanks.
>
> Regards,
>
> Norhayati
>
> --
>
>
>
>
> *PENAFIAN: *E-mel ini dan apa-apa fail yang dihantar
> bersama-samanya
> ("Mesej") adalah dihasratkan hanya untuk kegunaan
> penerima yang dinyatakan
> di atas dan mungkin mengandungi maklumat yang tidak
> umum, bermilik,
> istimewa, sulit dan dikecualikan dari penzahiran di bawah
> undang-undang
> yang terpakai termasuklah Akta Rahsia Rasmi 1972. *BACA SELANJUTNYA...*
>
<https://mail.uitm.edu.my/index.php?option=com_content&view=article&id=83>*DISCLAIMER
>
> :** This e-mail and any files transmitted with it
> ("Message") is intended
> only for the use of the recipient(s) named
> above and may contain
> information that is non-public, proprietary,
> privileged, confidential
> and
> exempt from disclosure under applicable law including the
> Official
> Secrets Act 1972. **READ MORE...*
>
<https://mail.uitm.edu.my/index.php?option=com_content&view=article&id=83>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
John Kane
Kingston ON Canada
[[alternative HTML version deleted]]