diff --git a/RProject/dif.R b/RProject/dif.R index 6064cfd..b133633 100644 --- a/RProject/dif.R +++ b/RProject/dif.R @@ -1,4 +1,4 @@ -library(mirt) +library(TAM) pcm_analysis <- function(df=NULL,treatment='TT',irtmodel='PCM2',method='MML') { nbitems <- sum(sapply(1:20,function(x) paste0('item',x)) %in% colnames(df)) @@ -15,13 +15,13 @@ pcm_analysis <- function(df=NULL,treatment='TT',irtmodel='PCM2',method='MML') { return(tam1) } -dff <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5A_50.csv') +dff <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N100/scenario_5A_100.csv') dfff <- dff[dff$replication==1,] facets <- dfff$TT -dfff$item2_noTT <- NA -dfff$item2_TT <- NA -dfff[dfff$TT==0,]$item2_noTT <- dfff[dfff$TT==0,"item2"] -dfff[dfff$TT==1,]$item2_TT <- dfff[dfff$TT==1,"item2"] +dfff$item4_noTT <- NA +dfff$item4_TT <- NA +dfff[dfff$TT==0,]$item4_noTT <- dfff[dfff$TT==0,"item4"] +dfff[dfff$TT==1,]$item4_TT <- dfff[dfff$TT==1,"item4"] -mml.mod <- tam.mml(resp=dfff[,c('item1','item2_noTT','item2_TT',"item3","item4")],Y=dfff$TT,constraint='cases' +mml.mod <- tam.mml(resp=dfff[,c('item1','item2',"item3","item4_noTT",'item4_TT')],Y=dfff$TT,constraint='cases' ,irtmodel = "PCM2",est.variance = T,verbose=F)