## GENERATION OF VECTORS OF RESPONSE
# NOTE THE USUAL PARAMETRIZATION OF THE ITEM DISCRIMINATION,
# THE VALUE OF THE PERSONNAL FLUCTUATION FIXED AT 0,
# AND THE VALUE OF THE PERSONNAL PSEUDO-GUESSING FIXED AT 0.30.
# IT COULD BE TYPICAL OF PLAGIARISM BEHAVIOR.
nItems <- 40
a <- rep(1.702,nItems); b <- seq(-5,5,length=nItems)
c <- rep(0,nItems); d <- rep(1,nItems)
nSubjects <- 1; rep <- 100
theta <- seq(-2,-2,length=nSubjects)
S <- runif(n=nSubjects,min=0.0,max=0.0)
C <- runif(n=nSubjects,min=0.3,max=0.3)
D <- runif(n=nSubjects,min=0,max=0)
set.seed(seed = 100)
X <- ggrm4pl(n=nItems, rep=rep,
theta=theta, S=S, C=C, D=D,
s=1/a, b=b,c=c,d=d)
## Results for each subjects for each models
essai <- m4plModelShow(X, b=b, s=1/a, c=c, d=d, m=0, prior="uniform")
## Is essai of class modelShow?
is.modelShow(essai)
## Rounding to 2 decimals the first 5 results of essai
Round(essai[1:5,], 2)
## Means for each models rounded to 3 decimals
summary(essai, report="means", statistics=c("LL","AIC","BIC","T","SeT"), digits=3)
## Model choosen for each of the first 5 subjects
## and the frequency of these choices with the BIC criteria
summary(essai[which(essai$ID == (1:5)),], report="choose", criteria="BIC")
## Frequency of the models choosen for all the subjects
## with the LL, AIC and BIC criteria
## Generally, BIC chooses the less models AIC the more.
summary(essai, report="table", criteria="LL")
summary(essai, report="table", criteria="AIC")
summary(essai, report="table", criteria="BIC")
## Frequency of the models choosen for all the subjects
## with the BIC criteria, but with a histogram
summary(essai, report="histogram", criteria="BIC", color="blue")
## The choosen model is added to the essai modelShow object for all the subjects
## with the LL, AIC and BIC criteria and statistics about theta are computed
## Recall thet rhe generating theta was fixed at -2.00
## The LL criteria seems the best one her according to bias and standard error
resultLL <- summary(essai, report="add", criteria="LL")
resultAIC <- summary(essai, report="add", criteria="AIC")
resultBIC <- summary(essai, report="add", criteria="BIC")
# LL
summary(resultLL[which(resultLL$critLL == TRUE),]$T)
sd(resultLL[which(resultLL$critLL == TRUE),]$T, na.rm=TRUE)
# AIC
summary(resultAIC[which(resultAIC$critAIC == TRUE),]$T)
sd(resultAIC[which(resultAIC$critAIC == TRUE),]$T, na.rm=TRUE)
# BIC
summary(resultBIC[which(resultBIC$critBIC == TRUE),]$T)
sd(resultBIC[which(resultBIC$critBIC == TRUE),]$T, na.rm=TRUE)
Run the code above in your browser using DataLab