stat.glm: Permuted Generalized Linear Model

View source: R/stat.glm.R

stat.glmR Documentation

Permuted Generalized Linear Model

Description

Performs Generalized Linear Models tests and computes permuted p-values

Usage

stat.glm(
  ant,
  oda,
  formula,
  family = "gaussian",
  progress = TRUE,
  start = NULL,
  control = list(...),
  model = TRUE,
  method = "glm.fit",
  x = FALSE,
  y = TRUE,
  contrasts = NULL,
  ...
)

Arguments

ant

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

oda

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

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’.

family

a description of the error distribution and link function to be used in the model. For glm this can be a character string naming a family function, a family function or the result of a call to a family function. For glm.fit only the third option is supported, see glm and family.

progress

a boolean indicating the visualization of the permutation process.

start

starting values for the parameters in the linear predictor.

control

a list of parameters for controlling the fitting process.

model

a logical value indicating whether model frame should be included as a component of the returned value.

method

the method to be used in fitting the model. The default method "glm.fit" uses iteratively reweighted least squares (IWLS): the alternative "model.frame" returns the model frame and does no fitting.

x, y

For glm: logical values indicating whether the response vector and model matrix used in the fitting process should be returned as components of the returned value.

contrasts

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

...

Extra arguments for glm function only.

Details

This function is the first step in the process to create a t-test in permuted data. For more details on t-tests, see R documentation.

Value

Returns a list of 3 elements :

  • An object of class inheriting from "glm" which inherits from the class "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

Dobson, A. J. (1990) An Introduction to Generalized Linear Models. London: Chapman and Hall.

Hastie, T. J. and Pregibon, D. (1992) Generalized linear models. Chapter 6 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

McCullagh P. and Nelder, J. A. (1989) Generalized Linear Models. London: Chapman and Hall.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer.

See Also

glm

Examples

t=met.degree(sim.m, sym = TRUE,sim.df,1) # Computing network metric
t=perm.net.nl(t,labels='age',rf=NULL,nperm=10,progress=FALSE) # Node label permutations
r.glm=stat.glm(ant = t,formula = degree ~ age,progress=FALSE) # Permuted GLM

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