permute_design: Permute the design matrix so that it is approximately...

Description Usage Arguments Value Author(s) References

View source: R/permute.R

Description

Permute the design matrix so that it is approximately correlated with the surrogate variables.

Usage

1
2
3
4
5
6
permute_design(
  design_perm,
  sv,
  target_cor,
  method = c("optmatch", "hungarian", "marriage")
)

Arguments

design_perm

A numeric design matrix whose rows are to be permuted (thus controlling the amount by which they are correlated with the surrogate variables). The rows index the samples and the columns index the variables. The intercept should not be included (though see Section "Unestimable Components").

sv

A matrix of surrogate variables

target_cor

A numeric matrix of target correlations between the variables in design_perm and the surrogate variables. The rows index the observed covariates and the columns index the surrogate variables. That is, target_cor[i, j] specifies the target correlation between the ith column of design_perm and the jth surrogate variable. The surrogate variables are estimated either using factor analysis or surrogate variable analysis (see the parameter use_sva). The number of columns in target_cor specifies the number of surrogate variables. Set target_cor to NULL to indicate that design_perm and the surrogate variables are independent.

method

Should we use the optimal matching technique from Hansen and Klopfer (2006) ("optmatch"), the Gale-Shapley algorithm for stable marriages ("marriage") (Gale and Shapley, 1962) as implemented in the matchingR package, or the Hungarian algorithm (Papadimitriou and Steiglitz, 1982) ("hungarian") as implemented in the clue package (Hornik, 2005)? The "optmatch" method works really well but does take a lot more computational time if you have, say, 1000 samples. If you use the "optmatch" option, you should note that the optmatch package uses a super strange license: https://cran.r-project.org/package=optmatch/LICENSE. If this license doesn't work for you (because you are not in academia, or because you don't believe in restrictive licenses), then try out the "hungarian" method.

Value

A list with two elements:

design_perm

A row-permuted version of the user-provided design_perm.

latent_var

A matrix of the latent variables on which design_perm was matched.

Author(s)

David Gerard

References


seqgendiff documentation built on July 8, 2020, 5:55 p.m.