Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

calculate_lm

Calculate a linear model using PCSS


Description

calculate_lm describes the linear model of the last listed variable in means and covs as a function of all other variables in means and covs.

Usage

calculate_lm(
  means,
  covs,
  n,
  add_intercept = FALSE,
  keep_pcss = FALSE,
  terms = NULL
)

Arguments

means

a vector of means of all model predictors and the response with the last element the response mean.

covs

a matrix of the covariance of all model predictors and the response with the order of rows/columns corresponding to the order of means.

n

sample size

add_intercept

logical. If TRUE adds an intercept to the model.

keep_pcss

logical. If TRUE, returns means and covs.

terms

terms

Value

an object of class "pcsslm".

An object of class "pcsslm" is a list containing at least the following components:

call

the matched call

terms

the terms object used

coefficients

a p x 4 matrix with columns for the estimated coefficient, its standard error, t-statistic and corresponding (two-sided) p-value.

sigma

the square root of the estimated variance of the random error.

df

degrees of freedom, a 3-vector p, n-p, p*, the first being the number of non-aliased coefficients, the last being the total number of coefficients.

fstatistic

a 3-vector with the value of the F-statistic with its numerator and denominator degrees of freedom.

r.squared

R^2, the 'fraction of variance explained by the model'.

adj.r.squared

the above R^2 statistic 'adjusted', penalizing for higher p.

cov.unscaled

a p x p matrix of (unscaled) covariances of the coef[j], j=1,...p.

Sum Sq

a 3-vector with the model's Sum of Squares Regression (SSR), Sum of Squares Error (SSE), and Sum of Squares Total (SST).

References

Wolf JM, Westra J, Tintle N (2021). “Using summary statistics to evaluate the genetic architecture of multiplicative combinations of initially analyzed phenotypes with a flexible choice of covariates.” bioRxiv. doi: 10.1101/2021.03.08.433979, https://www.biorxiv.org/content/10.1101/2021.03.08.433979v1.

Wolf JM, Barnard M, Xia X, Ryder N, Westra J, Tintle N (2020). “Computationally efficient, exact, covariate-adjusted genetic principal component analysis by leveraging individual marker summary statistics from large biobanks.” Pacific Symposium on Biocomputing, 25, 719–730. ISSN 2335-6928, doi: 10.1142/9789811215636_0063, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6907735/.

Gasdaska A, Friend D, Chen R, Westra J, Zawistowski M, Lindsey W, Tintle N (2019). “Leveraging summary statistics to make inferences about complex phenotypes in large biobanks.” Pacific Symposium on Biocomputing, 24, 391–402. ISSN 2335-6928, doi: 10.1142/9789813279827_0036, https://pubmed.ncbi.nlm.nih.gov/30963077/.


pcsstools

Tools for Regression Using Pre-Computed Summary Statistics

v0.1.1
GPL (>= 3)
Authors
Jack Wolf [aut, cre, cph] (<https://orcid.org/0000-0002-8919-8740>), R Core Team and contributors worldwide [cph, aut] (Author and copyright holder of modified 'stats' fragments)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.