prune {psychonetrics} | R Documentation |
Stepdown model search by pruning non-significant parameters.
Description
This function will (recursively) remove parameters that are not significant and refit the model.
Usage
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 |
alpha |
Significance level to use. |
adjust |
p-value adjustment method to use. See |
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 |
Value
An object of the class psychonetrics (psychonetrics-class)
Author(s)
Sacha Epskamp
See Also
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)