These methods extract data from, and attribute new data to,
objects of class "svd_ord"
returned by svd_ord()
.
# S3 method for svd_ord
as_tbl_ord(x)
# S3 method for svd_ord
recover_rows(x)
# S3 method for svd_ord
recover_cols(x)
# S3 method for svd_ord
recover_inertia(x)
# S3 method for svd_ord
recover_coord(x)
# S3 method for svd_ord
recover_conference(x)
# S3 method for svd_ord
recover_aug_rows(x)
# S3 method for svd_ord
recover_aug_cols(x)
# S3 method for svd_ord
recover_aug_coord(x)
An ordination object.
The recovery generics recover_*()
return core model components, distribution of inertia,
supplementary elements, and intrinsic metadata; but they require methods for each model class to
tell them what these components are.
The generic as_tbl_ord()
returns its input wrapped in the 'tbl_ord'
class. Its methods determine what model classes it is allowed to wrap. It
then provides 'tbl_ord' methods with access to the recoverers and hence to
the model components.
Other methods for singular value decomposition-based techniques:
methods-cancor
,
methods-correspondence
,
methods-lda
,
methods-lra
,
methods-mca
,
methods-prcomp
,
methods-princomp
Other models from the base package:
methods-eigen
# matrix of U.S. personal expenditure data
class(USPersonalExpenditure)
#> [1] "matrix" "array"
print(USPersonalExpenditure)
#> 1940 1945 1950 1955 1960
#> Food and Tobacco 22.200 44.500 59.60 73.2 86.80
#> Household Operation 10.500 15.500 29.00 36.5 46.20
#> Medical and Health 3.530 5.760 9.71 14.0 21.10
#> Personal Care 1.040 1.980 2.45 3.4 5.40
#> Private Education 0.341 0.974 1.80 2.6 3.64
# singular value decomposition into row and column coordinates
USPersonalExpenditure %>%
svd_ord() %>%
as_tbl_ord() %>%
print() -> spend_svd
#> # A tbl_ord of class 'svd_ord': (5 x 5) x (5 x 5)'
#> # 5 coordinates: SV1, SV2, ..., SV5
#> #
#> # Rows (standard): [ 5 x 5 | 0 ]
#> SV1 SV2 SV3 ... |
#> |
#> 1 -0.881 0.456 -0.122 |
#> 2 -0.436 -0.677 0.583 ... |
#> 3 -0.176 -0.562 -0.734 |
#> 4 -0.0455 -0.0929 -0.314 |
#> 5 -0.0311 -0.0989 -0.0892 |
#> #
#> # Columns (standard): [ 5 x 5 | 0 ]
#> SV1 SV2 SV3 ... |
#> |
#> 1 -0.159 0.113 0.182 |
#> 2 -0.302 0.792 -0.527 ... |
#> 3 -0.429 0.211 0.620 |
#> 4 -0.532 0.0266 0.302 |
#> 5 -0.645 -0.561 -0.461 |
# recover matrices of row and column coordinates
get_rows(spend_svd)
#> SV1 SV2 SV3 SV4 SV5
#> Food and Tobacco -0.88086766 0.45563080 -0.12237718 0.02450591 -0.02993361
#> Household Operation -0.43580483 -0.67662102 0.58341818 -0.07630369 0.07784028
#> Medical and Health -0.17637018 -0.56230756 -0.73372346 0.04111351 -0.33565360
#> Personal Care -0.04553400 -0.09285599 -0.31360568 -0.49361448 0.80454996
#> Private Education -0.03108899 -0.09885616 -0.08915387 0.86500383 0.48278452
get_cols(spend_svd)
#> SV1 SV2 SV3 SV4 SV5
#> 1940 -0.1589586 0.11313761 0.1824780 -0.89728506 -0.35144462
#> 1945 -0.3016855 0.79223017 -0.5274149 0.02654943 0.04985844
#> 1950 -0.4293572 0.21081041 0.6202698 -0.01464040 0.62150007
#> 1955 -0.5323309 0.02659741 0.3024320 0.42107353 -0.66869157
#> 1960 -0.6449761 -0.56073415 -0.4607988 -0.12906349 0.20146975
# augment with row and column names
augment_ord(spend_svd)
#> # A tbl_ord of class 'svd_ord': (5 x 5) x (5 x 5)'
#> # 5 coordinates: SV1, SV2, ..., SV5
#> #
#> # Rows (standard): [ 5 x 5 | 1 ]
#> SV1 SV2 SV3 ... | name
#> | <chr>
#> 1 -0.881 0.456 -0.122 | 1 Food and Tobacco
#> 2 -0.436 -0.677 0.583 ... | 2 Household Operation
#> 3 -0.176 -0.562 -0.734 | 3 Medical and Health
#> 4 -0.0455 -0.0929 -0.314 | 4 Personal Care
#> 5 -0.0311 -0.0989 -0.0892 | 5 Private Education
#> #
#> # Columns (standard): [ 5 x 5 | 1 ]
#> SV1 SV2 SV3 ... | name
#> | <chr>
#> 1 -0.159 0.113 0.182 | 1 1940
#> 2 -0.302 0.792 -0.527 ... | 2 1945
#> 3 -0.429 0.211 0.620 | 3 1950
#> 4 -0.532 0.0266 0.302 | 4 1955
#> 5 -0.645 -0.561 -0.461 | 5 1960
# initial matrix decomposition confers no inertia to coordinates
get_conference(spend_svd)
#> [1] 0 0