knitr::opts_chunk$set(fig.width=7, fig.asp=0.618) library(qgraph) library(gpowerr) data(big5)
power <- gpower( data = big5, k = 5, rho = 0.1, reg = "l1", center = TRUE, block = FALSE, mu = 1 ) summary(power) print(power, print_zero_rows = FALSE)
auto <- auto_gpower( data = big5, k = 5, prop_sparse = 0.2, reg = "l1", block = FALSE, mu = 1 ) summary(auto) print(auto, print_zero_rows = FALSE)
auto <- auto_gpower( data = big5, k = 5, prop_sparse = 0.97 ) png("figures/big5smallheatmap.png", width = 600, height = 370, res=90) row_labels = data.frame(label = substring(colnames(big5), 1, 1), row.names = colnames(big5)) gpower_component_heatmap( data = big5, k = 5, rho = 0.3125, cluster_variables = TRUE, show_variable_names = TRUE, variable_highlight = row_labels, ignore_full_zero = TRUE ) dev.off()
png("figures/big5fullheatmap.png", width = 600, height = 370, res=90) row_labels = data.frame(label = substring(colnames(big5), 1, 1), row.names = colnames(big5)) gpower_component_heatmap( data = big5, k = 5, rho = 0.1, cluster_variables = TRUE, show_variable_names = FALSE, variable_highlight = row_labels ) dev.off() png("figures/big525heatmap.png", width = 600, height = 370, res=90) row_labels_25 = data.frame(label = substring(colnames(big5)[1:25], 1, 1), row.names = colnames(big5)[1:25]) gpower_component_heatmap( data = big5[, 1:25], k = 5, rho = 0.1, cluster_variables = TRUE, show_variable_names = TRUE, variable_highlight = row_labels_25 ) dev.off()
png("figures/big5varplot.png", width = 600, height = 370, res=80) gpower_var_plot( data = big5, k = 5, intervals = 40, reg = 'l1' ) dev.off() png("figures/big5compvarplot.png", width = 600, height = 370, res=80) gpower_comp_var_plot( data = big5, k = 5, intervals = 40, reg = 'l1' ) dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.