Nothing
library(lavaan)
library(semPlot)
mod_pa <-
'x1 ~~ x2
x3 ~ x1 + x2
x4 ~ x1 + x3
'
fit_pa <- lavaan::sem(mod_pa, pa_example)
m <- matrix(c("x1", NA, NA, NA,
NA, "x3", NA, "x4",
"x2", NA, NA, NA), byrow = TRUE, 3, 4)
p_pa <- semPaths(fit_pa, whatLabels = "est",
sizeMan = 10,
edge.label.cex = 1.15,
layout = m,
DoNotPlot = TRUE)
est <- parameterEstimates(fit_pa)
id <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 1)
p_pa_se_chk <- paste0(formatC(est$est[id], digits = 2, format = "f"),
" (",
formatC(est$se[id], digits = 2, format = "f"),
")")
alphas <- c("*" = .05, "**" = .01, "***" = .001)
alphas_sorted <- sort(alphas, decreasing = FALSE)
tmp <- sapply(est$pvalue[id], function(x) {
ind <- which(x < alphas_sorted)[1]
ifelse(is.na(ind), "", names(ind[1]))
})
p_pa_sig_chk <- paste0(formatC(est$est[id], digits = 2, format = "f"),
tmp)
test_that(
"mark_sig: parameter estimate table with user p-values", {
p_pa_sig1 <- mark_sig(p_pa, fit_pa)
p_pa_sig2 <- mark_sig(p_pa, ests = parameterEstimates(fit_pa))
expect_identical(p_pa_sig1$graphAttributes$Edges$labels,
p_pa_sig2$graphAttributes$Edges$labels)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.