Description Usage Arguments Value Author(s) Examples
View source: R/f_convenience_CIplot.R
Function to plot analytic confidence intervals (CI) of matrix elements estimated in psychonetrics.
1 2 3 4 |
x |
A |
matrices |
Vector of strings indicating the matrices to plot CIs for |
alpha_ci |
The alpha level used for the CIs |
alpha_color |
A vector of alphas used for coloring the CIs |
labels |
The labels for the variables associated with the rows of a matrix. |
labels2 |
The labels for the variables associated with the columns of a matrix. Defaults to the value of |
labelstart |
The value to determine if labels are printed to the right or to the left of the CI |
print |
Logical, should the plots also be printed? Only works when one matrix is used in 'matrices' |
major_break |
Numeric indicating the step size between major breaks |
minor_break |
Numeric indicating the step size between minor breaks |
A single ggplot2 object, or a list of ggplot2 objects for each matrix requested.
Sacha Epskamp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ### Example from ?ggm ###
# 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 an empty GGM:
mod0 <- ggm(ConsData, vars = vars)
# Run the model:
mod0 <- mod0 %>% runmodel
# Labels:
labels <- c(
"indifferent to the feelings of others",
"inquire about others' well-being",
"comfort others",
"love children",
"make people feel at ease")
# Plot the CIs:
CIplot(mod0, "omega", labels = labels, labelstart = 0.2)
### Example from ?gvar ###
library("dplyr")
library("graphicalVAR")
beta <- matrix(c(
0,0.5,
0.5,0
),2,2,byrow=TRUE)
kappa <- diag(2)
simData <- graphicalVARsim(50, beta, kappa)
# Form model:
model <- gvar(simData)
# Evaluate model:
model <- model %>% runmodel
# Plot the CIs:
CIplot(model, "beta")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.