fast_lm: Fast linear regression

Description Usage Arguments Details Value Examples

View source: R/fast_lm.R

Description

Fast lm

Usage

1
2
fast_lm(x, y = NULL, bl = NULL, ncore = 2, aggregate = FALSE,
  hdmi_output = NULL, covidx = 1)

Arguments

x

nxp input design matrix. It should not include intercept.

y

qxn outcome matrix. q is number of voxels.

bl

(default=NULL) qxn baseline matrix.

ncore

(default=2) number of clusters registered for parallel processing.

aggregate

(default=FALSE) if TRUE, output betamap and stderrmat instead of tmap.

hdmi_output

the output of hd_mi function

covidx

(default=1) index of covariate of interest in the x matrix. Default is group if group is the first column in the x design matrix.

Details

This function computes linear regression and computes t-scores for multivariate outcomes.

Value

tmaps t-values for each coefficients

df Degree of freedome of each coefficients

Examples

1
2
3
4
5
6
library(neurorct)
y=matrix(rnorm(100*1000),1000,100)
x=cbind(cov1=rnorm(100),cov2=rnorm(100))
system.time(a<-t(apply(y, 1, function(zz)summary(lm(zz~x))$coefficients[,3])))
system.time(a2<-fast_lm(x=x,y=y))
sum(abs(a-a2$tmap))

seonjoo/neurorct documentation built on May 7, 2020, 3:18 a.m.