Skip to contents

Extract the matrix and offset used by a scaled SVD summary of a demographic database.

Usage

# S3 method for class 'bage_ssvd'
components(object, n_comp = NULL, indep = NULL, age_labels = NULL, ...)

Arguments

object

An object of class "bage_ssvd".

n_comp

The number of components. The default is half the total number of components of object.

indep

Whether to use independent or joint SVDs for each sex/gender. If no value is supplied, an SVD with no sex/gender dimension is used. Note that the default is different from SVD().

age_labels

Age labels for the desired age or age-sex profile. If no labels are supplied, the most detailed profile available is used.

...

Not currently used.

Value

A tibble with the offset and components.

Scaled SVDs of demographic databases in bage

See also

Examples

## females and males combined
components(LFP, n_comp = 3)
#> # A tibble: 52 × 3
#>    component age    value
#>    <fct>     <chr>  <dbl>
#>  1 Offset    15-19 -0.839
#>  2 Offset    20-24  0.754
#>  3 Offset    25-29  1.46 
#>  4 Offset    30-34  1.56 
#>  5 Offset    35-39  1.63 
#>  6 Offset    40-44  1.68 
#>  7 Offset    45-49  1.58 
#>  8 Offset    50-54  1.25 
#>  9 Offset    55-59  0.645
#> 10 Offset    60-64 -0.398
#> # ℹ 42 more rows

## females and males modelled independently
components(LFP, indep = TRUE, n_comp = 3)
#> # A tibble: 104 × 4
#>    component sex    age    value
#>    <fct>     <chr>  <chr>  <dbl>
#>  1 Offset    Female 15-19 -0.989
#>  2 Offset    Female 20-24  0.455
#>  3 Offset    Female 25-29  0.898
#>  4 Offset    Female 30-34  0.881
#>  5 Offset    Female 35-39  0.985
#>  6 Offset    Female 40-44  1.10 
#>  7 Offset    Female 45-49  1.04 
#>  8 Offset    Female 50-54  0.734
#>  9 Offset    Female 55-59  0.162
#> 10 Offset    Female 60-64 -0.857
#> # ℹ 94 more rows

## joint model for females and males
components(LFP, indep = FALSE, n_comp = 3)
#> # A tibble: 104 × 4
#>    component sex    age    value
#>    <fct>     <chr>  <chr>  <dbl>
#>  1 Offset    Female 15-19 -1.00 
#>  2 Offset    Female 20-24  0.481
#>  3 Offset    Female 25-29  0.890
#>  4 Offset    Female 30-34  0.851
#>  5 Offset    Female 35-39  0.965
#>  6 Offset    Female 40-44  1.09 
#>  7 Offset    Female 45-49  1.05 
#>  8 Offset    Female 50-54  0.747
#>  9 Offset    Female 55-59  0.171
#> 10 Offset    Female 60-64 -0.855
#> # ℹ 94 more rows

## specify age groups
labels <- poputils::age_labels(type = "five", min = 15, max = 60)
components(LFP, age_labels = labels)
#> # A tibble: 36 × 3
#>    component   age    value
#>    <fct>       <chr>  <dbl>
#>  1 Offset      15-19 -1.01 
#>  2 Offset      20-24  0.736
#>  3 Offset      25-29  1.49 
#>  4 Offset      30-34  1.64 
#>  5 Offset      35-39  1.71 
#>  6 Offset      40-44  1.74 
#>  7 Offset      45-49  1.62 
#>  8 Offset      50-54  1.28 
#>  9 Offset      55-59  0.652
#> 10 Component 1 15-19 -0.281
#> # ℹ 26 more rows