Load libraries and read NDDT data from S3
## Reading NDDT Item meta-data
## read 1024 records on 60 items
## Compute tetrochoric correlation and look at the item correlations
Work with level-1,2,3 data and level 3,4,5 data
Run FA on the two data-sets
####################
cat("Not Run")
# use pysch's defualt way of treating the missing values and check the loadings
X.pnp.fill <- round(as.matrix(score.df.sub1))
cat('Apply Parallel Analysis. Using tetrochoric correlation and Principal Axis estimating method')
nf.pa1 <- fa.parallel(X.pnp.fill,cor="tet",fm="pa",sim=FALSE,fa="fa",n.iter = 200)
X.pnp.fill <- round(as.matrix(score.df.sub2))
cat('Apply Parallel Analysis. Using tetrochoric correlation and Principal Axis estimating method')
nf.pa2 <- fa.parallel(X.pnp.fill,cor="tet",fm="pa",sim=FALSE,fa="fa",n.iter = 200)
PA suggests that 5 factors should be used on Level-3,4,5 data-set.
Now estmate the factor loadings for both datasets
Visualize the factor loadings as a graph L123 dataset
plot forced network - L123
Visualize the factor loadings as a graph L345 dataset
plot forced network - L123
Look at the precision matrix instead of the correlation matrix. A lack of edge in the graph implies that those two nodes are conditionally independent (given the informaiton about the rest).
This might be useful in packaging informative items for assessments
## High-deimensional Sparse Undirected Graphical Models.
## The input is identified as the covriance matrix.
## The Constrained L1 Minimization for Sparse Precision Matrix Estimation.
plot forced network
Precision matrix of L123 data
## High-deimensional Sparse Undirected Graphical Models.
## The input is identified as the covriance matrix.
## The Constrained L1 Minimization for Sparse Precision Matrix Estimation.
plot forced network
Precision matrix of L345 data
## High-deimensional Sparse Undirected Graphical Models.
## The input is identified as the covriance matrix.
## The Constrained L1 Minimization for Sparse Precision Matrix Estimation.
plot forced network
The above analysis was done using
## R version 3.2.4 (2016-03-10)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: OS X 10.11.3 (El Capitan)
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] visNetwork_1.0.1 flare_1.5.0 Matrix_1.2-4
## [4] reshape2_1.4.1 googlesheets_0.1.0 ggplot2_2.1.0
## [7] clusteval_0.1 clusterSim_0.44-2 clValid_0.6-6
## [10] cluster_2.0.3 nFactors_2.3.3 lattice_0.20-33
## [13] boot_1.3-18 MASS_7.3-45 igraph_1.0.1
## [16] psych_1.5.6 dplyr_0.5.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.6 cellranger_1.0.0 formatR_1.2 plyr_1.8.3
## [5] class_7.3-14 tools_3.2.4 digest_0.6.10 jsonlite_1.0
## [9] evaluate_0.9 tibble_1.1 gtable_0.2.0 DBI_0.4-1
## [13] R2HTML_2.3.1 yaml_2.1.13 parallel_3.2.4 mvtnorm_1.0-3
## [17] e1071_1.6-6 stringr_1.1.0 knitr_1.10.5 htmlwidgets_0.5
## [21] ade4_1.7-2 grid_3.2.4 R6_2.1.2 rgl_0.95.1247
## [25] rmarkdown_0.7 magrittr_1.5 scales_0.4.0 htmltools_0.2.6
## [29] assertthat_0.1 mnormt_1.5-3 colorspace_1.2-6 stringi_1.1.1
## [33] munsell_0.4.2