lm_count_mat_permute: Fast linear regression

View source: R/permutation_lm_count_mat.R

lm_count_mat_permuteR Documentation

Fast linear regression

Description

Calculated associtation single gene count with multiple residual permutation as outcome

Usage

lm_count_mat_permute(
  residual_permutation,
  covariates_string,
  pheno,
  single_transcript
)

Arguments

residual_permutation

Matrix of residual of permuation

covariates_string

A character string with specifying the covariats, include "as.factor" statements. example: covariate_string = "age,as.factor(sex)"

pheno

Phenotype data, includes the trait and covariates.

single_transcript

A vector of single transcript

Value

Linear regression results of single gene permutation a data frame with columns permute(number of permute), beta,se,t_stat (t-statistic),p_value (permutation)

Examples

data(phenotype)
data(rnaseq_count_matrix)
rnaseq_count_matrix<- rnaseq_count_matrix[rowSums(rnaseq_count_matrix)>0,]
data("ENSG00000000003")
covariates_string<-"Age+Sex"
trait<-"Trait.1"
n_permute<- 100
permuted_trait<- sapply(seq_len(n_permute), function(x){
              permute_resids_trait(pheno = phenotype,
              trait = trait,
              covariates_string = covariates_string)})
lm_count_mat_permute(residual_permutation=permuted_trait ,covariates_string=covariates_string,
                      pheno=phenotype ,single_transcript= ENSG00000000003)

nkurniansyah/Olivia documentation built on July 29, 2023, 9:10 a.m.