Learn R Programming

jackstraw (version 1.1)

lfa.corpcor: Logistic Factor Analysis without C++ Dependency

Description

Estimate populatoin structure in genome-wide genotype matrices.

Usage

lfa.corpcor(x, d, ltrace = FALSE)

Arguments

x

a matrix with m loci (rows) and n observations (columns).

d

a number of logistic factors.

ltrace

a logical indicator as to whether to print the progress.

Value

lfa.corpcor returns a n*d matrix of d logistic factors. The last column is always an intercept term.

Details

It performs the logistic factor analysis, similar to lfa function in the lfa package. This function works without C++ dependencies. However, it would be much slower, does not include any other LFA-related functions, checks, and warnings.

See Also

jackstraw.LFA

Examples

Run this code
# NOT RUN {
set.seed(1234)
## simulate genotype data from a logistic factor model
m=5000; n=100; pi0=.9
m0 = round(m*pi0)
m1 = m-round(m*pi0)
B = matrix(0, nrow=m, ncol=1)
B[1:m1,] = matrix(runif(m1*n, min=-.5, max=.5), nrow=m1, ncol=1)
L = matrix(rnorm(n), nrow=1, ncol=n)
BL = B %*% L
prob = exp(BL)/(1+exp(BL))

dat = matrix(rbinom(m*n, 2, as.numeric(prob)), m, n)
out = lfa.corpcor(x=dat, d=2)
# }

Run the code above in your browser using DataLab