How to export this output

I am using sirt package , my code is as following

data.read=read.csv(".../testlet.csv")

estimate the Rasch model

mod <- sirt::rasch.mml2(data.read)

estmate WLE

mod.wle <- sirt::wle.rasch( dat=data.read, b=mod$item$b )

Yen's Q3 statistic

mod.q3 <- sirt::Q3( dat=data.read, theta=mod.wle$theta, b=mod$item$b )

write output

write.csv(mod.q3,".../Q3 statistics for all item pairs.csv")

However, when I tried export "mod.q3" using write.csv, the error are the following.

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : **
** arguments imply differing number of rows: 40, 780, 81, 9

Please help how to correctly export output "mod.q3".

Thanks a lot!

write.csv allows to export dataframes as far as I know.
Whereas mod.q3 is a list. Which part of mod.q3 do you want to write in a CSV file ? The Q3 matrix ?
Type mod.q3$, then Rstudio will suggest which element of this list to select

mod.q3$q3.matrix
mod.q3$q3.long
mod.q3$expected
mod.q3$residual
mod.q3$Q3.stat

If you want to save the whole mod.q3 object use this code :

# Save mod.q3
saveRDS(mod.q3,".../Q3 statistics for all item pairs.rds")

# You can read the file
readRDS(".../Q3 statistics for all item pairs.rds")

@julienn
Thanks so much for the help!!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.