prune function

Stepdown model search by pruning non-significant parameters.

Stepdown model search by pruning non-significant parameters.

This function will (recursively) remove parameters that are not significant and refit the model.

prune(x, alpha = 0.01, adjust = c("none", "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr"), matrices, runmodel = TRUE, recursive = FALSE, verbose, log = TRUE, identify = TRUE, startreduce = 1, limit = Inf, mode = c("tested","all"), ...)

Arguments

  • x: A psychonetrics model.
  • alpha: Significance level to use.
  • adjust: p-value adjustment method to use. See p.adjust.
  • matrices: Vector of strings indicating which matrices should be pruned. Will default to network structures.
  • runmodel: Logical, should the model be evaluated after pruning?
  • recursive: Logical, should the pruning process be repeated?
  • verbose: Logical, should messages be printed?
  • log: Logical, should the log be updated?
  • identify: Logical, should models be identified automatically?
  • startreduce: A numeric value indicating a factor with which the starting values should be reduced. Can be useful when encountering numeric problems.
  • limit: The maximum number of parameters to be pruned.
  • mode: Mode for adjusting for multiple comparisons. Should all parameters be considered as the total number of tests or only the tested parameters (parameters of interest)?
  • ...: Arguments sent to runmodel

Returns

An object of the class psychonetrics (psychonetrics-class )

Author(s)

Sacha Epskamp

See Also

stepup

Examples

# Load bfi data from psych package: library("psychTools") data(bfi) # Also load dplyr for the pipe operator: library("dplyr") # Let's take the agreeableness items, and gender: ConsData <- bfi %>% select(A1:A5, gender) %>% na.omit # Let's remove missingness (otherwise use Estimator = "FIML) # Define variables: vars <- names(ConsData)[1:5] # Let's fit a full GGM: mod <- ggm(ConsData, vars = vars, omega = "full") # Run model: mod <- mod %>% runmodel # Prune model: mod <- mod %>% prune(adjust = "fdr", recursive = FALSE)
  • Maintainer: Sacha Epskamp
  • License: GPL-2
  • Last published: 2024-06-20