if (FALSE) {
#####################################
#### MUDFOLD method on real data ####
#####################################
###########################################################################
###### MUDFOLD method on ANDRICH data (see Post and Snijders pp.147) ######
###########################################################################
data(ANDRICH)
## fit MUDFOLD on ANDRICH data ##
fit_andr <- mudfold(ANDRICH)
## generic functions for the S3 class .mdf object fit ##
## print.mdf
print(fit_andr)
## summary.mdf
summary(fit_andr)
## plot.mdf
plot(fit_andr)
## fit MUDFOLD on ANDRICH data with bootsrap ##
fit_andr_boot <- mudfold(ANDRICH, nboot=100)
## generic functions for the S3 class .mdf object fit ##
## print.mdf
print(fit_andr_boot)
## summary.mdf
summary(fit_andr_boot, boot=TRUE)
## plot.mdf
plot(fit_andr_boot)
############################################
###### MUDFOLD method on EURPAR2 data ######
############################################
data("EURPAR2")
## fit MUDFOLD on EURPAR2 data ##
fit_eurp <- mudfold(EURPAR2)
## print
print(fit_eurp)
## summary
summary(fit_eurp)
## plot
plot(fit_eurp)
###########################################
###### MUDFOLD method on Plato7 data ######
###########################################
data("Plato7")
## transform to binary data
## using as threshold the mean
## per row of Plato7
dat_plato <- pick(Plato7)
## fit MUDFOLD on Plato7 data ##
fit_plato <- mudfold(dat_plato, nboot=1000)
## print
print(fit_plato)
## summary
summary(fit_plato, boot=TRUE)
## plot
plot(fit_plato, plot.type="scale")
plot(fit_plato, plot.type="IRF")
plot(fit_plato, plot.type="persons")
##########################################
#### MUDFOLD method on simulated data ####
##########################################
### Data with the responses of
### n=3000 on p=20 items
simulation1 <- mudfoldsim(N=20, n=3000, gamma1=2, gamma2=-10, zeros=FALSE,seed = 1)
dat_sim1 <- simulation1$dat
## fit MUDFOLD on simulated data ##
fit.sim1 <- mudfold(dat_sim1)
# print
fit.sim1
# summary
summary(fit.sim1)
# plot
plot(fit.sim1)
### Data with the responses of
### n=3000 on N=26 items
simulation2 <- mudfoldsim(N=26, n=3000, gamma1=2, gamma2=-10, zeros=FALSE,seed = 1)
dat_sim2 <- simulation2$dat
## fit MUDFOLD on simulated data ##
fit.sim2 <- mudfold(dat_sim2)
# print
fit.sim2
# summary
summary(fit.sim2)
# plot
plot(fit.sim2, plot.type="scale")
plot(fit.sim2, plot.type="IRF")
plot(fit.sim2, plot.type="persons")
}
Run the code above in your browser using DataLab