# calculate_lm_combo: Calculate a linear model for a linear combination of... In jackmwolf/pcsstools: Tools for Regression Using Pre-Computed Summary Statistics

 calculate_lm_combo R Documentation

## Calculate a linear model for a linear combination of responses

### Description

`calculate_lm_combo` describes the linear model for a linear combination of responses as a function of a set of predictors.

### Usage

``````calculate_lm_combo(means, covs, n, phi, m = length(phi), add_intercept, ...)
``````

### Arguments

 `means` a vector of means of all model predictors and the response with the last `m` elements the response means (with order corresponding to the order of weights in `phi`). `covs` a matrix of the covariance of all model predictors and the responses with the order of rows/columns corresponding to the order of `means`. `n` sample size. `phi` vector of linear combination weights with one entry per response variable. `m` number of responses to combine. Defaults to `length(weighs)`. `add_intercept` logical. If `TRUE` adds an intercept to the model. `...` 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

\insertRef