Takes the output of cluster_gen and creates summary statistics
of the questionnaire variables
Usage
# S3 method for class 'lsasimcluster'
summary(
object,
digits = 4,
print = "partial",
print_hetcor = TRUE,
force_matrix = FALSE,
...
)Arguments
- object
output of
cluster_gen- digits
loosely controls the number of digits (significant or not) in the output (for
print = TRUE)"all" will pretty-print a summary of statistics, "partial" will only print cluster-level summaries; "none" outputs statistics as a list
- print_hetcor
if
TRUE(default), prints the heterogeneous correlation matrix- force_matrix
if
TRUE, prints the heterogeneous correlation matrix even if warnings are generated- ...
additional arguments (unused; added for compatibility with generic)
Note
Setting print="none" allows for saving the results as an R object (list).
Otherwise, the results will be simply printed and not savable.
Changing digits may yield unexpected results for the estimates of
continuous variables, given how most of them are printed using the number
of significant digits (for more information, see help("summary")).
Please note that datasets containing large values for the coefficient of variation (sigma / mu) should yield imprecise results.
Examples
n <- c(3, 30)
cls <- cluster_gen(n, n_X = 3, n_W = 5)
#> ── Hierarchical structure ──────────────────────────────────────────────────────
#> Sampled structure
#> Generating questionnaires for schools
#> Total respondents: 90 (30 * 3)
#> school1 (30 students)
#> school2 (30 students)
#> school3 (30 students)
#> ── Information on sampling weights ─────────────────────────────────────────────
#> - Calculating PPS weights at the school level
#> final.student.weight should add up to the number of students in the population (90)
summary(cls)
#> ────────────────────────────────────────────────────────────────────────────────
#> Summary statistics for all schools
#> [[1]]
#> q1 q2 q3 q4 q5
#> Min. :-2.66135 Min. :-2.57460 Min. :-2.83160 1:21 1:45
#> Mean :-0.04760 Mean : 0.13379 Mean : 0.03591 2:14 2:19
#> Max. : 1.75545 Max. : 3.01012 Max. : 2.83382 3:20 3:20
#> 4:27 4: 6
#> Stddev.: 0.9624 Stddev.: 1.0582 Stddev.: 1.1334 5: 8
#> Prop.
#> Prop. 1:0.5
#> 1:0.2333 2:0.2111
#> 2:0.1556 3:0.2222
#> 3:0.2222 4:0.0667
#> 4:0.3
#> 5:0.0889
#>
#>
#> q6 q7 q8
#> 1:19 1:49 1:21
#> 2:35 2: 7 2:15
#> 3:23 3:28 3:17
#> 4:13 4: 6 4:23
#> 5:14
#> Prop. Prop.
#> 1:0.2111 1:0.5444 Prop.
#> 2:0.3889 2:0.0778 1:0.2333
#> 3:0.2556 3:0.3111 2:0.1667
#> 4:0.1444 4:0.0667 3:0.1889
#> 4:0.2556
#> 5:0.1556
#>
#>
#>
#>
#> Heterogeneous correlation matrix
#> q1 q2 q3 q4 q5 q6
#> q1 1.000000000 -0.32394991 0.2409467 -0.592031698 -0.003090111 -0.16786465
#> q2 -0.323949907 1.00000000 -0.1072850 0.099723481 0.198002289 0.05220054
#> q3 0.240946670 -0.10728502 1.0000000 -0.175100407 -0.408289195 -0.10939115
#> q4 -0.592031698 0.09972348 -0.1751004 1.000000000 0.006104049 0.21351011
#> q5 -0.003090111 0.19800229 -0.4082892 0.006104049 1.000000000 0.11065948
#> q6 -0.167864645 0.05220054 -0.1093911 0.213510110 0.110659479 1.00000000
#> q7 -0.249689807 -0.02394807 -0.2831395 0.103590665 0.117798894 -0.15321904
#> q8 -0.051080000 0.08416231 -0.1336235 0.276548490 0.102201924 -0.04453906
#> q7 q8
#> q1 -0.24968981 -0.05108000
#> q2 -0.02394807 0.08416231
#> q3 -0.28313953 -0.13362347
#> q4 0.10359066 0.27654849
#> q5 0.11779889 0.10220192
#> q6 -0.15321904 -0.04453906
#> q7 1.00000000 -0.13582037
#> q8 -0.13582037 1.00000000
summary(cls, print = "none") # allows saving results
#> $school
#> $school$y_bar_j
#> q1 q2 q3
#> [1,] 0.07036588 0.204773570 0.06518542
#> [2,] -0.08809816 0.000746936 0.12074020
#> [3,] -0.12506287 0.195854124 -0.07820159
#>
#> $school$n_j
#> [,1]
#> [1,] 30
#> [2,] 30
#> [3,] 30
#>
#> $school$s2_j
#> q1 q2 q3
#> [1,] 0.8384042 1.3621829 1.139459
#> [2,] 0.9647844 1.1765313 1.710437
#> [3,] 1.0169675 0.8705136 1.070582
#>
#> $school$y_bar
#> q1 q2 q3
#> -0.04759838 0.13379154 0.03590801
#>
#> $school$N
#> [1] 3
#>
#> $school$M
#> [1] 90
#>
#> $school$n_tilde
#> [1] 30
#>
#>