getAllItems | R Documentation |
Retrieves the IRT item variable names associated with construct names for use with mml.sdf
function.
getAllItems(sdf, construct = NULL)
sdf |
an |
construct |
a character value (or vector) for which to return the associated item variable names. Default value is |
a character vector of the items names associated for the values in construct
.
if construct
is a vector, all item names will be returned for those constructs. Use getAllItems
with getData
when creating a light.edsurvey.data.frame
, see example for use.
Tom Fink, Sun-Joo Lee, Eric Buehler, and Paul Bailey
mml.sdf
## Not run:
#TIMSS Example
t15 <- readTIMSS(path="~/TIMSS/2015", "usa", 4)
showPlausibleValues(data=t15) #view constructs in console
#ensure we have all data needed for mml.sdf on light.edsurvey.data.frame
#must be specified ahead of time. the 'getAllItems' function makes this easy
mathItems <- getAllItems(sdf=t15, construct="mmat") #get mathematics items
sciItems <- getAllItems(sdf=t15, construct="ssci") #get science items
allItems <- getAllItems(sdf=t15, construct="NULL")
wgtVar <- "totwgt"
psustr <- c(getPSUVar(t15, wgtVar), getStratumVar(t15, wgtVar))
lsdf <- getData(data=t15,
varnames=c("ROWID", "mmat", mathItems, psustr, wgtVar),
omittedLevels=FALSE,
addAttributes=TRUE) #builds light.edsurvey.data.frame
#as a light.edsurvey.data.frame all elements must be present
mml.sdf(formula=mmat ~ 1, data=lsdf, weightVar="totwgt")
#as edsurvey.data.frame elements retrieved automatically for user
mml.sdf(formula=mmat ~ 1, data=t15, weightVar="totwgt")
#NAEP example
sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package="NAEPprimer"))
allItems <- getAllItems(sdf=sdf, construct=NULL)
algebraItems <- getAllItems(sdf=sdf, construct="algebra")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.