sparse_logreg: sparse_logreg

Description Usage Arguments Value Examples

View source: R/sparse_logreg.R

Description

Conduct logistic regression on sparse matrix

Usage

1
sparse_logreg(outcome_column, design_columns, data_frame)

Arguments

outcome_column

the column name of the binary outcome

design_columns

the column names corresponding to the covariates

data_frame

the name of the data frame

Value

A matrix with same number of rows the length of the design_columns argument (corresponding to β estimates) and 4 columns.

Estimate: the estimated coefficients

SE: standard errors

T: T statistics

p_value: p_value of the corresponding statistics

Examples

1
2
3
4
5
6
7
8
# simulate mateix
set.seed(12032020)
sample.space<-c(rep(0,40),seq(1,10))
mat<-matrix(sample(sample.space,50000*100,replace=TRUE),nrow=50000,ncol=100)
mat<-cbind(sample(c(0,1),100,replace=TRUE),mat)
colnames(mat)<-c('environment',paste0('gene',seq(1,100)))
test<-as.data.frame(mat)
log_fit<-sparse_logreg(outcome_column = 'environment',design_columns = paste0('gene',seq(1,15)),data_frame = test)

baikunst/SpaReg documentation built on Dec. 19, 2021, 6:39 a.m.