stat.lm: Extracts statistical measures of interest in Linear Model

View source: R/stat.lm.R

stat.lmR Documentation

Extracts statistical measures of interest in Linear Model

Description

Performs correlations Generalized Linear Models tests and extracts estimates of predictor factors in each permuted model.

Usage

stat.lm(
  ant,
  formula,
  oda,
  progress = TRUE,
  method = "qr",
  model = TRUE,
  x = FALSE,
  y = FALSE,
  qr = TRUE,
  singular.ok = TRUE,
  contrasts = NULL,
  ...
)

Arguments

ant

an output of ANT function perm.net.nl without any random factor declared, or output of ANT 'met' categories functions in which output of ANT functions perm.ds.focal, perm.ds.grp or perm.net.lk where single matrices were used.

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

oda

the original data frame of associations when argument ant is obtained with perm.ds.grp or perm.ds.focal ANT functions.

progress

a boolean indicating the visualization of the permutation process.

method

the method to be used; for fitting, currently only method = "qr" is supported; method = "model.frame" returns the model frame (the same as with model = TRUE, see below).

model

logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response, the QR decomposition) are returned.

x

logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response, the QR decomposition) are returned.

y

logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response, the QR decomposition) are returned.

qr

logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response, the QR decomposition) are returned.

singular.ok

logical. If FALSE (the default in S but not in R) a singular fit is an error.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

...

Extra arguments for lm function only.

Details

This function is the first step for performing t-tests in permuted data. For more details on t-tests, see R documentation.

Value

Returns a list of 3 elements :

  • An object of class "lm" or for multiple responses of class c("mlm", "lm").

  • A data frame if the estimates of the permuted models.

  • A vector of integers indicating the permutations that returned model errors or warnings (e.g. model convergence issues) and for which new permutations were done.

Author(s)

Sebastian Sosa, Ivan Puga-Gonzalez.

References

Chambers, J. M. (1992) Linear models. Chapter 4 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

Wilkinson, G. N. and Rogers, C. E. (1973) Symbolic descriptions of factorial models for analysis of variance. Applied Statistics, 22, 392–9.

See Also

lm

Examples

t=met.strength(sim.m,sim.df,1) # Computing network metric
t=perm.net.nl(t,labels='age',rf=NULL,nperm=10,progress=FALSE) # Node label permutations
r.lm=stat.lm(t,formula = strength ~ age,progress=FALSE) # Permuted LM

SebastianSosa/ant documentation built on Sept. 23, 2023, 7:06 a.m.