February20,2015
TitleLatentTraitModelsunderIRTVersion1.0-0Date2013-12-20
AuthorDimitrisRizopoulos DescriptionAnalysisofmultivariatedichotomousandpolytomousdatausinglatenttraitmodelsun-dertheItemResponseTheoryapproach.ItincludestheRasch,theTwo-ParameterLogis-tic,theBirnbaum'sThree-Parameter,theGradedResponse,andtheGeneralizedPar-tialCreditModels.DependsR(>=2.14.0),MASS,msm,polycorLazyLoadyesLazyDatayesLicenseGPL(>=2) URLhttp://rwiki.sciviews.org/doku.php?id=packages:cran:ltmNeedsCompilationnoRepositoryCRAN Date/Publication2013-12-2010:59:19 Rtopicsdocumented: ltm-package..Abortion....anova.....biserial.cor..coef......cronbach.alphadescript....Environment..factor.scores..fitted......gh....... ..........................................................................................................................................................1...................................................................................................................................................................................................................................................................................23478101113141719 2 GoF.......gpcm......grm.......information...item.fit......LSAT......ltm........margins.....Mobility.....mult.choice...person.fit....plotdescript...plotfscores...plotIRT.....rasch.......rcor.test.....residuals.....rmvlogis.....Science.....summary....testEquatingDatatpm.......unidimTest...vcov.......WIRS...... Index ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... ltm-package.............................................................................................................................1921242728303135373839424344485253545657596063666768 ltm-packageLatentTraitModelsforItemResponseTheoryAnalyses Description ThispackageprovidesaflexibleframeworkforItemResponseTheoryanalysesfordichotomousandpolytomousdataunderaMarginalMaximumLikelihoodapproach.ThefittingalgorithmsprovidevalidinferencesunderMissingAtRandommissingdatamechanisms.Details Package:Type:Version:Date:License: ltmPackage1.0-0 2013-12-20 GPL Thefollowingoptionsareavailable: Abortion3 Descriptives:samplesproportions,missingvaluesinformation,biserialcorrelationofitemswith totalscore,pairwiseassociationsbetweenitems,Cronbach’sα,unidimensionalitycheckus-ingmodifiedparallelanalysis,nonparametriccorrelationcoefficient,plottingofsamplepro-portionsversustotalscore.Dichotomousdata:RaschModel,TwoParameterLogisticModel,Birnbaum’sThreeParameter Model,andLatentTraitModeluptotwolatentvariables(allowingalsofornonlineartermsbetweenthelatenttraits).Polytomousdata:Samejima’sGradedResponseModelandtheGeneralizedPartialCreditModel.Goodness-of-Fit:BootstrappedPearsonχ2forRaschandGeneralizedPartialCreditmodels,fiton thetwo-andthree-waymarginsforallmodels,likelihoodratiotestsbetweennestedmodels(includingAICandBICcriteriavalues),anditem-andperson-fitstatistics.FactorScoring-AbilityEstimates:EmpiricalBayes(i.e.,posteriormodes),Expectedaposte-riori(i.e.,posteriormeans),MultipleImputedEmpiricalBayes,andComponentScoresfordichotomousdata.TestEquating:AlternateFormEquating(wherecommonanduniqueitemsareanalyzedsimul-taneously)andAcrossSampleEquating(wheredifferentsetsofuniqueitemsareanalyzedseparatelybasedonpreviouslycalibratedanchoritems).Plotting:ItemCharacteristicCurves,ItemInformationCurves,TestInformationFunctions,Stan-dardErrorofMeasurement,StandardizedLoadingsScatterplot(forthetwo-factorlatenttraitmodel),ItemOperationCharacteristicCurves(forordinalpolytomousdata),ItemPersonMaps.MoreinformationaswellasRscriptfilescontainingsampleanalysescanbefoundintheRwikipageofltmavailableat: http://rwiki.sciviews.org/doku.php?id=packages:cran:ltm.Author(s) DimitrisRizopoulos Maintainer:DimitrisRizopoulos Baker,F.andKim,S-H.(2004)ItemResponseTheory,2nded.NewYork:MarcelDekker.Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/ AbortionAttitudeTowardsAbortion Description Thedatacontainresponsesgivenby410individualstofouroutofsevenitemsconcerningattitudetoabortion.Asmallnumberofindividualdidnotanswertosomeofthequestionsandthisdatasetcontainsonlythecompletecases. 4Format anova 379individualsansweredtothefollowingquestionsafterbeingaskedifthelawshouldallowabor-tionunderthecircumstancespresentedundereachitem,Item1Thewomandecidesonherownthatshedoesnot.Item2Thecoupleagreethattheydonotwishtohaveachild.Item3Thewomanisnotmarriedanddoesnotwishtomarrytheman.Item4Thecouplecannotaffordanymorechildren.Source 1986BritishSocialAttitudesSurvey(McGrathandWaterton,1986).References Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Knott,M.,Albanese,M.andGalbraith,J.(1990)Scoringattitudestoabortion.TheStatistician,40,217–223. McGrath,K.andWaterton,J.(1986)Britishsocialattitudes,1983-86panelsurvey.London:SCPR.Examples ##DescriptivestatisticsforAbortiondatadsc<-descript(Abortion)dsc plot(dsc) anovaAnovamethodforfittedIRTmodels Description PerformsaLikelihoodRatioTestbetweentwonestedIRTmodels.Usage ##S3methodforclassgpcm anova(object,object2,simulate.p.value=FALSE, B=200,verbose=getOption(\"verbose\"),seed=NULL,...)##S3methodforclassgrmanova(object,object2,...) anova ##S3methodforclassltmanova(object,object2,...)##S3methodforclassraschanova(object,object2,...)##S3methodforclasstpmanova(object,object2,...)Arguments objectobject2 5 anobjectinheritingfromeitherclassgpcm,classgrm,classltm,classraschorclasstpm,representingthemodelunderthenullhypothesis. anobjectinheritingfromeitherclassgpcm,classgrm,classltm,classrasch,orclasstpm,representingthemodelunderthealternativehypothesis. simulate.p.value logical;ifTRUE,thereportedp-valueisbasedonaparametricBootstrapap-proach. thenumberofBootstrapsamples. logical;ifTRUE,informationisprintedintheconsoleduringtheparametricBootstrap. theseedtobeusedduringtheparametricBootstrap;ifNULL,arandomseedisused. additionalarguments;currentlynoneisused. Bverboseseed...Details anova.gpcm()alsoincludestheoptiontoestimatethep-valueoftheLRTusingaparametricBoot-strapapproach.Inparticular,Bdatasetsaresimulatedunderthenullhypothesis(i.e.,underthegeneralizedpartialcreditmodelobject),andboththenullandalternativemodelsarefittedandthe B valueofLRTiscomputed.Thenthep-valueisapproximateusing[1+I(Ti>Tobs)]/(B+1),whereTobsisthevalueofthelikelihoodratiostatisticintheoriginaldataset,andTithevalueofthestatisticintheithBootstrapsample. Inaddition,whensimulate.p.value=TRUEobjectsofclassaov.gpcmhaveamethodfortheplot()genericfunctionthatproducesaQQplotcomparingtheBootstrapsampleoflikelihoodrationstatisticwiththeasymptoticchi-squareddistribution.Forinstance,youcanusesomethinglikethefollowing:lrt<-anova(obj1,obj2,simulate.p.value=TRUE);plot(lrt).Value Anobjectofeitherclassaov.gpcm,aov.grm,classaov.ltmorclassaov.raschwithcomponents,nam0L0nb0aic0 thenameofobject. thelog-likelihoodunderthenullhypothesis(object).thenumberofparameterinobject;returnedonlyinaov.gpcm.theAICvalueforthemodelgivenbyobject. i=1 6 bic0nam1L1nb1aic1bic1LRTdfp.valueWarning theBICvalueforthemodelgivenbyobject.thenameofobject2. thelog-likelihoodunderthealternativehypothesis(object2).thenumberofparameterinobject;returnedonlyinaov.gpcm.theAICvalueforthemodelgivenbyobject2.theBICvalueforthemodelgivenbyobject2.thevalueoftheLikelihoodRatioTeststatistic. anova thedegreesoffreedomforthetest(i.e.,thedifferenceinthenumberofparame-ters). thep-valueofthetest. Thecodedoesnotcheckifthemodelsarenested!TheuserisresponsibletosupplynestedmodelsinordertheLRTtobevalid. Whenobject2representsathreeparametermodel,notethatthenullhypothesisinontheboundaryoftheparameterspacefortheguessingparameters.Thus,theChi-squaredreferencedistributionusedbythesefunctionmightnotbetotallyappropriate.Author(s) DimitrisRizopoulos GoF.gpcm,GoF.rasch,gpcm,grm,ltm,rasch,tpmExamples ##LRTbetweentheconstrainedandunconstrainedGRMs##fortheSciencedata: fit0<-grm(Science[c(1,3,4,7)],constrained=TRUE)fit1<-grm(Science[c(1,3,4,7)])anova(fit0,fit1) ##LRTbetweentheone-andtwo-factormodels##fortheWIRSdata: anova(ltm(WIRS~z1),ltm(WIRS~z1+z2)) ##AnLRTbetweentheRaschandaconstrained ##two-parameterlogisticmodelfortheWIRSdata:fit0<-rasch(WIRS) fit1<-ltm(WIRS~z1,constraint=cbind(c(1,3,5),2,1))anova(fit0,fit1) biserial.cor7 ##AnLRTbetweentheconstrained(discrimination##parameterequals1)andtheunconstrainedRasch##modelfortheLSATdata: fit0<-rasch(LSAT,constraint=rbind(c(6,1)))fit1<-rasch(LSAT)anova(fit0,fit1) ##AnLRTbetweentheRaschandthetwo-parameter##logisticmodelfortheLSATdata:anova(rasch(LSAT),ltm(LSAT~z1)) biserial.corPoint-BiserialCorrelation Description Computesthepoint-biserialcorrelationbetweenadichotomousandacontinuousvariable.Usage biserial.cor(x,y,use=c(\"all.obs\\"complete.obs\"),level=1) Arguments xyuse anumericvectorrepresentingthecontinuousvariable. afactororanumericvector(thatwillbeconvertedtoafactor)representingthedichotomousvariable. Ifuseis\"all.obshenthepresenceofmissingobservationswillproduceanerror.Ifuseis\"complete.obs\"thenmissingvaluesarehandledbycasewisedeletion. whichlevelofytouse. levelDetails Thepointbiserialcorrelationcomputedbybiserial.cor()isdefinedasfollows (X1−X0)π(1−π)r=, Sx whereX1andX0denotethesamplemeansoftheX-valuescorrespondingtothefirstandsecondlevelofY,respectively,SxisthesamplestandarddeviationofX,andπisthesampleproportionforY=1.ThefirstlevelofYisdefinedbythelevelargument;seeExamples. 8Value the(numeric)valueofthepoint-biserialcorrelation.Note coef Changingtheorderofthelevelsforywillproduceadifferentresult.Bydefault,thefirstlevelisusedasareferencelevelAuthor(s) DimitrisRizopoulos #thepoint-biserialcorrelationbetween#thetotalscoreandthefirstitem,using#0asthereferencelevel biserial.cor(rowSums(LSAT),LSAT[[1]]) #andusing1asthereferencelevel biserial.cor(rowSums(LSAT),LSAT[[1]],level=2) coefExtractEstimatedLoadings Description Extractstheestimatedparametersfromeithergrm,ltm,raschortpmobjects.Usage ##S3methodforclassgpcmcoef(object,...) ##S3methodforclassgrmcoef(object,...) ##S3methodforclassltm coef(object,standardized=FALSE,prob=FALSE,order=FALSE,...)##S3methodforclassrasch coef(object,prob=FALSE,order=FALSE,...)##S3methodforclasstpm coef(object,prob=FALSE,order=FALSE,...) coefArguments objectstandardizedproborder...Details 9 anobjectinheritingfromeitherclassgpcm,classgrm,classltm,classraschorclasstpm. logical;ifTRUEthestandardizedloadingsarealsoreturned.SeeDetailsformoreinfo. logical;ifTRUEtheprobabilityofapositiveresponseforthemedianindividual(i.e.,Pr(xi=1|z=0),withi=1,...,pdenotingtheitems)isalsoreturned.logical;ifTRUEtheitemsaresortedaccordingtothedifficultyestimates.additionalarguments;currentlynoneisused. ThestandardizationofthefactorloadingsisusefulinordertoformalinktotheUnderlyingVariableapproach.Inparticular,thestandardizedformofthefactorloadingsrepresentsthecorrelationcoefficientbetweenthelatentvariablesandtheunderlyingcontinuousvariablesbasedonwhichthedichotomousoutcomesarise(seeBartholomewandKnott,1999,p.87-88orBartholomewetal.,2002,p.191). Thestandardizedfactorloadingsarecomputedonlyforthelinearone-andtwo-factormodels,fittedbyltm().Value Alistoramatrixoftheestimatedparametersforthefittedmodel.Author(s) DimitrisRizopoulos Bartholomew,D.andKnott,M.(1999)LatentVariableModelsandFactorAnalysis,2nded.Lon-don:Arnold. Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall.SeeAlso gpcm,grm,ltm,rasch,tpmExamples fit<-grm(Science[c(1,3,4,7)])coef(fit) fit<-ltm(LSAT~z1)coef(fit,TRUE,TRUE) 10 m<-rasch(LSAT) coef(fit,TRUE,TRUE) cronbach.alpha cronbach.alphaCronbach’salpha Description ComputesCronbach’salphaforagivendata-set.Usage cronbach.alpha(data,standardized=FALSE,CI=FALSE, probs=c(0.025,0.975),B=1000,na.rm=FALSE) Arguments datastandardizedCIprobsBna.rmDetails TheCronbach’salphacomputedbycronbach.alpha()isdefinedasfollows p 2σpyi α=1−i=1,2p−1σx 22 wherepisthenumberofitemsσxisthevarianceoftheobservedtotaltestscores,andσyistheivarianceoftheithitem. amatrixoradata.framecontainingtheitemsascolumns.logical;ifTRUEthestandardizedCronbach’salphaiscomputed. logical;ifTRUEaBootstrapconfidenceintervalforCronbach’salphaiscom-puted. anumericvectoroflengthtwoindicatingwhichquantilestousefortheBoot-strapCI. thenumberofBootstrapsamplestouse.logical;whattodowithNA’s. ThestandardizedCronbach’salphacomputedbycronbach.alpha()isdefinedasfollows αs= p·r¯ , 1+(p−1)·r¯ wherepisthenumberofitems,andr¯istheaverageofall(Pearson)correlationcoefficientsbetween theitems.Inthiscaseifna.rm=TRUE,thenthecompleteobservations(i.e.,rows)areused.TheBootstrapconfidenceintervaliscalculatedbysimplytakingBsampleswithreplacementfromdata,calculatingforeachαorαs,andcomputingthequantilesaccordingtoprobs. descriptValue cronbach.alpha()returnsanobjectofclasscronbachAlphawithcomponentsalphanp standardizednameciprobsBAuthor(s) DimitrisRizopoulos thevalueofCronbach’salpha.thenumberofsampleunits.thenumberofitems. acopyofthestandardizedargument.thenameofargumentdata. theconfidenceintervalforalpha;returnedifCI=TRUE.acopyoftheprobsargument;returnedifCI=TRUE.acopyoftheBargument;returnedifCI=TRUE. 11 Cronbach,L.J.(1951)Coefficientalphaandtheinternalstructureoftests.Psychometrika,16,297–334.Examples #CronbachsalphafortheLSATdata-set#withaBootstrap95%CI cronbach.alpha(LSAT,CI=TRUE,B=500) descriptDescriptiveStatistics Description Computesdescriptivestatisticsfordichotomousandpolytomousresponsematrices.Usage descript(data,n.print=10,chi.squared=TRUE,B=1000) 12Arguments datan.printchi.squaredB descript amatrixoradata.framecontainingthemanifestvariablesascolumns.numericindicatingthenumberofpairwiseassociationswiththehighestp-valuestobeprinted. logical;ifTRUEthechi-squaredtestforthepairwiseassociationsbetweenitemsisperformed.SeeDetailsformoreinfo. anintegerspecifyingthenumberofreplicatesusedintheMonteCarlotest(i.e.,thisistheBargumentofchisq.test()). Details Thefollowingdescriptivestatisticsarereturnedbydescript(): (i)theproportionsforallthepossibleresponsecategoriesforeachitem.Incaseallitemsare dichotomous,thelogitoftheproportionforthepositiveresponsesisalsoincluded.(ii)thefrequenciesofallpossibletotalscores.Thetotalscoreofaresponsepatternissimply itssum.Fordichotomousitemsthisisthenumberofpositiveresponses,whereasforpoly-tomousitemsthisisthesumofthelevelsrepresentedasnumericvalues(e.g.,theresponsecategories\"veryconcerned\\"slightlyconcerned\and\"notveryconcerned\"inEnvironmentarerepresentedas1,2,and3).(iii)Cronbach’salpha,forallitemsandexcludingeachtimeoneoftheitems. (iv)fordichotomousresponsematricestwoversionsofthepointbiserialcorrelationofeachitem withthetotalscorearereturned.Inthefirstonetheitemisincludedinthecomputationofthetotalscore,andinthesecondoneisexcluded.(v)pairwiseassociationsbetweenitems.Beforeananalysiswithlatentvariablemodels,itisuseful toinspectthedataforevidenceofpositivecorrelations.Inthecaseofbinaryorpolytomousdata,thisadhoccheckisperformedbyconstructingthe2×2contingencytablesforallpossi-blepairsofitemsandexaminetheChi-squaredp-values.Incaseanyexpectedfrequenciesaresmallerthan5,simulate.p.valueisturnedtoTRUEinchisq.test(),usingBresamples.Value descript()returnsanobjectofclassdescriptwithcomponents,sampleperc anumericvectoroflength2,withelementsthenumberofitemsandthenumberofsampleunits. anumericmatrixcontainingthepercentagesofnegativeandpositiveresponsesforeachitem.Ifdatacontainsonlydichotomousmanifestvariablesthelogitofthepositiveresponses(i.e.,secondrow)isalsoincluded.anumericmatrixcontainingthefrequenciesforthetotalscores. amatrixcontainingthep-valuesforthepairwiseassociationbetweentheitems.thevalueofthen.printargument.thenameofargumentdata. anumericmatrixcontainingthefrequencyandpercentagesofmissingvaluesforeachitem;returnedonlyifanyNA’sexistindata. itemspw.assn.printnamemissin Environment bisCorrExBisCorr 13 anumericvectorcontainingsampleestimatesofthebiserialcorrelationofdi-chotomousmanifestvariableswiththetotalscore. anumericvectorcontainingsampleestimatesofthebiserialcorrelationofdi-chotomousmanifestvariableswiththetotalscore,wherethelatteriscomputedbyexcludingthespecificitem.acopyofthedata. anumericmatrixwithonecolumncontainingthesampleestimatesofCron-bach’salpha,forallitemsandexcludingeachtimeoneitem. dataalpha Author(s) DimitrisRizopoulos plot.descript,unidimTestExamples ##DescriptivesforLSATdata:dsc<-descript(LSAT,3)dsc plot(dsc,type=\"b\lty=1,pch=1:5) legend(\"topleft\names(LSAT),pch=1:5,col=1:5,lty=1,bty=\"n\") EnvironmentAttitudetotheEnvironment Description ThisdatasetcomesfromtheEnvironmentsectionofthe1990BritishSocialAttitudesSurvey(Brooketal.,1991).Asampleof291respondedtothequestionsbelow:Format Allofthebelowitemsweremeasuredonathree-groupscalewithresponsecategories\"verycon-cerned\\"slightlyconcerned\"and\"notveryconcerned\":LeadPetrolLeadfrompetrol.RiverSeaRiverandseapollution. RadioWasteTransportandstorageofradioactivewaste.AirPollutionAirpollution. ChemicalsTransportanddisposalofpoisonouschemicals.NuclearRisksfromnuclearpowerstation. 14References factor.scores Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Brook,L.,Taylor,B.andPrior,G.(1991)BritishSocialAttitudes,1990,Survey.London:SCPR.Examples ##DescriptivestatisticsforEnvironmentdatadescript(Environment) factor.scoresFactorScores-AbilityEstimates Description Computationoffactorscoresforgrm,ltm,raschandtpmmodels.Usage factor.scores(object,...) ##S3methodforclassgpcm factor.scores(object,resp.patterns=NULL, method=c(\"EB\\"EAP\\"MI\"),B=5,robust.se=FALSE,prior=TRUE,return.MIvalues=FALSE,...)##S3methodforclassgrm factor.scores(object,resp.patterns=NULL, method=c(\"EB\\"EAP\\"MI\"),B=5,prior=TRUE,return.MIvalues=FALSE,...)##S3methodforclassltm factor.scores(object,resp.patterns=NULL, method=c(\"EB\\"EAP\\"MI\\"Component\"),B=5, robust.se=FALSE,prior=TRUE,return.MIvalues=FALSE,...)##S3methodforclassrasch factor.scores(object,resp.patterns=NULL, method=c(\"EB\\"EAP\\"MI\"),B=5,robust.se=FALSE,prior=TRUE,return.MIvalues=FALSE,...)##S3methodforclasstpm factor.scores(object,resp.patterns=NULL, method=c(\"EB\\"EAP\\"MI\"),B=5,prior=TRUE,return.MIvalues=FALSE,...) factor.scoresArguments objectresp.patternsmethod 15 anobjectinheritingfromeitherclassgpcm,classgrm,classltm,classraschorclasstpm. amatrixoradata.frameofresponsepatternswithcolumnsdenotingtheitems;ifNULLthefactorscoresarecomputedfortheobservedresponsepatterns.acharactersupplyingthescoringmethod;availablemethodsare:EmpiricalBayes,ExpectedaPosteriori,MultipleImputation,andComponent.SeeDe-tailssectionformoreinfo. thenumberofmultipleimputationstobeusedifmethod=\"MI\". logical;ifTRUEthesandwichestimatorisusedfortheestimationofthecovari-ancematrixoftheMLEs.SeeDetailssectionformoreinfo. logical.IfTRUE,thenthepriornormaldistributionforthelatentabilitiesistakenintoaccountinthecalculationoftheposteriormodes,whenmethod=\"EB\".logical.IfTRUE,thentheestimatedz-valuesandtheircovariancematrixarecon-tainedasextraattributes\"zvalues.MI\"and\"var.zvalues.MI\",respectively,inthereturnedscore.datdataframe. B robust.seprior return.MIvalues ...Details additionalarguments;currentlynoneisused. Factorscoresorabilityestimatesaresummarymeasuresoftheposteriordistributionp(z|x),wherezdenotesthevectoroflatentvariablesandxthevectorofmanifestvariables. UsuallyasfactorscoresweassignthemodesoftheaboveposteriordistributionevaluatedattheMLEs.TheseEmpiricalBayesestimates(usemethod=\"EB\")andtheirassociatedvariancearegoodmeasuresoftheposteriordistributionwhilep→∞,wherepisthenumberofitems.Thisisbasedontheresult ˆ)(1+O(1/p)),p(z|x)=p(z|x;θˆaretheMLEs.However,incaseswherepand/orn(thesamplesize)issmallweignorethewhereθ variabilityofplugging-inestimatesbutnotthetrueparametervalues.AsolutiontothisproblemcanbegivenusingMultipleImputation(MI;usemethod=\"MI\").Inparticular,MIisusedtheotherwayaround,i.e., ˆC(θˆ)),whereC(θˆ)isthelargesampleStep1:Simulatenewparametervalues,sayθ∗,fromN(θ, ˆ(ifrobust.se=TRUE,C(θˆ)isbasedonthesandwichestimator).covariancematrixofθStep2:Maximizep(z|x;θ∗)wrtzandalsocomputetheassociatedvariancetothismode.Step3:Repeatsteps1-2BtimesandcombinetheestimatesusingtheknownformulasofMI.Thisschemeexplicitlyacknowledgestheignoranceofthetrueparametervaluesbydrawingfrom theirlargesampleposteriordistributionwhiletakingintoaccountthesamplingerror.Themodesoftheposteriordistributionp(z|x;θ)arenumericallyapproximatedusingtheBFGSalgorithminoptim(). TheExpectedaposterioriscores(usemethod=\"EAP\")computedbyfactor.scores()arede-finedasfollows: ˆ)dz.zp(z|x;θ 16factor.scores TheComponentscores(usemethod=\"Component\")proposedbyBartholomew(1984)isanalternativemethodtoscalethesampleunitsinthelatentdimensionsidentifiedbythemodelthatavoidsthecalculationoftheposteriormode.However,thismethodisnotvalidinthegeneralcasewherenonlinearlatenttermsareassumed. Value Anobjectofclassfscoresisalistwithcomponents,score.dat thedata.frameofobservedresponsepatternsincluding,observedandexpectedfrequencies(onlyiftheobserveddataresponsematrixcontainsnomissingvales),thefactorscoresandtheirstandarderrors.acharactergivingthescoringmethodused. thenumberofmultipleimputationsused;relevantonlyifmethod=\"MI\".acopyofthematchedcallofobject. logical;isTRUEifresp.patternsargumenthasbeenspecified. theparameterestimatesreturnedbycoef(object);thisisNULLwhenobjectinheritsfromclassgrm. methodBcallresp.patscoef Author(s) DimitrisRizopoulos Bartholomew,D.(1984)Scalingbinarydatausingafactormodel.JournaloftheRoyalStatisticalSociety,SeriesB,46,120–123. Bartholomew,D.andKnott,M.(1999)LatentVariableModelsandFactorAnalysis,2nded.Lon-don:Arnold. Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/ Rizopoulos,D.andMoustaki,I.(2008)Generalizedlatentvariablemodelswithnonlineareffects.BritishJournalofMathematicalandStatisticalPsychology,61,415–438.SeeAlso plot.fscores,gpcm,grm,ltm,rasch,tpmExamples ##FactorScoresfortheRaschmodelfit<-rasch(LSAT) factor.scores(fit)#EmpiricalBayes fitted17 ##Factorscoresforallsubjectsinthe##originaldatasetLSAT factor.scores(fit,resp.patterns=LSAT) ##Factorscoresforspecificpatterns,##includingNAs,canbeobtainedby factor.scores(fit,resp.patterns=rbind(c(1,0,1,0,1),c(NA,1,0,NA,1)))##Notrun: ##FactorScoresforthetwo-parameterlogisticmodelfit<-ltm(Abortion~z1) factor.scores(fit,method=\"MI\B=20)#MultipleImputation##FactorScoresforthegradedresponsemodelfit<-grm(Science[c(1,3,4,7)]) factor.scores(fit,resp.patterns=rbind(1:4,c(NA,1,2,3)))##End(Notrun) fittedFittedValuesforIRTmodel Description Computestheexpectedfrequenciesforvectorsofresponsepatterns.Usage ##S3methodforclassgpcm fitted(object,resp.patterns=NULL, type=c(\"expected\\"marginal-probabilities\\"conditional-probabilities\"),...)##S3methodforclassgrm fitted(object,resp.patterns=NULL, type=c(\"expected\\"marginal-probabilities\\"conditional-probabilities\"),...)##S3methodforclassltm fitted(object,resp.patterns=NULL, type=c(\"expected\\"marginal-probabilities\\"conditional-probabilities\"),...)##S3methodforclassrasch fitted(object,resp.patterns=NULL, 18 type=c(\"expected\\"marginal-probabilities\\"conditional-probabilities\"),...) ##S3methodforclasstpm fitted(object,resp.patterns=NULL, type=c(\"expected\\"marginal-probabilities\\"conditional-probabilities\"),...)Arguments objectresp.patterns fitted anobjectinheritingeitherfromclassgpcm,classgrm,classltm,classrasch,orclasstpm. amatrixoradata.frameofresponsepatternswithcolumnsdenotingtheitems;ifNULLtheexpectedfrequenciesarecomputedfortheobservedresponsepatterns. iftype==\"marginal-probabilities\"themarginalprobabilitiesforeachp responsearecomputed;thesearegivenby{i=1Pr(xi=1|z)xi×(1−Pr(xi=1|z))1−xi}p(z)dz,wherexidenotestheithitemandzthelatentvariable.Iftype==\"expected\"theexpectedfrequenciesforeachresponsearecomputed,whicharethemarginalprobabilitiestimesthenumberofsampleunits.Iftype==\"conditional-probabilities\"theconditionalprobabili-tiesforeachresponseanditemarecomputed;thesearePr(xi=1|zˆ),wherezˆistheabilityestimate. additionalarguments;currentlynoneisused. type ...Value anumericmatrixoralistcontainingeithertheresponsepatternsofinterestwiththeirexpectedfrequenciesormarginalprobabilities,iftype==\"expected\"||\"marginal-probabilities\"or theconditionalprobabilitiesforeachresponsepatternanditem,iftype==\"conditional-probabilities\".Author(s) DimitrisRizopoulos residuals.gpcm,residuals.grm,residuals.ltm,residuals.rasch,residuals.tpmExamples fit<-grm(Science[c(1,3,4,7)]) fitted(fit,resp.patterns=matrix(1:4,nr=4,nc=4))fit<-rasch(LSAT) fitted(fit,type=\"conditional-probabilities\") gh19 ghGauss-HermiteQuadraturePoints Description TablewithGauss-HermiteQuadraturePoints GoFGoodnessofFitforRaschModels Description PerformsaparametricBootstraptestforRaschandGeneralizedPartialCreditmodels.Usage GoF.gpcm(object,simulate.p.value=TRUE,B=99,seed=NULL,...)GoF.rasch(object,B=49,...)Arguments objectanobjectinheritingfromeitherclassgpcmorclassrasch.simulate.p.value logical;ifTRUE,thereportedp-valueisbasedonaparametricBootstrapap-proach.Otherwisethep-valueisbasedontheasymptoticchi-squareddistribu-tion.Bseed...Details GoF.gpcmandGoF.raschperformaparametricBootstraptestbasedonPearson’schi-squaredstatisticdefinedas 2p{O(r)−E(r)}2 , E(r)r=1whererrepresentsaresponsepattern,O(r)andE(r)representtheobservedandexpectedfrequen-cies,respectivelyandpdenotesthenumberofitems.TheBootstrapapproximationtothereference distributionispreferablecomparedwiththeordinaryChi-squaredapproximationsincethelatterisnotvalidespeciallyforlargenumberofitems(=>manyresponsepatternswithexpectedfrequenciessmallerthan1). Inparticular,theBootstraptestisimplementedasfollows: thenumberofBootstrapsamples.SeeDetailssectionformoreinfo. theseedtobeusedduringtheparametricBootstrap;ifNULL,arandomseedisused. additionalarguments;currentlynoneisused. 20 Step0:BasedonobjectcomputetheobservedvalueofthestatisticTobs. GoF ˆC(θˆ)),whereθˆaretheMLEsandC(θˆ)Step1:Simulatenewparametervalues,sayθ∗,fromN(θ, theirlargesamplecovariancematrix.Step2:Usingθ∗simulatenewdata(withthesamedimensionsastheobservedones),fitthegener-alizedpartialcreditortheRaschmodelandbasedonthisfitcalculatethevalueofthestatisticTi.Step3:Repeatsteps1-2Btimesandestimatethep-valueusing[1+ Bi=1 I(Ti>Tobs)]/(B+1). Furthermore,inGoF.gpcmwhensimulate.p.value=FALSE,thenthep-valueisbasedonthe asymptoticchi-squareddistribution.Value AnobjectofclassGoF.gpcmorGoF.raschwithcomponents,TobsBcallp.value thevalueofthePearson’schi-squaredstatisticfortheobserveddata.theBargumentspecifyingthenumberofBootstrapsamplesused.thematchedcallofobject.thep-valueofthetest. simulate.p.value thevalueofsimulate.p.valueargument(returnedonforclassGoF.gpcm).df thedegreesoffreedomfortheasymptoticchi-squareddistribution(returnedonforclassGoF.gpcm). Author(s) DimitrisRizopoulos person.fit,item.fit,margins,gpcm,raschExamples ##GoFfortheRaschmodelfortheLSATdata:fit<-rasch(LSAT)GoF.rasch(fit) gpcm21 gpcmGeneralizedPartialCreditModel-PolytomousIRT Description FitstheGeneralizedPartialCreditmodelforordinalpolytomousdata,undertheItemResponseTheoryapproach.Usage gpcm(data,constraint=c(\"gpcm\\"1PL\\"rasch\"),IRT.param=TRUE, start.val=NULL,na.action=NULL,control=list())Arguments dataconstraintIRT.paramstart.val adata.frameoranumericmatrixofmanifestvariables. acharacterstringspecifyingwhichversionoftheGeneralizedPartialCreditModeltofit.SeeDetailsandExamplesformoreinfo. logical;ifTRUEthenthecoefficients’estimatesarereportedundertheusualIRTparameterization.SeeDetailsformoreinfo. alistofstartingvaluesorthecharacterstring\"random\".Ifalist,eachoneofitselementscorrespondstoeachitemandshouldcontainanumericvectorwithinitialvaluesforthethresholdparametersanddiscriminationparameter;evenifconstraint=\"rasch\"orconstraint=\"1PL\",thediscriminationparametershouldbeprovidedforalltheitems.If\"random\",randomstartingvaluesarecomputed. thena.actiontobeusedondata;defaultNULLthemodelusestheavailablecases,i.e.,ittakesintoaccounttheobservedpartofsampleunitswithmissingvalues(validunderMARmechanismsifthemodeliscorrectlyspecified).anamedlistofcontrolvalueswithcomponents, iter.qNthenumberofquasi-Newtoniterations.Default150. GHkthenumberofGauss-Hermitequadraturepoints.Default21. optimizerwhichoptimizationroutinetouse;optionsare\"optim\"and\"nlminb\ thelatterbeingthedefault. optimMethodtheoptimizationmethodtobeusedinoptim().Defaultis\"BFGS\".numrDerivwhichnumericalderivativealgorithmtousetoapproximatethe Hessianmatrix;optionsare\"fd\"forforwarddifferenceapproximationand\"cd\"forcentraldifferenceapproximation.Defaultis\"fd\". epsHesstepsizetobeusedinthenumericalderivative.Defaultis1e-06.Ifyou choosenumrDeriv=\"cd\",thenchangethistoalargervalue,e.g.,1e-03or1e-04. parscaletheparscalecontrolargumentofoptim().Defaultis0.5forall parameters. verboselogical;ifTRUEinfoabouttheoptimizationprocedureareprinted. na.action control 22Details gpcm TheGeneralizedPartialCreditModelisanIRTmodel,thatcanhandleordinalmanifestvariables.ThismodelwasdiscussedbyMasters(1982)anditwasextendedbyMuraki(1992).Themodelisdefinedasfollows exp Pik(z)= mir=0 kc=0 r∗βi(z−βic) , ∗)βi(z−βic exp c=0 wherePik(z)denotestheprobabilityofrespondingincategorykforitemi,giventhelatentability ∗z,βicaretheitem-categoryparameters,βiisthediscriminationparameter,miisthenumberofcategoriesforitemi,and 0 ∗ βi(z−βic)≡0. c=0 Ifconstraint=\"rasch\",thenthediscriminationparameterβiisassumedequalforallitems andfixedatone.Ifconstraint=\"1PL\",thenthediscriminationparameterβiisassumedequalforallitemsbutisestimated.Ifconstraint=\"gpcm\",theneachitemhasitsonediscriminationparameterβithatisestimated.SeeExamplesformoreinfo. IfIRT.param=FALSE,thenthelinearpredictorisoftheformβiz+βic. ThefitofthemodelisbasedonapproximatemarginalMaximumLikelihood,usingtheGauss-Hermitequadraturerulefortheapproximationoftherequiredintegrals.Value Anobjectofclassgpcmwithcomponents,coefficientslog.Lik convergencehessiancountspatterns anamedlistwithcomponentstheparametervaluesatconvergenceforeachitem.thelog-likelihoodvalueatconvergence. theconvergenceidentifierreturnedbyoptim()ornlminb().theapproximateHessianmatrixatconvergence. thenumberoffunctionandgradientevaluationsusedbythequasi-Newtonal-gorithm. alistwithtwocomponents:(i)X:anumericmatrixthatcontainstheobservedresponsepatterns,and(ii)obs:anumericvectorthatcontainstheobservedfrequenciesforeachobservedresponsepattern. alistwithtwocomponentsusedintheGauss-Hermiterule:(i)Z:anumericmatrixthatcontainstheabscissas,and(ii)GHw:anumericvectorthatcontainsthecorrespondingweights. themaximumabsolutevalueofthescorevectoratconvergence.thevalueoftheconstraintargument.thevalueoftheIRT.paramargument.acopyoftheresponsedatamatrix. thevaluesusedinthecontrolargument.thevalueofthena.actionargument.thematchedcall. GH max.sc constraintIRT.paramX controlna.actioncall gpcmWarning 23 IncasetheHessianmatrixatconvergenceisnotpositivedefinitetrytore-fitthemodelbyspecifyingthestartingvaluesorusingstart.val=\"random\".Note gpcm()canalsohandlebinaryitemsandcanbeusedinsteadofraschandltmthoughitislessefficient.However,gpcm()canhandleamixofdichotomousandpolytomousitemsthatneitherraschnorltmcan.Author(s) DimitrisRizopoulos Masters,G.(1982).ARaschmodelforpartialcreditscoring.Psychometrika,47,149–174.Muraki,E.(1992).Ageneralizedpartialcreditmodel:applicationofanEMalgorithm.AppliedPsychologicalMeasurement,16,159–176.SeeAlso coef.gpcm,fitted.gpcm,summary.gpcm,anova.gpcm,plot.gpcm,vcov.gpcm,GoF.gpcm,margins,factor.scoresExamples ##TheGeneralizedPartialCreditModelfortheSciencedata:gpcm(Science[c(1,3,4,7)]) ##TheGeneralizedPartialCreditModelfortheSciencedata,##assumingequaldiscriminationparametersacrossitems:gpcm(Science[c(1,3,4,7)],constraint=\"1PL\") ##TheGeneralizedPartialCreditModelfortheSciencedata,##assumingequaldiscriminationparametersacrossitems##fixedat1: gpcm(Science[c(1,3,4,7)],constraint=\"rasch\") ##moreexamplescanbefoundat: ##http://wiki.r-project.org/rwiki/doku.php?id=packages:cran:ltm#sample_analyses 24grm grmGradedResponseModel-PolytomousIRT Description FitstheGradedResponsemodelforordinalpolytomousdata,undertheItemResponseTheoryapproach.Usage grm(data,constrained=FALSE,IRT.param=TRUE,Hessian=FALSE, start.val=NULL,na.action=NULL,control=list())Arguments dataconstrainedIRT.paramHessianstart.val adata.frame(thatwillbeconvertedtoanumericmatrixusingdata.matrix())oranumericmatrixofmanifestvariables. logical;ifTRUEthemodelwithequaldiscriminationparametersacrossitemsisfitted.SeeExamplesformoreinfo. logical;ifTRUEthenthecoefficients’estimatesarereportedundertheusualIRTparameterization.SeeDetailsformoreinfo.logical;ifTRUEtheHessianmatrixiscomputed. alistofstartingvaluesorthecharacterstring\"random\".Ifalist,eachoneofitselementscorrespondstoeachitemandshouldcontainanumericvectorwithinitialvaluesfortheextremityparametersanddiscriminationparameter;evenifconstrained=TRUEthediscriminationparametershouldbeprovidedforalltheitems.If\"random\"randomstartingvaluesarecomputed. thena.actiontobeusedondata;defaultNULLthemodelusestheavailablecases,i.e.,ittakesintoaccounttheobservedpartofsampleunitswithmissingvalues(validunderMARmechanismsifthemodeliscorrectlyspecified)..alistofcontrolvalues, iter.qNthenumberofquasi-Newtoniterations.Default150. GHkthenumberofGauss-Hermitequadraturepoints.Default21. methodtheoptimizationmethodtobeusedinoptim().Default\"BFGS\".verboselogical;ifTRUEinfoabouttheoptimizationprocedureareprinted.digits.abbrvnumericvalueindicatingthenumberofdigitsusedinabbreviating theItem’snames.Default6. Details TheGradedResponseModelisatypeofpolytomousIRTmodel,specificallydesignedforordinalmanifestvariables.ThismodelwasfirstdiscussedbySamejima(1969)anditismainlyusedincaseswheretheassumptionofordinallevelsofresponseoptionsisplausible. na.action control grm Themodelisdefinedasfollows logγik1−γik =βiz−βik, 25 whereγikdenotesthecumulativeprobabilityofaresponseincategorykthorlowertotheithitem,giventhelatentabilityz.Ifconstrained=TRUEitisassumedthatβi=βforalli. IfIRT.param=TRUE,thentheparametersestimatesarereportedundertheusualIRTparameteri-zation,i.e., γik∗ log=βi(z−βik), 1−γik ∗ whereβik=βik/βi. ThefitofthemodelisbasedonapproximatemarginalMaximumLikelihood,usingtheGauss-Hermitequadraturerulefortheapproximationoftherequiredintegrals.Value Anobjectofclassgrmwithcomponents,coefficientslog.Likconvergencehessiancountspatterns anamedlistwithcomponentstheparametervaluesatconvergenceforeachitem. Thesearealwaystheestimatesofβik,βiparameters,evenifIRT.param=TRUE.thelog-likelihoodvalueatconvergence.theconvergenceidentifierreturnedbyoptim(). theapproximateHessianmatrixatconvergencereturnedbyoptim();returnedonlyifHessian=TRUE. thenumberoffunctionandgradientevaluationsusedbythequasi-Newtonal-gorithm. alistwithtwocomponents:(i)X:anumericmatrixthatcontainstheobservedresponsepatterns,and(ii)obs:anumericvectorthatcontainstheobservedfrequenciesforeachobservedresponsepattern. alistwithtwocomponentsusedintheGauss-Hermiterule:(i)Z:anumericmatrixthatcontainstheabscissas,and(ii)GHw:anumericvectorthatcontainsthecorrespondingweights. themaximumabsolutevalueofthescorevectoratconvergence.thevalueoftheconstrainedargument.thevalueoftheIRT.paramargument.acopyoftheresponsedatamatrix.thevaluesusedinthecontrolargument.thevalueofthena.actionargument.thematchedcall. GH max.scconstrainedIRT.paramXcontrolna.actioncallWarning IncasetheHessianmatrixatconvergenceisnotpositivedefinitetrytore-fitthemodel,usingstart.val=\"random\". 26Note grm grm()returnstheparameterestimatessuchthatthediscriminationparameterforthefirstitemβ1ispositive. Whenthecoefficients’estimatesarereportedundertheusualIRTparameterization(i.e.,IRT.param=TRUE),theirstandarderrorsarecalculatedusingtheDeltamethod. grm()canalsohandlebinaryitems,whichshouldbecodedas‘1,2’insteadof‘0,1’. Somepartsofthecodeusedforthecalculationofthelog-likelihoodandthescorevectorhavebeenbasedonpolr()frompackageMASS. Author(s) DimitrisRizopoulos References Baker,F.andKim,S-H.(2004)ItemResponseTheory,2nded.NewYork:MarcelDekker.Samejima,F.(1969).Estimationoflatentabilityusingaresponsepatternofgradedscores.Psy-chometrikaMonographSupplement,34,100–114. Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/SeeAlso coef.grm,fitted.grm,summary.grm,anova.grm,plot.grm,vcov.grm,margins,factor.scoresExamples ##TheGradedResponsemodelfortheSciencedata:grm(Science[c(1,3,4,7)]) ##TheGradedResponsemodelfortheSciencedata, ##assumingequaldiscriminationparametersacrossitems:grm(Science[c(1,3,4,7)],constrained=TRUE) ##TheGradedResponsemodelfortheEnvironmentdatagrm(Environment) information27 informationAreaundertheTestorItemInformationCurves Description ComputestheamountoftestoriteminformationforafittedIRTmodel,inaspecifiedrange.Usage information(object,range,items=NULL,...)Arguments objectrangeitems...Details TheamountofinformationiscomputedastheareaundertheItemorTestInformationCurveinthespecifiedinterval,usingintegrate().Value Alistofclassinformationwithcomponents,InfoRangeInfoTotalPropRangerangeitemscallAuthor(s) DimitrisRizopoulos plot.gpcm,plot.grm,plot.ltm,plot.rasch theamountofinformationinthespecifiedinterval. thetotalamountofinformation;typicallythisiscomputedastheamountofinformationintheinterval(−10,10). theproportionofinformationinthespecifiedrange,i.e.,\"Infoinrange\"/\"TotalInfo\".thevalueofrangeargument.thevalueofitemsargument.thematchedcallforobject. anobjectinheritingfromeitherclassgpcm,classgrm,classltm,classraschorclasstpm. anumericintervalforwhichthetestinformationshouldbecomputed.theitemsforwhichtheinformationshouldbecomputed;thedefaultNULLcor-respondstoalltheitems,whichisequivalenttothetestinformation.extraargumentspassedtointegrate(). 28Examples fit<-rasch(LSAT) information(fit,c(-2,0)) information(fit,c(0,2),items=c(3,5)) item.fit item.fitItem-FitStatisticsandP-values Description Computationofitemfitstatisticsforltm,raschandtpmmodels.Usage item.fit(object,G=10,FUN=median, simulate.p.value=FALSE,B=100)Arguments objectGFUN amodelobjectinheritingeitherfromclassltm,classraschorclasstpm.eitheranumberoranumericvector.Ifanumber,thenitdenotesthenumberofcategoriessampleunitsaregroupedaccordingtotheirabilityestimates. afunctiontosummarizetheabilityestimatewitheachgroup(e.g.,median,mean,etc.). simulate.p.value logical;ifTRUE,thentheMonteCarloproceduredescribedintheDetailssectionisusedtoapproximatethethedistributionoftheitem-fitstatisticunderthenullhypothesis.BDetails Theitem-fitstatisticcomputedbyitem.fit()hastheform: GNj(Oij−Eij)2 , E(1−E)ijijj=1 thenumberofreplicationsintheMonteCarloprocedure. whereiistheitem,jistheintervalcreatedbygroupingsampleunitsonthebasisoftheirability estimates,Gisthenumberofsampleunitsgroupings(i.e.,Gargument),Njisthenumberofsampleunitswithabilityestimatesfallinginagivenintervalj,Oijistheobservedproportionofkeyedresponsesonitemiforintervalj,andEijistheexpectedproportionofkeyedresponsesonitemiforintervaljbasedontheIRTmodel(i.e.,object)evaluatedattheabilityestimatez∗withintheinterval,withz∗denotingtheresultofFUNappliedtotheabilityestimatesingroupj. item.fit29 Ifsimulate.p.value=FALSE,thenthep-valuesarecomputedassumingachi-squareddistri-butionwithdegreesoffreedomequaltothenumberofgroupsGminusthenumberofestimatedparameters.Ifsimulate.p.value=TRUE,aMonteCarloprocedureisusedtoapproximatethedistributionoftheitem-fitstatisticunderthenullhypothesis.Inparticular,thefollowingstepsarereplicatedBtimes: Step1:Simulateanewdata-setofdichotomousresponsesundertheassumedIRTmodel,using ˆintheoriginaldata-set,extractedfromobject.themaximumlikelihoodestimatesθStep2:Fitthemodeltothesimulateddata-set,extractthemaximumlikelihoodestimatesθ∗and computetheabilityestimatesz∗foreachresponsepattern.Step3:Forthenewdata-set,andusingz∗andθ∗,computethevalueoftheitem-fitstatistic.DenotebyTobsthevalueoftheitem-fitstatisticfortheoriginaldata-set.Thenthep-valueisapproximatedaccordingtotheformula B1+I(Tb≥Tobs)/(1+B), b=1 whereI(.)denotestheindicatorfunction,andTbdenotesthevalueoftheitem-fitstatisticinthebth simulateddata-set.Value AnobjectofclassitemFitisalistwithcomponents,Tobsp.values anumericvectorwithitem-fitstatistics. anumericvectorwiththecorrespondingp-values. GthevalueoftheGargument.simulate.p.value thevalueofthesimulate.p.valueargument.BcallAuthor(s) DimitrisRizopoulos Reise,S.(1990)Acomparisonofitem-andperson-fitmethodsofassessingmodel-datafitinIRT.AppliedPsychologicalMeasurement,14,127–137. Yen,W.(1981)Usingsimulationresultstochoosealatenttraitmodel.AppliedPsychologicalMeasurement,5,245–262.SeeAlso person.fit,margins,GoF.gpcm,GoF.rasch thevalueoftheBargument.acopyofthematchedcallofobject. 30Examples #item-fitstatisticsfortheRaschmodel#fortheAbortiondata-setitem.fit(rasch(Abortion)) #YensQ1item-fitstatistic(i.e.,10latentabilitygroups;the#meanabilityineachgroupisusedtocomputefittedproportions)#forthetwo-parameterlogisticmodelfortheLSATdata-setitem.fit(ltm(LSAT~z1),FUN=mean) LSAT LSATTheLawSchoolAdmissionTest(LSAT),SectionVI Description TheLSATisaclassicalexampleineducationaltestingformeasuringabilitytraits.Thistestwasdesignedtomeasureasinglelatentabilityscale.Format Adataframewiththeresponsesof1000individualsto5questions.Source ThisLSATexampleisapartofadatasetgiveninBockandLieberman(1970).References Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Bock,R.andLieberman,M.(1970)Fittingaresponsemodelforndichotomouslyscoreditems.Psychometrika,35,179–197.Examples ##DescriptivestatisticsforLSATdatadsc<-descript(LSAT)dsc plot(dsc) ltm31 ltmLatentTraitModel-LatentVariableModelforBinaryData Description FitalatenttraitmodelundertheItemResponseTheory(IRT)approach.Usage ltm(formula,constraint=NULL,IRT.param,start.val, na.action=NULL,control=list())Arguments formula atwo-sidedformulaprovidingtheresponsesdatamatrixanddescribingthela-tentstructure.Intheleftsideofformulaeitheradata.frame(thatwillbeconvertedtoanumericmatrixusingdata.matrix())oranumericmatrixofmanifestvariablesmustbesupplied.Intherightsideofformulaonlytwolatentvariablesareallowedwithcodenamesz1,z2.Interactionandquadratictermscanalsobeused(seeDetailsandExamplesformoreinfo). athree-columnnumericmatrixwithatmostpq−1rows(wherepisthenumberofitemsandqthenumberoflatentcomponentsplustheintercept),specifyingfixed-valueconstraints.Thefirstcolumnrepresentstheitem(i.e.,1denotesthefirstitem,2thesecond,etc.),thesecondcolumnrepresentsthecomponentofthelatentstructure(i.e.,1denotestheinterceptβ0i,2theloadingsofthefirstfactorβ1i,etc.)andthethirdcolumndenotesthevalueatwhichthecorrespondingparametershouldbefixed.SeeDetailsandExamplesformoreinfo. logical;ifTRUEthenthecoefficients’estimatesforthetwo-parameterlogisticmodelarereportedundertheusualIRTparameterization.SeeDetailsformoreinfo. thecharacterstring\"random\"oranumericmatrixsupplyingstartingvalueswithprowsandqcolumns,withpdenotingthenumberofitems,andqdenotingthenumberoftermsintheright-handsideofformula.IfNULLstartingvaluesareautomaticallycomputed.If\"random\randomstartingvaluesareused.Ifama-trix,thendependingonthelatentstructurespecifiedinformula,thefirstcolumnshouldcontainβ0i,thesecondβ1i,thethirdβ2i,andtheremaingcolumnsβnl,i(seeDetails). thena.actiontobeusedonthedataframeintheleftsideofformula.Incaseofmissingdata,ifna.action=NULLthemodelusestheavailablecases,i.e.,ittakesintoaccounttheobservedpartofsampleunitswithmissingvalues(validunderMARmechanismsifthemodeliscorrectlyspecified).Ifyouwanttoapplyacompletecaseanalysisthenusena.action=na.exclude.alistofcontrolvalues, iter.emthenumberofEMiterations.Default40. iter.qNthenumberofquasi-Newtoniterations.Default150. constraint IRT.param start.val na.action control 32 GHkthenumberofGauss-Hermitequadraturepoints.Default15. methodtheoptimizationmethodtobeusedinoptim().Default\"BFGS\".verboselogical;ifTRUEinfoabouttheoptimizationprocedureareprinted. Details ltm Thelatenttraitmodelistheanalogueofthefactoranalysismodelforbinaryobserveddata.Themodelassumesthatthedependenciesbetweentheobservedresponsevariables(knownasitems)canbeinterpretedbyasmallnumberoflatentvariables.ThemodelformulationisundertheIRTapproach;inparticular, πi log=β0i+β1iz1+β2iz2, 1−πiwhereπiisthetheprobabilityofapositiveresponseintheithitem,βi0istheeasinessparameter,βij(j=1,2)arethediscriminationparametersandz1,z2denotethetwolatentvariables.Theusualformofthelatenttraitmodelassumeslinearlatentvariableeffects(BartholomewandKnott,1999;MoustakiandKnott,2000).ltm()fitsthelinearone-andtwo-factormodelsbutalsoprovidesextensionsdescribedbyRizopoulosandMoustaki(2006)toincludenonlinearlatentvariableeffects.Theseareincorporatedinthelinearpredictorofthemodel,i.e., πit log=β0i+β1iz1+β2iz2+βnlf(z1,z2), 1−πi 2 wheref(z1,z2)isafunctionofz1andz2(e.g.,f(z1,z2)=z1z2,f(z1,z2)=z1,etc.)andβnlisamatrixofnonlineartermsparameters(lookalsoattheExamples). IfIRT.param=TRUE,thentheparametersestimatesforthetwo-parameterlogisticmodel(i.e.,themodelwithonefactor)arereportedundertheusualIRTparameterization,i.e., πi∗ =β1i(z−β0logi).1−πiThelineartwo-factormodelisunidentifiedunderorthogonalrotationsonthefactors’space.To achieveidentifiabilityyoucanfixthevalueofoneloadingusingtheconstraintargument.Theparametersareestimatedbymaximizingtheapproximatemarginallog-likelihoodundertheconditionalindependenceassumption,i.e.,conditionallyonthelatentstructuretheitemsareinde-pendentBernoullivariatesunderthelogitlink.TherequiredintegralsareapproximatedusingtheGauss-Hermiterule.Theoptimizationprocedureusedisahybridalgorithm.TheprocedureinitiallyusesamoderatenumberofEMiterations(seecontrolargumentiter.em)andthenswitchestoquasi-Newton(seecontrolargumentsmethodanditer.qN)iterationsuntilconvergence.Value Anobjectofclassltmwithcomponents,coefficientslog.Likconvergence amatrixwiththeparametervaluesatconvergence.Thesearealwaystheesti-matesofβli,l=0,1,...parameters,evenifIRT.param=TRUE.thelog-likelihoodvalueatconvergence.theconvergenceidentifierreturnedbyoptim(). ltm hessiancountspatterns theapproximateHessianmatrixatconvergencereturnedbyoptim(). 33 thenumberoffunctionandgradientevaluationsusedbythequasi-Newtonal-gorithm. alistwithtwocomponents:(i)X:anumericmatrixthatcontainstheobservedresponsepatterns,and(ii)obs:anumericvectorthatcontainstheobservedfrequenciesforeachobservedresponsepattern. alistwithtwocomponentsusedintheGauss-Hermiterule:(i)Z:anumericmatrixthatcontainstheabscissas,and(ii)GHw:anumericvectorthatcontainsthecorrespondingweights. themaximumabsolutevalueofthescorevectoratconvergence.alistdescribingthelatentstructure.acopyoftheresponsedatamatrix.thevaluesusedinthecontrolargument.thevalueoftheIRT.paramargument. if(!is.null(constraint)),thenitcontainsthevalueoftheconstraintar-gument.thematchedcall. GH max.scltstXcontrolIRT.paramconstraintcallWarning IncasetheHessianmatrixatconvergenceisnotpositivedefinite,trytore-fitthemodel;ltm()willusenewrandomstartingvalues. Theinclusionofnonlinearlatentvariableeffectsproducesmorecomplexlikelihoodsurfaceswhichmightpossessanumberoflocalmaxima.Toensurethatthemaximumlikelihoodvaluehasbeenreachedre-fitthemodelanumberoftimes(simulationsshowedthatusually10timesareadequatetoensureglobalconvergence). ConversionoftheparameterestimatestotheusualIRTparameterizationworksonlyforthetwo-parameterlogisticmodel.Note Inthecaseoftheone-factormodel,theoptimizationalgorithmworksundertheconstraintthatthediscriminationparameterofthefirstitemβ11isalwayspositive.Ifyouwishtochangeitssign,theninthefittedmodel,saym,usem$coef[,2]<--m$coef[,2]. Whenthecoefficients’estimatesarereportedundertheusualIRTparameterization(i.e.,IRT.param=TRUE),theirstandarderrorsarecalculatedusingtheDeltamethod.Author(s) DimitrisRizopoulos 34References Baker,F.andKim,S-H.(2004)ItemResponseTheory,2nded.NewYork:MarcelDekker. ltm Bartholomew,D.andKnott,M.(1999)LatentVariableModelsandFactorAnalysis,2nded.Lon-don:Arnold. Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Moustaki,I.andKnott,M.(2000)Generalizedlatenttraitmodels.Psychometrika,65,391–411.Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/ Rizopoulos,D.andMoustaki,I.(2008)Generalizedlatentvariablemodelswithnonlineareffects.BritishJournalofMathematicalandStatisticalPsychology,61,415–438. SeeAlso coef.ltm,fitted.ltm,summary.ltm,anova.ltm,plot.ltm,vcov.ltm,item.fit,person.fit,margins,factor.scoresExamples ######## Thetwo-parameterlogisticmodelfortheWIRSdatawiththeconstraintthat(i)theeasinessparameterforthe1stitemequals1and(ii)thediscriminationparameterforthe6thitemequals-0.5 ltm(WIRS~z1,constr=rbind(c(1,1,1),c(6,2,-0.5)))##One-factorandaquadraticterm##usingtheMobilitydataltm(Mobility~z1+I(z1^2)) ##Two-factormodelwithaninteractionterm##usingtheWIRSdataltm(WIRS~z1*z2) ##Thetwo-parameterlogisticmodelfortheAbortiondata##with20quadraturepointsand20EMiterations; ##reportresultsundertheusualIRTparameterization ltm(Abortion~z1,control=list(GHk=20,iter.em=20)) margins35 marginsFitofthemodelonthemargins Description Checksthefitonthetwo-andthree-waymarginsforgrm,ltm,raschandtpmobjects.Usage margins(object,...) ##S3methodforclassgpcm margins(object,type=c(\"two-way\\"three-way\"),rule=3.5,...)##S3methodforclassgrm margins(object,type=c(\"two-way\\"three-way\"),rule=3.5,...)##S3methodforclassltm margins(object,type=c(\"two-way\\"three-way\"),rule=3.5, nprint=3,...)##S3methodforclassrasch margins(object,type=c(\"two-way\\"three-way\"),rule=3.5, nprint=3,...)##S3methodforclasstpm margins(object,type=c(\"two-way\\"three-way\"),rule=3.5, nprint=3,...)Arguments objecttyperulenprint...Details Ratherthanlookingatthewholesetofresponsepatterns,wecanlookatthetwo-andthree-waymargins.Fortheformer,weconstructthe2×2contingencytablesobtainedbytakingthevariablestwoatatime.Comparingtheobservedandexpectedtwo-waymarginsisanalogoustocomparingtheobservedandexpectedcorrelationswhenjudgingthefitofafactoranalysismodel.ForBernoulliandOrdinalvariates,thecomparisonismadeusingthesocalledChi-squaredresiduals.Asarule anobjectinheritingeitherfromclassgpcm,classgrm,classltmorclassrasch.thetypeofmarginstobeused.SeeDetailsformoreinfo. theruleofthumbusedindeterminingtheindicativegoodness-of-fit. anumericvaluedeterminingthenumberofmarginswiththelargestChi-squaredresidualstobeprinted;onlyforltmandraschobjects.additionalargument;currentlynoneisused. 36margins ofthumbresidualsgreaterthan3.5areindicativeofpoorfit.Foramorestrictruleofthumbusetheruleargument.Theanalogousprocedureisfollowedforthethree-waymargins. Value Anobjectofeitherclassmargins.ltmifobjectinheritsfromclassltm,classraschorclasstpm,oranobjectofclassmargins.grmifobjectinheritsfromclassgrm,withcomponents,margins formargins.ltmisanarraycontainingthevaluesofchi-squaredresiduals;formargins.gpcmandmargins.grmisalistoflengtheitherthenumberofallpos-siblepairsorallpossibletripletsofitems,containingtheobservedandexpectedfrequencies,thevaluesofchi-squaredresiduals,thevalueofthetotalresidualandthevalueoftheruleofthumbtimestheproductofthenumberofcategoriesoftheitemsunderconsideration.thetypeofmarginsthatwerecalculated. thevalueofthenprintargument;returnedonlyfrommargins.ltm. allpossibletwo-orthree-waycombinationsoftheitems;returnedonlyfrommargins.ltm. thevalueoftheruleargument;returnedonlyfrommargins.ltm.thenumberofitemsinobject;returnedonlyfrommargins.grm.thenamesofitemsinobject;returnedonlyfrommargins.grm.acopyofthematchedcallofobject. typenprintcombsrulenitemsnamescallAuthor(s) DimitrisRizopoulos Bartholomew,D.(1998)Scalingunobservableconstructsinsocialscience.AppliedStatistics,47,1–13. Bartholomew,D.andKnott,M.(1999)LatentVariableModelsandFactorAnalysis,2nded.Lon-don:Arnold. Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/SeeAlso person.fit,item.fit,GoF.rasch, MobilityExamples ##Two-andThree-wayresidualsfortheRaschmodelfit<-rasch(LSAT)margins(fit) margins(fit,\"three\") ##Two-andThree-wayresidualsfortheone-factormodelfit<-ltm(WIRS~z1)margins(fit) margins(fit,\"three\") ##Two-andThree-wayresidualsforthegradedresponsemodelfit<-grm(Science[c(1,3,4,7)])margins(fit) margins(fit,\"three\") 37 MobilityWomen’sMobility Description Aruralsubsampleof8445womenfromtheBangladeshFertilitySurveyof1989.Format Thedimensionofinterestiswomen’smobilityofsocialfreedom.Womenwereaskedwhethertheycouldengageinthefollowingactivitiesalone(1=yes,0=no):Item1Gotoanypartofthevillage/town/city.Item2Gooutsidethevillage/town/city.Item3Talktoamanyoudonotknow.Item4Gotoacinema/culturalshow.Item5Goshopping. Item6Gotoacooperative/mothers’club/otherclub.Item7Attendapoliticalmeeting.Item8Gotoahealthcentre/hospital.Source BangladeshFertilitySurveyof1989(HuqandCleland,1990). 38References mult.choice Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Huq,N.andCleland,J.(1990)BangladeshFertilitySurvey,1989.Dhaka:NationalInstituteofPopulationResearchandTraining(NIPORT).Examples ##DescriptivestatisticsforMobilitydatadescript(Mobility) mult.choiceMultipleChoiceItemstoBinaryResponses Description Itconvertsmultiplechoiceitemstoamatrixofbinaryresponses.Usage mult.choice(data,correct)Arguments datacorrectValue amatrixof0/1valuesindicatingwrong/correctanswers.Author(s) DimitrisRizopoulos dat<-data.frame(It1=sample(4, It2=sample(4,It3=sample(5,It4=sample(5,It5=sample(4,It6=sample(5, dat[]<-lapply(dat,function(x)crct<-c(3,2,5,3,4,5) 100,TRUE),100,TRUE),100,TRUE),100,TRUE),100,TRUE),100,TRUE)) {x[sample(100,4)]<-NA;x}) amatrixoradata.framecontainingthemanifestvariablesascolumns.avectoroflengthncol(data)withthecorrectresponses. person.fit ####################mult.choice(dat,crct) 39 person.fitPerson-FitStatisticsandP-values Description Computationofpersonfitstatisticsforltm,raschandtpmmodels.Usage person.fit(object,alternative=c(\"less\\"greater\\"two.sided\"), resp.patterns=NULL,FUN=NULL,simulate.p.value=FALSE,B=1000)Arguments objectalternativeresp.patternsFUN amodelobjectinheritingeitherfromclassltm,classraschorclasstpm.thealternativehypothesis;seeDetailsformoreinfo. amatrixoradata.frameofresponsepatternswithcolumnsdenotingtheitems;ifNULLthepersonfitstatisticsarecomputedfortheobservedresponsepatterns.afunctionwiththreeargumentscalculatingauser-definedperson-fitstatistic.Thefirstargumentmustbeanumericmatrixof(0,1)responsepatterns.Thesecondargumentmustbeanumericvectoroflengthequaltothenumberofrowsofthefirstargument,providingtheabilityestimatesforeachresponsepattern.Thethirdargumentmustbeanumericmatrixwithnumberofrowsequaltothenumberofitems,providingtheIRTmodelparameters.Forltmandraschobjects,thisshouldbeatwo-columnmatrix,wherethefirstcolumncontainstheeasinessandthesecondonethediscriminationparameters(i.e.,theadditiveparameterizationisassumed,whichhastheformβi0+βi1z,whereβi0istheeasinessandβi1thediscriminationparameterfortheithitem).FortpmobjectsthefirstcolumnofthethirdargumentofFUNshouldcontainthelogit(i.e.,useqlogis())oftheguessingparameters,thesecondcolumntheeasiness,andthethirdcolumnthediscriminationparameters.Thefunctionshouldreturnanumericvectoroflengthequaltothenumberofresponsepatterns,containingthevaluesoftheuser-definedperson-fitstatistics. simulate.p.value logical;ifTRUE,thentheMonteCarloproceduredescribedintheDetailssectionisusedtoapproximatethethedistributionoftheperson-fitstatistic(s)underthenullhypothesis.B thenumberofreplicationsintheMonteCarloprocedure. 40Details person.fit Thestatisticscalculatedbydefault(i.e.,ifFUN=NULL)byperson.fit()aretheL0statisticofLevineandRubin(1979)anditsstandardizedversionLzproposedbyDrasgowetal.(1985).Ifsimulate.p.value=FALSE,thep-valuesarecalculatedfortheLzassumingastandardnormaldistributionforthestatisticunderthenull.Ifsimulate.p.value=TRUE,aMonteCarloprocedureisusedtoapproximatethedistributionoftheperson-fitstatistic(s)underthenullhypothesis.Inparticular,thefollowingstepsarereplicatedBtimesforeachresponsepattern: Step1:Simulateanewabilityestimate,sayz∗,fromanormaldistributionwithmeantheability estimateoftheresponsepatternunderthefittedmodel(i.e.,object),andstandarddeviationthestandarderroroftheabilityestimate,asreturnedbythefactor.scoresfunction.Step2:SimulateanewresponsepatternofdichotomousitemsundertheassumedIRTmodel,using z∗andthemaximumlikelihoodestimatesunderobject.Step4:Forthenewresponsepatternandusingz∗andtheMLEs,computethevaluesoftheperson-fitstatistic.DenotebyTobsthevalueoftheperson-fitstatisticfortheoriginaldata-set.Thenthep-valueisapproximatedaccordingtotheformula B I(Tb≤Tobs)/(1+B),1+ b=1 ifalternative=\"less\", 1+ ifalternative=\"greater\",or 1+ Bb=1 I(Tb≥Tobs)/(1+B), Bb=1 I(|Tb|≥|Tobs|)/(1+B), ifalternative=\"two.sided\",whereTbdenotesthevalueoftheperson-fitstatisticinthebth simulateddata-set,I(.)denotestheindicatorfunction,and|.|denotestheabsolutevalue.FortheLzstatistic,negativevalues(i.e.,alternative=\"less\")indicateresponsepatternsthatareun-likely,giventhemeasurementmodelandtheabilityestimate.Positivevalues(i.e.,alternative=\"greater\")indicatethattheexaminee’sresponsepatternismoreconsistentthantheprobabilisticIRTmodelexpected.Finally,whenalternative=\"two.sided\"boththeabovesettingsarecaptured. Thissimulationschemeexplicitlyaccountsforthefactthatabilityvaluesareestimated,bydrawingfromtheirlargesampledistribution.Strictlyspeaking,drawingz∗fromanormaldistributionisnottheoreticallyappropriate,sincetheposteriordistributionforthelatentabilitiesisnotnormal.However,thenormalityassumptionwillworkreasonablywell,especiallywhenalargenumberofitemsisconsidered.Value AnobjectofclasspersFitisalistwithcomponents, person.fit resp.patternsTobsp.valuesstatisticFUN alternativeBcallAuthor(s) DimitrisRizopoulos theresponsepatternsforwhichthefitstatisticshavebeencomputed.anumericmatrixwithperson-fitstatisticsforeachresponsepattern.anumericmatrixwiththecorrespondingp-values.thevalueofthestatisticargument.thevalueoftheFUNargument. thevalueofthealternativeargument.thevalueoftheBargument.acopyofthematchedcallofobject. 41 Drasgow,F.,Levine,M.andWilliams,E.(1985)Appropriatenessmeasurementwithpolychoto-mousitemresponsemodelsandstandardizedindices.BritishJournalofMathematicalandStatis-ticalPsychology,38,67–86. Levine,M.andRubin,D.(1979)Measuringtheappropriatenessofmultiple-choicetestscores.JournalofEducationalStatistics,4,269–290. Meijer,R.andSijtsma,K.(2001)Methodologyreview:Evaluatingpersonfit.AppliedPsychologi-calMeasurement,25,107–135. Reise,S.(1990)Acomparisonofitem-andperson-fitmethodsofassessingmodel-datafitinIRT.AppliedPsychologicalMeasurement,14,127–137.SeeAlso item.fit,margins,GoF.gpcm,GoF.raschExamples #person-fitstatisticsfortheRaschmodel#fortheAbortiondata-setperson.fit(rasch(Abortion)) #person-fitstatisticsforthetwo-parameterlogisticmodel#fortheLSATdata-set person.fit(ltm(LSAT~z1),simulate.p.value=TRUE,B=100) 42plotdescript plotdescriptDescriptiveStatisticsPlotmethod Description Theplotmethodfordescriptobjectscurrentlyworksfordichotomousresponsepatterns,andproducesthexy-plotofthetotalscoreversustheproportionofcorrectresponsesforeachitem.Usage ##S3methodforclassdescript plot(x,items=NULL,includeFirstLast=FALSE,xlab,ylab,...) Arguments xitems anobjectinheritingfromclassdescript.anumericvectorindicatingwhichitemstoplot. includeFirstLast logical;ifTRUEthefirstandlasttotalscorescategoriesareincluded.xlab,ylab...Author(s) DimitrisRizopoulos descriptExamples ##DescriptivesforWIRSdata:dsc<-descript(WIRS)dsc plot(dsc,includeFirstLast=TRUE,type=\"b\lty=1,pch=1:6) legend(\"topleft\names(WIRS),pch=1:6,col=1:6,lty=1,bty=\"n\") characterstringoranexpression;seetitle.extragraphicalparameterstobepassedtomatplot(). plotfscores43 plotfscoresFactorScores-AbilityEstimatesPlotmethod Description PlotsaKernelDensityEstimationofthedistributionofthefactorscores(i.e.,personparameters).Providesalsotheoptiontoincludeintheplottheitemdifficultyparameters(similartotheItemPersonMaps).Usage ##S3methodforclassfscores plot(x,bw=\"nrd0\adjust=2,kernel=\"gaussian\ include.items=FALSE,tol=0.2,xlab=\"Ability\ylab=\"Density\main=\"KernelDensityEstimationforAbilityEstimates\pch=16,cex=1.5,...)Arguments xanobjectinheritingfromclassfscores.bw,adjust,kernel argumentstodensity(). include.itemslogical;ifTRUEtheitemdifficultyparametersareincludedintheplot.tolthetoleranceusedtogrouptheitemdifficultyparameters,i.e.,wheninclude.items=TRUE thevaluesround(betas/tol)*tolareplotted,wherebetaisthenumericvectorofitemdifficultyparameters. xlab,ylab,main characterstringoranexpression;seetitle. pch,cexargumentstostripchart();usedwheninclude.items=TRUE....extragraphicalparameterstobepassedtoplot.density().Author(s) DimitrisRizopoulos factor.scoresExamples ##FactorScoresforLSATdata:fsc<-factor.scores(rasch(LSAT)) plot(fsc,include.items=TRUE,main=\"KDEforPersonParameters\")legend(\"left\\"itemparameters\pch=16,cex=1.5,bty=\"n\") 44plotIRT plotIRTPlotmethodforfittedIRTmodels Description ProducestheItemCharacteristicorItemInformationCurvesforfittedIRTmodels.Usage ##S3methodforclassgpcm plot(x,type=c(\"ICC\\"IIC\\"OCCu\\"OCCl\"),items=NULL, category=NULL,zrange=c(-3.8,3.8), z=seq(zrange[1],zrange[2],length=100),annot, labels=NULL,legend=FALSE,cx=\"top\cy=NULL,ncol=1,bty=\"n\col=palette(),lty=1,pch,xlab,ylab,main,sub=NULL,cex=par(\"cex\"),cex.lab=par(\"cex.lab\"),cex.main=par(\"cex.main\"),cex.sub=par(\"cex.sub\"),cex.axis=par(\"cex.axis\"),plot=TRUE,...)##S3methodforclassgrm plot(x,type=c(\"ICC\\"IIC\\"OCCu\\"OCCl\"),items=NULL, category=NULL,zrange=c(-3.8,3.8), z=seq(zrange[1],zrange[2],length=100),annot, labels=NULL,legend=FALSE,cx=\"top\cy=NULL,ncol=1,bty=\"n\col=palette(),lty=1,pch,xlab,ylab,main,sub=NULL,cex=par(\"cex\"),cex.lab=par(\"cex.lab\"),cex.main=par(\"cex.main\"),cex.sub=par(\"cex.sub\"),cex.axis=par(\"cex.axis\"),plot=TRUE,...)##S3methodforclassltm plot(x,type=c(\"ICC\\"IIC\\"loadings\"),items=NULL, zrange=c(-3.8,3.8),z=seq(zrange[1],zrange[2],length=100),annot,labels=NULL,legend=FALSE,cx=\"topleft\cy=NULL,ncol=1,bty=\"n\col=palette(),lty=1,pch,xlab,ylab,zlab,main,sub=NULL,cex=par(\"cex\"),cex.lab=par(\"cex.lab\"),cex.main=par(\"cex.main\"),cex.sub=par(\"cex.sub\"),cex.axis=par(\"cex.axis\"),plot=TRUE,...)##S3methodforclassrasch plot(x,type=c(\"ICC\\"IIC\"),items=NULL, zrange=c(-3.8,3.8),z=seq(zrange[1],zrange[2],length=100),annot,labels=NULL,legend=FALSE,cx=\"topleft\cy=NULL,ncol=1,bty=\"n\col=palette(),lty=1,pch,xlab,ylab,main,sub=NULL,cex=par(\"cex\"),cex.lab=par(\"cex.lab\"),cex.main=par(\"cex.main\"),cex.sub=par(\"cex.sub\"),cex.axis=par(\"cex.axis\"),plot=TRUE,...) plotIRT ##S3methodforclasstpm plot(x,type=c(\"ICC\\"IIC\"),items=NULL, zrange=c(-3.8,3.8),z=seq(zrange[1],zrange[2],length=100),annot,labels=NULL,legend=FALSE,cx=\"topleft\cy=NULL, ncol=1,bty=\"n\col=palette(),lty=1,pch,xlab,ylab,main,sub=NULL,cex=par(\"cex\"),cex.lab=par(\"cex.lab\"),cex.main=par(\"cex.main\"),cex.sub=par(\"cex.sub\"),cex.axis=par(\"cex.axis\"),plot=TRUE,...)Arguments xtype 45 anobjectinheritingeitherfromclassgpcm,classgrm,classltm,classraschorclasstpm. thetypeofplot;\"ICC\"referstoItemResponseCategoryCharacteristicCurveswhereas\"IIC\"toItemInformationCurves.Forltmobjectstheoption\"loadings\"isalsoavailablethatproducesthescatterplotofthestandardizedloadings.Forgrmobjectstheoptions\"OCCu\"and\"OCCl\"arealsoavailablethatproducestheitemoperationcharacteristiccurves. anumericvectordenotingwhichitemstoplot;ifNULLallitemsareplotted;if0andtype=\"IIC\"theTestInformationCurveisplotted. ascalarindicatingtheresponsecategoryforwhichthecurvesshouldbeplotted;ifNULLallcategoriesareconsidered.Thisargumentisonlyrelevantforgrmobjects. anumericvectoroflength2indicatingtherangeforthelatentvariablevalues.anumericvectordenotingthevaluesforthelatentvariable(s)valuestobeusedintheplots. logical;ifTRUEtheplottedlinesareannotated. charactervector;thelabelstouseineithertheannotationorlegend.IfNULLadequatelabelsareproduced.logical;ifTRUEalegendisprinted. itemscategory zrangezannotlabelslegend cx,cy,ncol,bty argumentsoflegend;cxandcycorrespondtothexandyargumentsoflegend.col,lty,pch controlvalues,seepar;recyclingisusedifnecessary. xlab,ylab,zlab,main,sub characterstringoranexpression;seetitle.cex,cex.lab,cex.main,cex.sub,cex.axis thecexfamilyofargument;seepar.plot... logical;ifTRUEtheplot(s)is(are)producedotherwiseonlythevaluesusedtocreatetheplot(s)arereturned. extragraphicalparameterstobepassedtoplot(),lines(),legend()andtext(). 46Details plotIRT Itemresponsecategorycharacteristiccurvesshowhowtheprobabilityofrespondinginthekthcategory,ineachitem,changeswiththevaluesofthelatentvariable(ability). Theiteminformationcurvesindicatetherelativeabilityofanitemtodiscriminateamongcontigu-oustraitscoresatvariouslocationsalongthetraitcontinuum.Thetestinformationcurve,whichisthesumofiteminformationcurves,providesavisualdepictionofwherealongthetraitcontinuumatestismostdiscriminating(ReiseandWaller,2002).Value Thevaluesusedtocreatetheplot,i.e.,thex-,y-coordinates.Thisiseitheramatrixoralistinwhichthefirstcolumnorelementprovidesthelatentvariablevaluesused,andtheremainingcolumnsorelementscorrespondtoeitherprobabilitiesorinformationorloadings,dependingonthevalueofthetypeargument.Author(s) DimitrisRizopoulos Reise,S.andWaller,N.(2002)Itemresponsetheoryfordichotomousassessmentdata.InDrasgow,F.andSchmitt,N.,editors,MeasuringandAnalyzingBehaviorinOrganizations.SanFrancisco:Jossey-Bass.SeeAlso information,gpcm,grm,ltm,rasch,tpmExamples #Examplesforplot.grm()fit<-grm(Science[c(1,3,4,7)]) ##ItemResponseCategoryCharacteristicCurvesfor##theSciencedata op<-par(mfrow=c(2,2)) plot(fit,lwd=2,legend=TRUE,ncol=2)#re-setpar()par(op) ##ItemCharacteristicCurvesforthe2ndcategory,##anditems1and3 plot(fit,category=2,items=c(1,3),lwd=2,legend=TRUE,cx=\"right\")##ItemInformationCurvesfortheSciencedata; plot(fit,type=\"IIC\legend=TRUE,cx=\"topright\lwd=2,cex=1.4) plotIRT ##TestInformationFunctionfortheSciencedata;plot(fit,type=\"IIC\items=0,lwd=2) ####################################################Examplesforplot.ltm() ##ItemCharacteristicCurvesforthetwo-parameterlogistic##model;plotonlyitems1,2,4and6;taketherangeofthe##latentabilitytobe(-2.5,2.5):fit<-ltm(WIRS~z1) plot(fit,items=c(1,2,4,6),zrange=c(-2.5,2.5),lwd=3,cex=1.4) ##TestInformationFunctionunderthetwo-parameterlogistic##modelfortheLsatdatafit<-ltm(LSAT~z1) plot(fit,type=\"IIC\items=0,lwd=2,cex.lab=1.2,cex.main=1.3)info<-information(fit,c(-3,0)) text(x=2,y=0.5,labels=paste(\"TotalInformation:\round(info$InfoTotal,3), \"\\n\\nInformationin(-3,0):\round(info$InfoRange,3), paste(\"(\round(100*info$PropRange,2),\"%)\sep=\"\")),cex=1.2)##ItemCharacteristicSurfacesfortheinteractionmodel:fit<-ltm(WIRS~z1*z2) plot(fit,ticktype=\"detailedheta=30,phi=30,expand=0.5,d=2, cex=0.7,col=\"lightblue\")####################################################Examplesforplot.rasch() ##ItemCharacteristicCurvesfortheWIRSdata;##plotonlyitems1,3and5:fit<-rasch(WIRS) plot(fit,items=c(1,3,5),lwd=3,cex=1.4) abline(v=-4:4,h=seq(0,1,0.2),col=\"lightgray\lty=\"dotted\")fit<-rasch(LSAT) ##ItemCharacteristicCurvesfortheLSATdata;##plotallitemsplusalegendanduseonlyblack: plot(fit,legend=TRUE,cx=\"right\lwd=3,cex=1.4, cex.lab=1.6,cex.main=2,col=1,lty=c(1,1,1,2,2),pch=c(16,15,17,0,1)) abline(v=-4:4,h=seq(0,1,0.2),col=\"lightgray\lty=\"dotted\")##ItemInformationCurves,forthefirst3items;includealegend plot(fit,type=\"IIC\items=1:3,legend=TRUE,lwd=2,cx=\"topright\")##TestInformationFunction 47 48 plot(fit,type=\"IIC\items=0,lwd=2,cex.lab=1.1, sub=paste(\"Call:\deparse(fit$call))) ##Totalinformationin(-2,0)basedonalltheitemsinfo.Tot<-information(fit,c(-2,0))$InfoRange##Informationin(-2,0)basedonitems2and4 info.24<-information(fit,c(-2,0),items=c(2,4))$InfoRange text(x=2,y=0.5,labels=paste(\"TotalInformationin(-2,0):\ round(info.Tot,3), \"\\n\\nInformationin(-2,0)basedon\\nItems2and4:\round(info.24,3),paste(\"(\round(100*info.24/info.Tot,2),\"%)\sep=\"\")),cex=1.2)##TheStandardErrorofMeasurementcanbeplottedbyvals<-plot(fit,type=\"IIC\items=0,plot=FALSE) plot(vals[,\"z\"],1/sqrt(vals[,\"info\"]),type=\"l\lwd=2, xlab=\"Ability\ylab=\"StandardError\main=\"StandardErrorofMeasurement\")####################################################Examplesforplot.tpm() ##ComparetheItemCharacteristicCurvesfortheLSATdata, ##undertheconstraintRaschmodel,theunconstraintRaschmodel,##andthethreeparametermodelassumingequaldiscrimination##acrossitems par(mfrow=c(2,2)) pl1<-plot(rasch(LSAT,constr=cbind(length(LSAT)+1,1)))text(2,0.35,\"Raschmodel\\nDiscrimination=1\")pl2<-plot(rasch(LSAT)) text(2,0.35,\"Raschmodel\") pl3<-plot(tpm(LSAT,type=\"rasch\max.guessing=1))text(2,0.35,\"Raschmodel\\nwithGuessingparameter\") ##ComparetheItemCharacteristicCurvesforItem4##(youhavetoruntheabovefirst) plot(range(pl1[,\"z\"]),c(0,1),type=\"n\xlab=\"Ability\ ylab=\"Probability\main=\"ItemCharacteristicCurves-Item4\")lines(pl1[,c(\"z\\"Item4\")],lwd=2,col=\"black\")lines(pl2[,c(\"z\\"Item4\")],lwd=2,col=\"red\")lines(pl3[,c(\"z\\"Item4\")],lwd=2,col=\"blue\") legend(\"right\c(\"RaschmodelDiscrimination=1\\"Raschmodel\ \"Raschmodelwith\\nGuessingparameter\"),lwd=2,col=c(\"black\\"red\\"blue\"),bty=\"n\") rasch raschRaschModel raschDescription FittheRaschmodelundertheItemResponseTheoryapproach.Usage rasch(data,constraint=NULL,IRT.param=TRUE,start.val=NULL, na.action=NULL,control=list(),Hessian=TRUE)Arguments dataconstraint 49 adata.frame(thatwillbeconvertedtoanumericmatrixusingdata.matrix())oranumericmatrixofmanifestvariables. atwo-columnnumericmatrixwithatmostprows(wherepisthenumberofitems),specifyingfixed-valueconstraints.Thefirstcolumnrepresentstheitem(i.e.,1denotesthefirstitem,2thesecond,etc.,andp+1thediscriminationpa-rameter)andthesecondcolumnthevalueatwhichthecorrespondingparametershouldbefixed.SeeExamplesformoreinfo. logical;ifTRUEthenthecoefficients’estimatesarereportedundertheusualIRTparameterization.SeeDetailsformoreinfo. thecharacterstring\"random\"oranumericvectorofp+1startingvalues,wherethefirstpvaluescorrespondtotheeasinessparameterswhilethelastvaluecor-respondstothediscriminationparameter.If\"random\randomstartingvaluesareused.IfNULLstartingvaluesareautomaticallycomputed. thena.actiontobeusedondata.Incaseofmissingdata,ifna.action=NULLthemodelusestheavailablecases,i.e.,ittakesintoaccounttheobservedpartofsampleunitswithmissingvalues(validunderMARmechanismsifthemodeliscorrectlyspecified).Ifyouwanttoapplyacompletecaseanalysisthenusena.action=na.exclude.alistofcontrolvalues, iter.qNthenumberofquasi-Newtoniterations.Default150. GHkthenumberofGauss-Hermitequadraturepoints.Default21. methodtheoptimizationmethodtobeusedinoptim().Default\"BFGS\".verboselogical;ifTRUEinfoabouttheoptimizationprocedureareprinted. IRT.paramstart.val na.action control Hessian logical;ifTRUE,thentheHessianmatrixiscomputed.Warning:settingthisargumenttoFALSEwillcausemanymethods(e.g.,summary())tofail;settingtoFALSEisintendedforsimulationpurposesinorderrasch()torunfaster. Details TheRaschmodelisaspecialcaseoftheunidimensionallatenttraitmodelwhenallthediscrimina-tionparametersareequal.ThismodelwasfirstdiscussedbyRasch(1960)anditismainlyusedineducationaltestingwheretheaimistostudytheabilitiesofaparticularsetofindividuals.Themodelisdefinedasfollows logπi1−πi =βi+βz, 50rasch whereπidenotestheconditionalprobabilityofrespondingcorrectlytotheithitemgivenz,βiistheeasinessparameterfortheithitem,βisthediscriminationparameter(thesameforalltheitems)andzdenotesthelatentability. IfIRT.param=TRUE,thentheparametersestimatesarereportedundertheusualIRTparameteri-zation,i.e., πi∗ log=β(z−βi). 1−πiThefitofthemodelisbasedonapproximatemarginalMaximumLikelihood,usingtheGauss-Hermitequadraturerulefortheapproximationoftherequiredintegrals. Value Anobjectofclassraschwithcomponents,coefficientslog.Likconvergencehessiancountspatterns amatrixwiththeparametervaluesatconvergence.Thesearealwaystheesti-matesofβi,βparameters,evenifIRT.param=TRUE.thelog-likelihoodvalueatconvergence.theconvergenceidentifierreturnedbyoptim(). theapproximateHessianmatrixatconvergencereturnedbyoptim(). thenumberoffunctionandgradientevaluationsusedbythequasi-Newtonal-gorithm. alistwithtwocomponents:(i)X:anumericmatrixthatcontainstheobservedresponsepatterns,and(ii)obs:anumericvectorthatcontainstheobservedfrequenciesforeachobservedresponsepattern. alistwithtwocomponentsusedintheGauss-Hermiterule:(i)Z:anumericmatrixthatcontainstheabscissas,and(ii)GHw:anumericvectorthatcontainsthecorrespondingweights. themaximumabsolutevalueofthescorevectoratconvergence.thevalueoftheconstraintargument.thevalueoftheIRT.paramargument.acopyoftheresponsedatamatrix.thevaluesusedinthecontrolargument.thevalueofthena.actionargument.thematchedcall. GH max.scconstraintIRT.paramXcontrolna.actioncallWarning IncasetheHessianmatrixatconvergenceisnotpositivedefinite,trytore-fitthemodelusingrasch(...,start.val=\"random\"). raschNote 51 AlthoughthecommonformulationoftheRaschmodelassumesthatthediscriminationparameterisfixedto1,rasch()estimatesit.Ifyouwishtofittheconstrainedversionofthemodel,usetheconstraintargumentaccordingly.SeeExamplesformoreinfo. Theoptimizationalgorithmworksundertheconstraintthatthediscriminationparameterβisalwayspositive. Whenthecoefficients’estimatesarereportedundertheusualIRTparameterization(i.e.,IRT.param=TRUE),theirstandarderrorsarecalculatedusingtheDeltamethod.Author(s) DimitrisRizopoulos Baker,F.andKim,S-H.(2004)ItemResponseTheory,2nded.NewYork:MarcelDekker.Rasch,G.(1960)ProbabilisticModelsforSomeIntelligenceandAttainmentTests.Copenhagen:PaedagogiskeInstitute. Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/SeeAlso coef.rasch,fitted.rasch,summary.rasch,anova.rasch,plot.rasch,vcov.rasch,GoF.rasch,item.fit,person.fit,margins,factor.scoresExamples ##ThecommonformoftheRaschmodelforthe##LSATdata,assumingthatthediscrimination##parameterequals1 rasch(LSAT,constraint=cbind(ncol(LSAT)+1,1))##TheRaschmodelfortheLSATdataunderthe ##normalogive;todothatfixthediscrimination##parameterto1.702 rasch(LSAT,constraint=cbind(ncol(LSAT)+1,1.702))##TheRaschmodelfortheLSATdatawith##unconstraintdiscriminationparameterrasch(LSAT) ##TheRaschmodelwith(artificiallycreated)##missingdatadata<-LSAT data[]<-lapply(data,function(x){ x[sample(1:length(x),sample(15,1))]<-NA 52 x rcor.test }) rasch(data) rcor.testPairwiseAssociationsbetweenItemsusingaCorrelationCoefficient Description ComputesandteststhepairwiseassociationsbetweenitemsusingacorrelationcoefficientUsage rcor.test(mat,p.adjust=FALSE,p.adjust.method=\"holm\...)Arguments matp.adjustp.adjust.method themethodargumentofp.adjust(). ...Value Anobjectofclassrcor.testwithcomponents,cor.matp.values thecorrelationmatrix. athreecolumnnumericmatrixcontainingthep-valuesforallthecombinationsofitems. extraargumentspassedtocor()andcor.test(). anumericmatrixoranumericdata.framecontainingthemanifestvariablesascolumns. logical;ifTRUEthep-valuesareadjustedformultiplecomparisons. Theprintmethodforclassrcor.testreturnsasquarematrixinwhichtheupperdiagonalpartcontainstheestimatesofthecorrelationcoefficients,andthelowerdiagonalpartcontainsthecor-respondingp-values.Note rcor.test()ismoreappropriateforinformaltestingofassociationbetweenpolytomousitems.Author(s) DimitrisRizopoulos residualsExamples ##pairwiseassociationsforEnvironmentdata: rcor.test(data.matrix(Environment),method=\"kendall\") ##pairwiseassociationsforindependentnormalrandomvariates: mat<-matrix(rnorm(1000),100,10,dimnames=list(NULL,LETTERS[1:10]))rcor.test(mat) rcor.test(mat,method=\"kendall\")rcor.test(mat,method=\"spearman\") 53 residualsResidualsforIRTmodels Description Computestheresidualsforvectorsofresponsepatterns.Usage ##S3methodforclassgpcm residuals(object,resp.patterns=NULL,order=TRUE,...)##S3methodforclassgrm residuals(object,resp.patterns=NULL,order=TRUE,...)##S3methodforclassltm residuals(object,resp.patterns=NULL,order=TRUE,...)##S3methodforclassrasch residuals(object,resp.patterns=NULL,order=TRUE,...)##S3methodforclasstpm residuals(object,resp.patterns=NULL,order=TRUE,...)Arguments objectresp.patterns anobjectinheritingeitherfromclassgpcm,classgrm,classltm,classraschorclasstpm. amatrixoradata.frameofresponsepatternswithcolumnsdenotingtheitems;ifNULLtheexpectedfrequenciesarecomputedfortheobservedresponsepatterns. logical;ifTRUEtheresponsepatternsaresortedaccordingtotheresidualesti-mates. additionalarguments;currentlynoneisused. order... 54Details Thefollowingresidualsarecomputed: Oi−Ei√,Ei rmvlogis whereOiandEidenotetheobservedandexpectedfrequenciesfortheithresponsepattern.Value Anumericmatrixcontainingtheobservedandexpectedfrequenciesaswellastheresidualvalueforeachresponsepattern.Author(s) DimitrisRizopoulos fitted.gpcm,fitted.grm,fitted.ltm,fitted.rasch,fitted.tpmExamples fit<-ltm(LSAT~z1)residuals(fit) residuals(fit,order=FALSE) rmvlogis GenerateRandomResponsesPatternsunderDichotomousandPoly-tomousIRTmodels Description ProducesBernoulliorMultinomialrandomvariatesundertheRasch,thetwo-parameterlogistic,thethreeparameter,thegradedresponse,andthegeneralizedpartialcreditmodels.Usage rmvlogis(n,thetas,IRT=TRUE,link=c(\"logit\\"probit\"), distr=c(\"normal\\"logistic\\"log-normal\\"uniform\"),z.vals=NULL)rmvordlogis(n,thetas,IRT=TRUE,model=c(\"gpcm\\"grm\"), link=c(\"logit\\"probit\"), distr=c(\"normal\\"logistic\\"log-normal\\"uniform\"),z.vals=NULL) rmvlogisArguments nthetas ascalarindicatingthenumberofresponsepatternstosimulate. 55 forrmvlogis()anumericmatrixwithrowsrepresentingtheitemsandcolumnstheparameters.Forrmvordlogis()alistwithnumericvectorelements,withfirstthethresholdparametersandlastthediscriminationparameter.SeeDetailsformoreinfo. logical;ifTRUEthetasareundertheIRTparameterization.SeeDetailsformoreinfo. fromwhichmodeltosimulate. acharacterstringindicatingthelinkfunctiontouse.Optionsarelogitandprobit.acharacterstringindicatingthedistributionofthelatentvariable.OptionsareNormal,Logistic,log-Normal,andUniform. anumericvectoroflengthnprovidingthevaluesofthelatentvariable(ability)tobeusedinthesimulationofthedichotomousresponses;ifspecifiedthevalueofdistrisignored. IRTmodellinkdistrz.vals Details Thebinaryvariatescanbesimulatedunderthefollowingparameterizationsfortheprobabilityofcorrectlyrespondingintheithitem.IfIRT=TRUE πi=ci+(1−ci)g(β2i(z−β1i)), whereasifIRT=FALSE πi=ci+(1−ci)g(β1i+β2iz), zdenotesthelatentvariable,β1iandβ2iarethefirstandsecondcolumnsofthetas,respectively,andg()isthelinkfunction.Ifthetasisathree-columnmatrixthenthethirdcolumnshouldcontaintheguessingparametersci’s. Theordinalvariatesaresimulatedaccordingtothegeneralizedpartialcreditmodelorthegradedresponsemodeldependingonthevalueofthemodelargument.Checkgpcmandgrmtoseehowthesemodelsaredefined,underbothparameterizations.Value anumericmatrixwithnrowsandcolumnsthenumberofitems,containingthesimulatedbinaryorordinalvariates.Note Foroptionsdistr=\"logistic\",distr=\"log-normal\"anddistr=\"uniform\"thesimulatedrandomvariatesforzsimulatedundertheLogisticdistributionwithlocation=0andscale=1,thelog-Normaldistributionwithmeanlog=0andsdlog=1andtheUniformdistributionwithmin=-3.5andmax=3.5,respectively.Then,thesimulatedzvariatesarestandardized,usingthetheoreticalmeanandvarianceoftheLogistic,log-NormalandUniformdistribution,respectively. 56Author(s) DimitrisRizopoulos gpcm,grm,ltm,rasch,tpmExamples #10responsepatternsunderaRaschmodel#with5items rmvlogis(10,cbind(seq(-2,2,1),1)) #10responsepatternsunderaGPCMmodel#with5items,with3categorieseach thetas<-lapply(1:5,function(u)c(seq(-1,1,len=2),1.2))rmvordlogis(10,thetas) Science ScienceAttitudetoScienceandTechnology Description ThisdatasetcomesfromtheConsumerProtectionandPerceptionsofScienceandTechnologysectionofthe1992Euro-BarometerSurvey(KarlheinzandMelich,1992)basedonasamplefromGreatBritain.Thequestionsaskedaregivenbelow:Format Allofthebelowitemsweremeasuredonafour-groupscalewithresponsecategories\"stronglydisagree\\"disagreetosomeextent\\"agreetosomeextent\"and\"stronglyagree\": ComfortScienceandtechnologyaremakingourliveshealthier,easierandmorecomfortable.EnvironmentScientificandtechnologicalresearchcannotplayanimportantroleinprotectingthe environmentandrepairingit.WorkTheapplicationofscienceandnewtechnologywillmakeworkmoreinteresting. FutureThankstoscienceandtechnology,therewillbemoreopportunitiesforthefuturegenera-tions.TechnologyNewtechnologydoesnotdependonbasicscientificresearch. IndustryScientificandtechnologicalresearchdonotplayanimportantroleinindustrialdevelop-ment.BenefitThebenefitsofsciencearegreaterthananyharmfuleffectitmayhave. summaryReferences 57 Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall. Karlheinz,R.andMelich,A.(1992)Euro-Barometer38.1:ConsumerProtectionandPerceptionsofScienceandTechnology.INRA(Europe),Brussels.[computerfile]Examples ##DescriptivestatisticsforSciencedatadescript(Science) summarySummarymethodforfittedIRTmodels Description Summarizesthefitofeithergrm,ltm,raschortpmobjects.Usage ##S3methodforclassgpcm summary(object,robust.se=FALSE,...)##S3methodforclassgrmsummary(object,...) ##S3methodforclassltm summary(object,robust.se=FALSE,...)##S3methodforclassrasch summary(object,robust.se=FALSE,...)##S3methodforclasstpmsummary(object,...)Arguments objectrobust.se... anobjectinheritingfromeitherclassgpcm,eitherclassgrm,classltm,classraschorclasstpm. logical;ifTRUErobustestimationofstandarderrorsisused,basedonthesand-wichestimator. additionalargument;currentlynoneisused. 58Value summary Anobjectofeitherclasssumm.gpcm,classsumm.grm,classsumm.ltmorclasssumm.raschwithcomponents,coefficientsVar.betaslogLikAICBICmax.scconvcountscallltn.structcontrolnitemsNote Fortheparametersthathavebeenconstrained,thestandarderrorsandz-valuesareprintedasNA.Whenthecoefficients’estimatesarereportedundertheusualIRTparameterization(i.e.,IRT.param=TRUEinthecallofeithergrm,ltmorrasch),theirstandarderrorsarecalculatedusingtheDeltamethod.Author(s) DimitrisRizopoulos gpcm,grm,ltm,rasch,tpmExamples #useHessian=TRUEifyouwantstandarderrorsfit<-grm(Science[c(1,3,4,7)],Hessian=TRUE)summary(fit) ##OnefactormodelusingtheWIRSdata;##resultsarereportedundertheIRT##parameterizationfit<-ltm(WIRS~z1)summary(fit) theestimatedcoefficients’table. theapproximatecovariancematrixfortheestimatedparameters;returnedonlyinsumm.ltmandsumm.rasch.thelog-likelihoodofobject.theAICforobject.theBICforobject. themaximumabsolutevalueofthescorevectoratconvergence.theconvergenceidentifierreturnedbyoptim().thecountsargumentreturnedbyoptim().thematchedcallofobject. acharactervectordescribingthelatentstructureusedinobject;returnedonlyinsumm.ltm. thevaluesusedinthecontrolargumentinthefitofobject. thenumberofitemsinthedataset;returnedonlyinsumm.ltmandsumm.rasch. testEquatingData59 testEquatingDataPreparesDataforTestEquating Description Testequatingbycommonitems.Usage testEquatingData(DataList,AnchoringItems=NULL)Arguments DataList alistofdata.framesormatricescontainingcommonanduniqueitemsbe-tweenseveralforms. AnchoringItemsadata.frameoramatrixcontaininganchoringitemsforacrosssampleequat-ing.Details Thepurposeofthisfunctionistocombineitemsfromdifferentforms.Twocasesareconsid-ered.AlternateFormEquating(wherecommonanduniqueitemsareanalyzedsimultaneously)andAcrossSampleEquating(wheredifferentsetsofuniqueitemsareanalyzedseparatelybasedonpreviouslycalibratedanchoritems).Value Amatrixcontainingthecommonanduniqueitems.Author(s) DimitrisRizopoulos Yu,C.-H.andOsbornPopp,S.(2005)Testequatingbycommonitemsandcommonsubjects:conceptsandapplications.PracticalAssessmentResearchandEvaluation,10(4),1–19.URLhttp://pareonline.net/getvn.asp?v=10&n=4 Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/ 60Examples #Lettwodata-setswithcommonanduniqueitems dat1<-as.data.frame(rmvlogis(20,cbind(c(-2,1,2,1),1)))names(dat1)<-c(\"CIt2\\"CIt3\\"CIt4\\"W\") dat2<-as.data.frame(rmvlogis(10,cbind(c(-2,-1,1,2,0.95),1)))names(dat2)<-c(\"CIt1\\"CIt2\\"CIt3\\"CIt4\\"K\")#combineinonedata-setbylisForms<-list(dat1,dat2)testEquatingData(lisForms) tpm tpmBirnbaum’sThreeParameterModel Description FitBirnbaum’sthreeparametermodelundertheItemResponseTheoryapproach.Usage tpm(data,type=c(\"latent.trait\\"rasch\"),constraint=NULL, max.guessing=1,IRT.param=TRUE,start.val=NULL,na.action=NULL,control=list())Arguments datatype adata.frame(thatwillbeconvertedtoanumericmatrixusingdata.matrix())oranumericmatrixofmanifestvariables. acharacterstringindicatingthetypeofmodeltofit.Availableoptionsare‘rasch’thatassumesequaldiscriminationparameteramongitems,and‘latent.trait’(default)thatassumesadifferentdiscriminationparameterperitem. athree-columnnumericmatrixspecifyingfixed-valueconstraints.Thefirstcol-umnrepresentstheitem(i.e.,1denotesthefirstitem,2thesecond,etc.);thesecondcolumndenotesthetypeofparametertofixfortheitemspecifiedinthefirstcolumn(i.e.,1denotestheguessingparameters,2theeasinessparameters,and3thediscriminationparameters);thethirdcolumnspecifiesthevalueatwhichthecorrespondingparametershouldbefixed.SeeExamplesformoreinfo. ascalarbetween0and1denotingtheupperboundfortheguessingparameters.logical;ifTRUEthenthecoefficients’estimatesarereportedundertheusualIRTparameterization.SeeDetailsformoreinfo. constraint max.guessingIRT.param tpm start.val 61 thecharacterstring\"random\"oranumericmatrixsupplyingstartingvalueswithprowsand3columns,withpdenotingthenumberofitems.IfNULLstartingvaluesareautomaticallycomputed.If\"random\randomstartingvaluesareused.Ifamatrix,thenthefirstcolumnshouldcontaintheguessingparameter,thesecondβ1i,andthethirdβ2i(seeDetails).Iftype==\"rasch\",thenthethirdshouldcontainthesamenumberptimes. thena.actiontobeusedondata.Incaseofmissingdata,ifna.action=NULLthemodelusestheavailablecases,i.e.,ittakesintoaccounttheobservedpartofsampleunitswithmissingvalues(validunderMARmechanismsifthemodeliscorrectlyspecified).Ifyouwanttoapplyacompletecaseanalysisthenusena.action=na.exclude.alistofcontrolvalueswithelements, optimizeracharacterstringdenotingtheoptimizertouse,either\"optim\"(de-fault)or\"nlminb\". iter.qNscalardenotingthenumberofiterationsintheoptimizationprocedure. Foroptim()thisispassedtothecontrolargument‘maxit’,whereasfornlminb()thisispassedtobothcontrolarguments‘iter.max’and‘eval.max’.Default1000. GHkscalardenotingthenumberofGauss-Hermitequadraturepoints.Default 21. methodacharacterstringdenotingtheoptimizationmethodtobeusedinoptim(). Default\"BFGS\". verboselogical;ifTRUEinfoabouttheoptimizationprocedureareprinted.eps.hessianthestep-lengthtouseinthecentraldifferenceapproximationthat approximatesthehessian.Defaultis1e-03. parscaleascalingnumericvectoroflengthequaltotheparameterstobees-timated(takingintoaccountanyconstraints).Thisispassedtoeithertothe‘parscale’controlargumentofoptim()ortothe‘scale’argumentofnlminb().Defaultis0.5fortheguessingparametersand1forthediscrim-inationandeasinessparameters. na.action control Details Birnbaum’sthreeparametermodelisusuallyemployedtohandlethephenomenonofnon-randomguessinginthecaseofdifficultitems.Themodelisdefinedasfollows πi=ci+(1−ci) exp(β1i+β2iz) , 1+exp(β1i+β2iz) whereπidenotestheconditionalprobabilityofrespondingcorrectlytotheithitemgivenz,cidenotestheguessingparameter,β1iistheeasinessparameter,β2iisthediscriminationparameter,andzdenotesthelatentability.Incasetype=\"rasch\",β2iisassumedequalforallitems.IfIRT.param=TRUE,thentheparametersestimatesarereportedundertheusualIRTparameteri-zation,i.e., ∗ exp[β2i(z−β1i)]πi=ci+(1−ci)∗)].1+exp[β2i(z−β1i 62tpm ThefitofthemodelisbasedonapproximatemarginalMaximumLikelihood,usingtheGauss-Hermitequadraturerulefortheapproximationoftherequiredintegrals. Value Anobjectofclasstpmwithcomponents,coefficientslog.Likconvergencehessiancountspatterns amatrixwiththeparametervaluesatconvergence.Thesearealwaystheesti-matesofβi,βparameters,evenifIRT.param=TRUE.thelog-likelihoodvalueatconvergence.theconvergenceidentifierreturnedbyoptim(). theapproximateHessianmatrixatconvergenceobtainedusingacentraldiffer-enceapproximation. thenumberoffunctionandgradientevaluationsusedbytheoptimizationalgo-rithm. alistwithtwocomponents:(i)X:anumericmatrixthatcontainstheobservedresponsepatterns,and(ii)obs:anumericvectorthatcontainstheobservedfrequenciesforeachobservedresponsepattern. alistwithtwocomponentsusedintheGauss-Hermiterule:(i)Z:anumericmatrixthatcontainstheabscissas,and(ii)GHw:anumericvectorthatcontainsthecorrespondingweights. themaximumabsolutevalueofthescorevectoratconvergence.thevalueofthetypeargument.thevalueoftheconstraintargument.thevalueofthemax.guessingargument.thevalueoftheIRT.paramargument.acopyoftheresponsedatamatrix.thevaluesusedinthecontrolargument.thevalueofthena.actionargument.thematchedcall. GH max.sctypeconstraintmax.guessingIRT.paramXcontrolna.actioncallWarning Thethreeparametermodelisknowntohavenumericalproblemslikenon-convergenceorconver-genceontheboundary,especiallyfortheguessingparameters.Theseproblemsusuallyresultinazeroestimateforsomeguessingparametersand/orinanonpositivedefiniteHessianmatrixorinahighabsolutevalueforthescorevector(returnedbythesummarymethod)atconvergence.Incaseofestimatesontheboundary,theconstraintargumentcanbeusedtosettheguessingparame-ter(s)fortheproblematicitem(s)tozero.Inaddition,tpm()hasanumberofcontrolparametersthatcanbetunedinordertoobtainsuccessfulconvergence;themostimportantofthesearethestartingvalues,theparameterscalingvectorandtheoptimizer.Author(s) DimitrisRizopoulos unidimTestReferences Baker,F.andKim,S-H.(2004)ItemResponseTheory,2nded.NewYork:MarcelDekker. 63 Birnbaum,A.(1968).Somelatenttraitmodelsandtheiruseininferringanexaminee’sability.InF.M.LordandM.R.Novick(Eds.),StatisticalTheoriesofMentalTestScores,397–479.Reading,MA:Addison-Wesley. Rizopoulos,D.(2006)ltm:AnRpackageforlatentvariablemodellinganditemresponsetheoryanalyses.JournalofStatisticalSoftware,17(5),1–25.URLhttp://www.jstatsoft.org/v17/i05/SeeAlso coef.tpm,fitted.tpm,summary.tpm,anova.tpm,plot.tpm,vcov.tpm,item.fit,person.fit,margins,factor.scoresExamples #thethreeparametermodeltpm(LSAT) #usenlminbasoptimizer tpm(LSAT,control=list(optimizer=\"nlminb\")) #thethreeparametermodelwithequal#discriminationparameteracrossitems #fixtheguessingparameterforthethirditemtozerotpm(LSAT,type=\"rasch\constraint=cbind(3,1,0))#thethreeparametermodelfortheAbortiondatafit<-tpm(Abortion)fit #theguessingparameterestimatesforitems1,3,and4seemtobeon#theboundary;updatethefitbyfixingthemtozeroupdate(fit,constraint=cbind(c(1,3,4),1,0)) unidimTestUnidimensionalityCheckusingModifiedParallelAnalysis Description Anempiricalcheckfortheunidimensionalityassumptionforltm,raschandtpmmodels. 64Usage unidimTest(object,data,thetas,IRT=TRUE,z.vals=NULL, B=100,...)Arguments object unidimTest amodelobjectinheritingeitherfromclassltm,classraschorclasstpm.Forltm()itisassumedthatthetwo-parameterlogisticmodelhasbeenfitted(i.e.,onelatentvariableandnononlinearterms);seeNoteforanextraoption.amatrixoradata.frameofresponsepatternswithcolumnsdenotingtheitems;usedifobjectismissing. anumericmatrixwithIRTmodelparametervaluestobeusedinrmvlogis;usedifobjectismissing. logical,ifTRUE,thenargumentthetascontainsthemeasurementmodelparam-etersundertheusualIRTparameterization(seermvlogis);usedifobjectismissing. anumericvectoroflengthequaltothenumberofrowsofdata,providingabilityestimates.Ifobjectissuppliedthentheabilitiesareestimatedusingfactor.scores.IfNULL,theabilitiesaresimulatedfromastandardnormaldistribution. thenumberofsamplesfortheMonteCarloproceduretoapproximatethedistri-butionofthestatisticunderthenullhypothesis.extraargumentstopolycor(). datathetasIRT z.vals B...Details ThisfunctionimplementstheprocedureproposedbyDrasgowandLissak(1983)forexaminingthelatentdimensionalityofdichotomouslyscoreditemresponses.Thestatisticusedfortestingunidimensionalityisthesecondeigenvalueofthetetrachoriccorrelationsmatrixofthedichotomousitems.Thetetrachoriccorrelationsbetweenarecomputedusingfunctionpolycor()frompackage‘polycor’,andthelargestoneistakenascommunalityestimate. AMonteCarloprocedureisusedtoapproximatethedistributionofthisstatisticunderthenullhypothesis.Inparticular,thefollowingstepsarereplicatedBtimes: Step1:Ifobjectissupplied,thensimulatenewabilityestimates,sayz∗,fromanormaldistri-butionwithmeantheabilityestimateszˆintheoriginaldata-set,andstandarddeviationthestandarderrorofzˆ(inthiscasethez.valsargumentisignored).Ifobjectisnotsuppliedandthez.valsargumenthasbeenspecified,thensetz∗=z.vals.Finally,ifobjectisnotsuppliedandthez.valsargumenthasnotbeenspecified,thensimulatez∗fromastandardnormaldistribution.Step2:Simulateanewdata-setofdichotomousresponses,usingz∗,andparameterstheestimated parametersextractedfromobject(ifitissupplied)ortheparametersgiveninthethetasargument.Step3:Forthenewdata-setsimulatedinStep2,computethetetrachoriccorrelationsmatrixand takethelargestcorrelationsascommunalities.Forthismatrixcomputetheeigenvalues. unidimTest65 DenotebyTobsthevalueofthestatistic(i.e.,thesecondfortheoriginaleigenvalue)data-set.ThenB thep-valueisapproximatedaccordingtotheformula1+b=1I(Tb≥Tobs)/(1+B),whereI(.)denotestheindicatorfunction,andTbdenotesthevalueofthestatisticinthebthdata-set.Value AnobjectofclassunidimTestisalistwithcomponents,TobsTbootp.valuecallNote Forltmobjectsyoucanalsousealikelihoodratiotesttocheckunidimensionality.Inparticular,fit0<-ltm(data~z1);fit1<-ltm(data~z1+z2);anova(fit0,fit1).Author(s) DimitrisRizopoulos Drasgow,F.andLissak,R.(1983)Modifiedparallelanalysis:aprocedureforexaminingthelatentdimensionalityofdichotomouslyscoreditemresponses.JournalofAppliedPsychology,68,363–373.SeeAlso descriptExamples ##Notrun: #UnidimensionalityCheckfortheLSATdata-set#underaRaschmodel: out<-unidimTest(rasch(LSAT))out plot(out,type=\"b\pch=1:2) legend(\"topright\c(\"RealData\\"AverageSimulatedData\"),lty=1, pch=1:2,col=1:2,bty=\"n\")##End(Notrun) anumericvectoroftheeigenvaluesfortheobserveddata-set.anumericmatrixoftheeigenvaluesforeachsimulateddata-set.thep-value. acopyofthematchedcallofobjectifthatwassupplied. 66vcov vcovvcovmethodforfittedIRTmodels Description Extractstheasymptoticvariance-covariancematrixoftheMLEsfromeithergpcm,grm,ltm,raschortpmobjects.Usage ##S3methodforclassgpcmvcov(object,robust=FALSE,...)##S3methodforclassgrmvcov(object,...) ##S3methodforclassltm vcov(object,robust=FALSE,...)##S3methodforclassraschvcov(object,robust=FALSE,...)##S3methodforclasstpmvcov(object,...)Arguments objectrobust...Value anumericmatrixrepresentingtheestimatedcovariancematrixofthemaximumlikelihoodesti-mates.Notethatthiscovariancematrixisfortheparameterestimatesundertheadditiveparame-terizationandnotundertheusualIRTparameterization;formoreinfochecktheDetailssectionofgrm,ltm,rasch,andtpm.Author(s) DimitrisRizopoulos gpcm,grm,ltm,rasch,tpm anobjectinheritingfromeitherclassgpcm,classgrm,classltm,classraschorclasstpm. logical;ifTRUEthesandwichestimatorisused.additionalarguments;currentlynoneisused. WIRSExamples fit<-rasch(WIRS)vcov(fit) sqrt(diag(vcov(fit)))#standarderrorsunderadditiveparameterization 67 WIRSWorkplaceIndustrialRelationSurveyData Description Thesedataweretakenfromasectionofthe1990WorkplaceIndustrialRelationSurvey(WIRS)dealingwithmanagement/workerconsultationinfirms.Thequestionsaskedaregivenbelow:Format Pleaseconsiderthemostrecentchangeinvolvingtheintroductionofthenewplant,machineryandequipment.Werediscussionsorconsultationsofanyofthetypeonthiscardheldeitherabouttheintroductionofthechangeoraboutthewayitwastobeimplemented.Item1Informaldiscussionwithindividualworkers.Item2Meetingwithgroupsofworkers. Item3Discussionsinestablishedjointconsultativecommittee. Item4Discussionsinspeciallyconstitutedcommitteetoconsiderthechange.Item5Discussionswiththeunionrepresentativesattheestablishment.Item6Discussionswithpaidunionofficialsfromoutside.Source TheWIRSsurveyscanbefoundathttp://www.niesr.ac.uk/niesr/wers98/.References Bartholomew,D.(1998)Scalingunobservableconstructsinsocialscience.AppliedStatistics,47,1–13. Bartholomew,D.,Steel,F.,Moustaki,I.andGalbraith,J.(2002)TheAnalysisandInterpretationofMultivariateDataforSocialScientists.London:ChapmanandHall.Examples ##DescriptivestatisticsforWirsdatadescript(WIRS) Index ∗Topicdatasets AbortionEnvironment,3 gh,13LSAT,19Mobility,30ScienceWIRS,67,,5637∗Topicmethods anovacoef,factor.scores,8 4fitted,14margins,17plotplotdescript,35 ,42plotfscores,43residualsIRT,44summaryvcov,66 ,57,53∗Topicmultivariate biserial.corcronbach.alpha,7descriptGoF,,10gpcm,1911grm,21information,24 item.fitltm,,27ltm-package,31 28mult.choice,2person.fit,38raschrcor.test,48 ,39rmvlogis,52testEquatingData,54 tpmunidimTest,60 ,59,63 ∗Topicpackage ltm-package,2∗Topicregression gpcmgrm,21ltm,24rasch,31tpm,60,48Abortionanova,3anova.gpcm,4 anova.grm,23anova.ltm,26anova.rasch,34anova.tpm,63,51biserial.cor,7coefcoef.gpcm,8 coef.grm,23coef.ltm,26coef.rasch,34coef.tpm,51cronbach.alpha,63 ,10descript,11,42,65Environmentexpression,,4212,,4313,45 factor.scores,14,23,26,34,40,43,51,63, 64 fittedfitted.gpcm,17 fitted.grmfitted.ltm,,2623,54fitted.rasch,34,,5454fitted.tpm,54,51,63 ,5468 INDEX ghGoF,19GoF.gpcm,19 GoF.rasch,6gpcmgrm,,66,,99,,,,23,29,4116166,,,292420,,,36,41,51 4621,,5546,,5655,,5856,,6658,66informationitem.fit,20,,2728,,46 34,36,41,51,63legendLSATltmltm-package,,630 ,45,9,16,23,2 ,31,46,56,58,66marginsMobility,20,23,26,29,34,35,41,51,63mult.choice,37,38 parperson.fit,45 plot,20,29,34,36,39,51,63plotdescript,42plotfscoresplot.descriptIRT,44 ,43plot.descript,plot.fscores(13 plotdescriptplot.fscores,),42plot.gpcm(16 plotfscores),43plot.gpcm,23,27 plot.grmplot.grm,26(plot,IRT),44plot.ltm(plot27 IRT),44plot.ltm,plot.rasch(27plot,34 IRT),plot.rasch,plot.tpm(2744plot,51 IRT),44plot.tpm,(63 plotIRT),44 raschrcor.test,6,9,16,20,23,46,48residuals,52,56,58,66residuals.gpcm,53 residuals.grm,18residuals.ltm,18residuals.rasch,18residuals.tpm,18rmvlogis,18rmvordlogis,54,(64 rmvlogis),54 69 Sciencesummary,56summary.gpcm,57 summary.grm,23summary.ltm,26summary.rasch,34summary.tpm,63 ,51testEquatingDatatitletpm,6,,42,599,,1643,,4645 ,56,58,60,66unidimTest,13,63vcovvcov.gpcm,66 vcov.grm,23vcov.ltm,vcov.rasch,2634vcov.tpm,63,51WIRS,67 因篇幅问题不能全部显示,请点此查看更多更全内容