model_singular: Model an individual phenotype using PCSS

View source: R/model_linear_combo.R

model_singularR Documentation

Model an individual phenotype using PCSS

Description

model_singular calculates the linear model for a singular phenotype as a function of a set of predictors.

Usage

model_singular(formula, n, means, covs, ...)

Arguments

formula

an object of class formula whose dependent variable is only variable. All model terms must be accounted for in means and covs.

n

sample size.

means

named vector of predictor and response means.

covs

named matrix of the covariance of all model predictors and the responses.

...

additional arguments

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

\insertRef

wolf_computationally_2020pcsstools

Examples

ex_data <- pcsstools_example[c("g1", "x1", "y1")]
means <- colMeans(ex_data)
covs <- cov(ex_data)
n <- nrow(ex_data)

model_singular(
  y1 ~ g1 + x1,
  n = n, means = means, covs = covs
)
summary(lm(y1 ~ g1 + x1, data = ex_data))

jackmwolf/pcsstools documentation built on July 7, 2024, 7:46 p.m.