Turn a psych::alpha() object into HTML tables.

knit_print.alpha(x, indent = "#####", ...)

Arguments

x

a psych alpha object

indent

add # to this to make the headings in the components lower-level. defaults to beginning at h5

...

ignored

Examples

example("alpha", "psych")
#> #> Attaching package: ‘psych’
#> The following object is masked _by_ ‘.GlobalEnv’: #> #> bfi
#> The following object is masked from ‘package:codebook’: #> #> bfi
#> The following object is masked from ‘package:testthat’: #> #> describe
#> #> alpha> set.seed(42) #keep the same starting values #> #> alpha> #four congeneric measures #> alpha> r4 <- sim.congeneric() #> #> alpha> alpha(r4) #> #> Reliability analysis #> Call: alpha(x = r4) #> #> raw_alpha std.alpha G6(smc) average_r S/N #> 0.74 0.74 0.69 0.42 2.9 #> #> Reliability if an item is dropped: #> raw_alpha std.alpha G6(smc) average_r S/N #> V1 0.62 0.62 0.53 0.36 1.7 #> V2 0.66 0.66 0.57 0.39 1.9 #> V3 0.70 0.70 0.62 0.44 2.3 #> V4 0.74 0.74 0.66 0.49 2.8 #> #> Item statistics #> r r.cor r.drop #> V1 0.81 0.74 0.64 #> V2 0.78 0.67 0.57 #> V3 0.73 0.59 0.51 #> V4 0.68 0.50 0.43 #> #> alpha> #nine hierarchical measures -- should actually use omega #> alpha> r9 <- sim.hierarchical() #> #> alpha> alpha(r9) #> #> Reliability analysis #> Call: alpha(x = r9) #> #> raw_alpha std.alpha G6(smc) average_r S/N #> 0.76 0.76 0.76 0.26 3.2 #> #> Reliability if an item is dropped: #> raw_alpha std.alpha G6(smc) average_r S/N #> V1 0.71 0.71 0.70 0.24 2.5 #> V2 0.72 0.72 0.71 0.25 2.6 #> V3 0.74 0.74 0.73 0.26 2.8 #> V4 0.73 0.73 0.72 0.25 2.7 #> V5 0.74 0.74 0.73 0.26 2.9 #> V6 0.75 0.75 0.74 0.27 3.0 #> V7 0.75 0.75 0.74 0.27 3.0 #> V8 0.76 0.76 0.75 0.28 3.1 #> V9 0.77 0.77 0.76 0.29 3.3 #> #> Item statistics #> r r.cor r.drop #> V1 0.72 0.71 0.61 #> V2 0.67 0.63 0.54 #> V3 0.61 0.55 0.47 #> V4 0.65 0.59 0.51 #> V5 0.59 0.52 0.45 #> V6 0.53 0.43 0.38 #> V7 0.56 0.46 0.40 #> V8 0.50 0.39 0.34 #> V9 0.45 0.32 0.28 #> #> alpha> # examples of two independent factors that produce reasonable alphas #> alpha> #this is a case where alpha is a poor indicator of unidimensionality #> alpha> two.f <- sim.item(8) #> #> alpha> #specify which items to reverse key by name #> alpha> alpha(two.f,keys=c("V1","V2","V7","V8")) #> #> Reliability analysis #> Call: alpha(x = two.f, keys = c("V1", "V2", "V7", "V8")) #> #> raw_alpha std.alpha G6(smc) average_r S/N ase mean sd #> 0.58 0.58 0.62 0.15 1.4 0.029 0.031 0.51 #> #> lower alpha upper 95% confidence boundaries #> 0.53 0.58 0.64 #> #> Reliability if an item is dropped: #> raw_alpha std.alpha G6(smc) average_r S/N alpha se #> V1- 0.55 0.55 0.58 0.15 1.2 0.031 #> V2- 0.53 0.53 0.57 0.14 1.1 0.033 #> V3 0.55 0.55 0.58 0.15 1.2 0.031 #> V4 0.55 0.54 0.58 0.15 1.2 0.032 #> V5 0.56 0.56 0.59 0.15 1.3 0.031 #> V6 0.56 0.56 0.59 0.15 1.3 0.031 #> V7- 0.53 0.53 0.56 0.14 1.1 0.033 #> V8- 0.56 0.57 0.59 0.16 1.3 0.030 #> #> Item statistics #> n raw.r std.r r.cor r.drop mean sd #> V1- 500 0.50 0.50 0.38 0.28 0.09148 1.01 #> V2- 500 0.55 0.55 0.46 0.34 0.10501 1.00 #> V3 500 0.50 0.50 0.39 0.27 -0.04114 1.05 #> V4 500 0.51 0.51 0.41 0.30 -0.04698 0.99 #> V5 500 0.48 0.48 0.36 0.26 0.00021 1.01 #> V6 500 0.48 0.48 0.36 0.26 -0.00965 1.00 #> V7- 500 0.56 0.56 0.48 0.35 0.08102 1.00 #> V8- 500 0.45 0.46 0.33 0.23 0.07120 0.96 #> #> alpha> #by location #> alpha> alpha(two.f,keys=c(1,2,7,8)) #> #> Reliability analysis #> Call: alpha(x = two.f, keys = c(1, 2, 7, 8)) #> #> raw_alpha std.alpha G6(smc) average_r S/N ase mean sd #> 0.58 0.58 0.62 0.15 1.4 0.029 0.031 0.51 #> #> lower alpha upper 95% confidence boundaries #> 0.53 0.58 0.64 #> #> Reliability if an item is dropped: #> raw_alpha std.alpha G6(smc) average_r S/N alpha se #> V1- 0.55 0.55 0.58 0.15 1.2 0.031 #> V2- 0.53 0.53 0.57 0.14 1.1 0.033 #> V3 0.55 0.55 0.58 0.15 1.2 0.031 #> V4 0.55 0.54 0.58 0.15 1.2 0.032 #> V5 0.56 0.56 0.59 0.15 1.3 0.031 #> V6 0.56 0.56 0.59 0.15 1.3 0.031 #> V7- 0.53 0.53 0.56 0.14 1.1 0.033 #> V8- 0.56 0.57 0.59 0.16 1.3 0.030 #> #> Item statistics #> n raw.r std.r r.cor r.drop mean sd #> V1- 500 0.50 0.50 0.38 0.28 0.09148 1.01 #> V2- 500 0.55 0.55 0.46 0.34 0.10501 1.00 #> V3 500 0.50 0.50 0.39 0.27 -0.04114 1.05 #> V4 500 0.51 0.51 0.41 0.30 -0.04698 0.99 #> V5 500 0.48 0.48 0.36 0.26 0.00021 1.01 #> V6 500 0.48 0.48 0.36 0.26 -0.00965 1.00 #> V7- 500 0.56 0.56 0.48 0.35 0.08102 1.00 #> V8- 500 0.45 0.46 0.33 0.23 0.07120 0.96 #> #> alpha> #automatic reversal base upon first component #> alpha> alpha(two.f)
#> Warning: Some items were negatively correlated with the total scale and probably #> should be reversed. #> To do this, run the function again with the 'check.keys=TRUE' option
#> Some items ( V3 V4 V5 V6 ) were negatively correlated with the total scale and #> probably should be reversed. #> To do this, run the function again with the 'check.keys=TRUE' option
#> Warning: NaNs produced
#> #> Reliability analysis #> Call: alpha(x = two.f) #> #> raw_alpha std.alpha G6(smc) average_r S/N ase mean sd #> -0.58 -0.58 -0.17 -0.048 -0.37 0.11 -0.0042 0.29 #> #> lower alpha upper 95% confidence boundaries #> -0.8 -0.58 -0.37 #> #> Reliability if an item is dropped: #> raw_alpha std.alpha G6(smc) average_r S/N alpha se #> V1 -0.54 -0.53 -0.147 -0.052 -0.35 0.106 #> V2 -0.52 -0.52 -0.149 -0.051 -0.34 0.105 #> V3 -0.37 -0.36 -0.041 -0.039 -0.27 0.094 #> V4 -0.40 -0.37 -0.049 -0.040 -0.27 0.097 #> V5 -0.49 -0.48 -0.119 -0.049 -0.32 0.103 #> V6 -0.56 -0.56 -0.172 -0.054 -0.36 0.107 #> V7 -0.39 -0.40 -0.083 -0.043 -0.29 0.097 #> V8 -0.57 -0.57 -0.177 -0.055 -0.36 0.109 #> #> Item statistics #> n raw.r std.r r.cor r.drop mean sd #> V1 500 0.33 0.33 NaN -0.112 0.01170 1.01 #> V2 500 0.32 0.32 NaN -0.123 -0.00183 1.00 #> V3 500 0.24 0.21 NaN -0.219 -0.04114 1.05 #> V4 500 0.22 0.22 NaN -0.204 -0.04698 0.99 #> V5 500 0.30 0.30 NaN -0.144 0.00021 1.01 #> V6 500 0.34 0.34 NaN -0.100 -0.00965 1.00 #> V7 500 0.23 0.24 NaN -0.205 0.02217 1.00 #> V8 500 0.33 0.35 NaN -0.091 0.03198 0.96 #> #> alpha> #an example with discrete item responses -- show the frequencies #> alpha> items <- sim.congeneric(N=500,short=FALSE,low=-2,high=2, #> alpha+ categorical=TRUE) #500 responses to 4 discrete items with 5 categories #> #> alpha> a4 <- alpha(items$observed) #item response analysis of congeneric measures #> #> alpha> a4 #> #> Reliability analysis #> Call: alpha(x = items$observed) #> #> raw_alpha std.alpha G6(smc) average_r S/N ase mean sd #> 0.73 0.73 0.68 0.4 2.7 0.02 -0.013 0.76 #> #> lower alpha upper 95% confidence boundaries #> 0.69 0.73 0.77 #> #> Reliability if an item is dropped: #> raw_alpha std.alpha G6(smc) average_r S/N alpha se #> V1 0.61 0.61 0.52 0.34 1.6 0.031 #> V2 0.64 0.64 0.55 0.37 1.8 0.028 #> V3 0.68 0.68 0.60 0.41 2.1 0.025 #> V4 0.73 0.73 0.65 0.48 2.8 0.021 #> #> Item statistics #> n raw.r std.r r.cor r.drop mean sd #> V1 500 0.80 0.80 0.73 0.62 0.050 1.00 #> V2 500 0.77 0.77 0.67 0.57 -0.022 1.03 #> V3 500 0.72 0.73 0.58 0.50 -0.028 0.99 #> V4 500 0.67 0.66 0.46 0.40 -0.050 1.05 #> #> Non missing response frequency for each item #> -2 -1 0 1 2 miss #> V1 0.06 0.24 0.38 0.25 0.07 0 #> V2 0.07 0.26 0.35 0.25 0.07 0 #> V3 0.05 0.27 0.38 0.22 0.07 0 #> V4 0.10 0.22 0.39 0.22 0.07 0 #> #> alpha> #summary just gives Alpha #> alpha> summary(a4) #> #> Reliability analysis #> raw_alpha std.alpha G6(smc) average_r S/N ase mean sd #> 0.73 0.73 0.68 0.4 2.7 0.02 -0.013 0.76
knitr::knit_print(a4)
#> #> #> #> #> ##### Reliability #> #> ##### 95% Confidence Interval #> #> ```r #> if (!is.null(x$total$ase)) { #> pander::pander(data.frame(lower = x$total$raw_alpha - 1.96 * x$total$ase, #> estimate = x$total$raw_alpha, #> upper = x$total$raw_alpha + 1.96 * #> x$total$ase)) #> } #> ``` #> #> #> --------------------------- #> lower estimate upper #> ------- ---------- -------- #> 0.688 0.7272 0.7664 #> --------------------------- #> #> #> ```r #> pander::pander(x$total) #> ``` #> #> #> ---------------------------------------------------------------------------------- #> raw_alpha std.alpha G6(smc) average_r S/N ase mean sd #> ----------- ----------- --------- ----------- ------- --------- --------- -------- #> 0.7272 0.7285 0.6795 0.4015 2.684 0.01999 -0.0125 0.7556 #> ---------------------------------------------------------------------------------- #> #> ##### Reliability if an item is dropped: #> #> #> ```r #> pander::pander(x$alpha.drop) #> ``` #> #> #> ------------------------------------------------------------------------- #> &nbsp; raw_alpha std.alpha G6(smc) average_r S/N alpha se #> -------- ----------- ----------- --------- ----------- ------- ---------- #> **V1** 0.6067 0.6079 0.5158 0.3407 1.55 0.03056 #> #> **V2** 0.6368 0.6386 0.5532 0.3707 1.767 0.0283 #> #> **V3** 0.6785 0.6802 0.6022 0.4148 2.127 0.02514 #> #> **V4** 0.7348 0.7346 0.6532 0.4799 2.768 0.02055 #> ------------------------------------------------------------------------- #> #> ##### Item statistics #> #> #> ```r #> pander::pander(x$item.stats) #> ``` #> #> #> -------------------------------------------------------------------- #> &nbsp; n raw.r std.r r.cor r.drop mean sd #> -------- ----- -------- -------- -------- -------- -------- -------- #> **V1** 500 0.8014 0.8039 0.7276 0.6169 0.05 1.005 #> #> **V2** 500 0.7746 0.7735 0.6717 0.5658 -0.022 1.029 #> #> **V3** 500 0.722 0.729 0.5844 0.4957 -0.028 0.9885 #> #> **V4** 500 0.6714 0.6632 0.4641 0.4001 -0.05 1.052 #> -------------------------------------------------------------------- #> #> ##### Non missing response frequency for each item #> #> #> ```r #> pander::pander(x$response.freq) #> ``` #> #> #> ------------------------------------------------------- #> &nbsp; -2 -1 0 1 2 miss #> -------- ------- ------- ------- ------- ------- ------ #> **V1** 0.056 0.238 0.38 0.252 0.074 0 #> #> **V2** 0.07 0.264 0.35 0.25 0.066 0 #> #> **V3** 0.054 0.274 0.384 0.222 0.066 0 #> #> **V4** 0.096 0.22 0.392 0.222 0.07 0 #> -------------------------------------------------------