
useDynLib(TAM)


######################################################
############### IMPORTS ##############################



#***************************************************
#*************** R Basics / Linking To *************

import(graphics)
importFrom(Rcpp, evalCpp)
import(stats)
importFrom(utils, flush.console)
importFrom(utils, packageDescription)
importFrom(utils, sessionInfo)



#***************************************************
#************** Depends ****************************

import(CDM)
import(MASS)



#***************************************************
#************** Imports ****************************

importFrom(GPArotation, oblimin)
import(lavaan)
importFrom(lattice, xyplot)
importFrom(msm, dtnorm)
importFrom(msm, rtnorm)
importFrom(mvtnorm, dmvnorm)
importFrom(mvtnorm, pmvnorm)
importFrom(mvtnorm, rmvnorm)
importFrom(plyr, ldply)
importFrom(psych, schmid)
importFrom(sfsmisc, QUnif)
import(tensor)
importFrom(WrightMap, wrightMap)




########################################################
################  EXPORTS ##############################

export(designMatrices, .A.matrix, designMatrices.mfr,
       tam.fit, 
       tam.jml,
       tam.mml.fit , 
       tam.jml.WLE, 
       tam.jml2, 
       tam.pv, 
       tam, tam.mml, tam.mml.2pl, tam.mml.mfr, 
       tam.se, tam.wle , .A.PCM2 , .A.PCM3 , 
       tam.threshold , tam ,
       tam.ctt , tam.mml.wle , tam.mml.wle2 ,
       tam.ctt2 , tam.fa ,
       plotDevianceTAM , tam.ctt3 , tam.mml.3pl ,
       designMatrices.mfr2 ,
       tam.modelfit ,
       plotctt ,
       lavaanify.IRT ,
       tamaan , 
       tamaanify ,
       doparse,
       tampv2datalist,
       tam.latreg ,
       cfa.extract.itempars,
       IRTLikelihood.cfa ,
       tam.modelfit.IRT ,
       tam.modelfit.args ,
       msq.itemfit ,
       IRT.linearCFA ,
       IRT.threshold ,
       IRT.WrightMap ,
       IRT.drawPV,
       IRT.residuals ,
       msq.itemfitWLE ,
       tam.Q3 ,
       IRT.informationCurves
       )




# internal functions; not intended to be visible to users
# export(calc_exp_TK, calc_posterior.v2, calc_prob.v5, 
#        mstep.regression, Mstep_slope, Mstep_slope.v2,
#        print.designMatrices, resp.pattern3, rowcumsums, rowMaxs,
#        stud_prior.v2, tam.jml.xsi, tam.jml.xsi2, theta.sq)


###########################################
############ S3 methods ###################

#### anova
S3method(anova, tam.mml )
S3method(anova, tam )
S3method(anova, tam.mml.3pl)
S3method(anova, tamaan)
S3method(anova, tam.latreg)


#### logLik
S3method(logLik, tam.mml )
S3method(logLik, tam )
S3method(logLik, tam.mml.3pl)
S3method(logLik, tamaan )
S3method(logLik, tam.latreg )


#### plot
S3method( plot , tam )
S3method( plot , tam.mml )
S3method( plot , tam.jml )
S3method( plot , IRT.informationCurves )


#### predict
S3method(predict, tam.mml )
S3method(predict, tam.mml.3pl )
S3method(predict, tamaan )


#### print
S3method(print, IRT.threshold)


#### residuals
S3method(residuals, tam.mml )
S3method(residuals, tam.mml.2pl )
S3method(residuals, tam.mml.mfr )


#### summary
S3method(summary, tam )
S3method(summary, tam.mml )
S3method(summary, tam.mml.3pl )
S3method(summary, tam.modelfit )
S3method(summary, tam.jml )
S3method(summary, tamaan )
S3method(summary, tam.latreg )
S3method(summary, tam.fit )
S3method(summary, IRT.modelfit.tam.mml )
S3method(summary, IRT.modelfit.tam.mml.3pl )
S3method(summary, IRT.modelfit.tamaan )
S3method(summary, IRT.linearCFA)
S3method(summary, msq.itemfit)
S3method(summary, msq.itemfitWLE)
S3method(summary, tam.Q3)


########################################
###### S3 methods IRT.xx ###############


#### IRT.data
S3method(IRT.data, tam.mml )
S3method(IRT.data, tam.mml.3pl)
S3method(IRT.data, tamaan )



#### IRT.expectedCounts
S3method(IRT.expectedCounts, tam.mml )
S3method(IRT.expectedCounts, tam )
S3method(IRT.expectedCounts, tam.mml.3pl)
S3method(IRT.expectedCounts, tamaan )


#### IRT.factor.scores
S3method(IRT.factor.scores, tam.mml )
S3method(IRT.factor.scores, tam )
S3method(IRT.factor.scores, tam.mml.3pl)
S3method(IRT.factor.scores, tamaan )


#### IRT.informationCurves
S3method(IRT.informationCurves, tam.mml )
S3method(IRT.informationCurves, tam.mml.2pl )
S3method(IRT.informationCurves, tam.mml.3pl )
S3method(IRT.informationCurves, tam.mml.mfr )


#### IRT.irfprob
S3method(IRT.irfprob, tam.mml )
S3method(IRT.irfprob, tam )
S3method(IRT.irfprob, tam.mml.3pl)
S3method(IRT.irfprob, tamaan )


#### IRT.likelihood
S3method(IRT.likelihood, tam.mml )
S3method(IRT.likelihood, tam )
S3method(IRT.likelihood, tam.mml.3pl)
S3method(IRT.likelihood, tamaan )
S3method(IRT.likelihood, tam.latreg )

#### IRT.modelfit
S3method(IRT.modelfit, tam.mml )
S3method(IRT.modelfit, tam.mml.3pl)
S3method(IRT.modelfit, tamaan )


#### IRT.posterior
S3method(IRT.posterior, tam.mml )
S3method(IRT.posterior, tam )
S3method(IRT.posterior, tam.mml.3pl)
S3method(IRT.posterior, tamaan)
S3method(IRT.posterior, tam.latreg)


#### IRT.residuals
S3method(IRT.residuals, tam.mml )
S3method(IRT.residuals, tam.mml.2pl )
S3method(IRT.residuals, tam.mml.mfr )


#### IRT.WrightMap
S3method(IRT.WrightMap, tam.mml )
S3method(IRT.WrightMap, tamaan)
S3method(IRT.WrightMap, IRT.threshold)


