lfa: Logistic factor analysis

Description Usage Arguments Details Value Note Examples

View source: R/lfa.R

Description

Fit a factor model of dimension d for binomial data. Returns logistic factors.

Usage

1
lfa(X, d, adjustments = NULL, override = FALSE, safety = FALSE)

Arguments

X

a matrix of SNP genotypes, i.e. an integer matrix of 0's, 1's, and 2's. Sparse matrices of class Matrix are not supported (yet).

d

number of logistic factors, including the intercept

adjustments

a matrix of adjustment variables to hold fixed during estimation.

override

optional boolean to bypass Lanczos bidiagonalization SVD. Usually not advised unless encountering a bug in the SVD code.

safety

optional boolean to bypass checks on the genotype matrices, which require a non-trivial amount of computation.

Details

This function performs logistic factor analysis on SNP data. As it stands, we follow the convention where d=1 is intercept only, and for d>1 we compute d-1 singular vectors and postpend the intercept.

Value

matrix of logistic factors, with the intercept at the end.

Note

Genotype matrix is expected to be a matrix of integers with values 0, 1, and 2. Note that the coding of the SNPs does not affect the algorithm.

Examples

1
2
3
LF <- lfa(hgdp_subset, 4)
dim(LF)
head(LF)

Example output

[1] 159   4
            [,1]       [,2]         [,3] [,4]
[1,] -0.03635636 0.10431465 -0.026157330    1
[2,] -0.04618695 0.10283828 -0.014107285    1
[3,] -0.02800495 0.09071295 -0.030261474    1
[4,] -0.03513497 0.08332765 -0.002122198    1
[5,] -0.03064114 0.07938743 -0.021696325    1
[6,] -0.02442314 0.06953981 -0.005312549    1

lfa documentation built on Nov. 8, 2020, 7:30 p.m.

Related to lfa in lfa...