if (FALSE) {
# With the Verbal data set
data(verbal)
Dat <-verbal[,1:20]
Member <-verbal[,26]
# Using AIC for selection
lassoDIF.ABWIC(Dat, Member, type="AIC")
# Using BIC for selection
lassoDIF.ABWIC(Dat, Member, type="BIC")
# With simulated data
It <- 15 # number of items
ItDIFa <- NULL
ItDIFb <- c(1,3)
NR <- 100 # number of responses for group 1 (reference)
NF <- 100 # number of responses for group 2 (focal)
a <- rep(1,It) # for tests: runif(It,0.2,.5)
b <- rnorm(It,1,.5)
Gb <- rep(2,2) # Group value for U-DIF
Ga <- 0 # Group value for NU-DIF: need to be fix to 0 for U-DIF
Out1 <- SimDichoDif(It,ItDIFa,ItDIFb,
NR,NF,a,b,Ga,Gb)
Dat<-Out1$data[,1:15]
Member<-Out1$data[,16]
# Using AIC for selection
lassoDIF.ABWIC(Dat, Member, type="AIC")
# Using BIC for selection
lassoDIF.ABWIC(Dat, Member, type="BIC")
# This plot shows how the estimated DIF effects for each item evolve
# as the lasso penalty (lambda) increases
aic.res <- lassoDIF.ABWIC(Dat, Member, type="AIC")
plot_lasso_paths(aic.res$glmnet.fit)
bic.res <- lassoDIF.ABWIC(Dat, Member, type="BIC")
plot_lasso_paths(bic.res$glmnet.fit)
}
Run the code above in your browser using DataLab