prune: Stepdown model search by pruning non-significant parameters.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/e_modelmodifications_prune.R

Description

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

Usage

1
2
3
4
5
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, ...)

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.

...

Arguments sent to runmodel

Value

An object of the class psychonetrics (psychonetrics-class)

Author(s)

Sacha Epskamp

See Also

stepup

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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)

Example output

Registered S3 methods overwritten by 'huge':
  method    from   
  plot.sim  BDgraph
  print.sim BDgraph
This is psychonetrics 0.8! Note: this is BETA software! Please mind that the package may not be stable and report any bugs! For more information, please see psychonetrics.org, for questions and issues, please see github.com/SachaEpskamp/psychonetrics.

Attaching package:psychonetricsThe following object is masked frompackage:graphics:

    identify


Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union

Warning message:
`arrange_()` is deprecated as of dplyr 0.7.0.
Please use `arrange()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 

psychonetrics documentation built on Oct. 26, 2021, 1:06 a.m.