Title: | Graphing Nonlinear Relations Among Latent Variables from Structural Equation Mixture Models |
---|---|
Description: | Contains a graphical user interface to generate the diagnostic plots proposed by Bauer (2005; <doi:10.1207/s15328007sem1204_1>), Pek & Chalmers (2015; <doi:10.1080/10705511.2014.937790>), and Pek, Chalmers, R. Kok, & Losardo (2015; <doi:10.3102/1076998615589129>) to investigate nonlinear bivariate relationships in latent regression models using structural equation mixture models (SEMMs). |
Authors: | Bethany Kok [aut], Jolynn Pek [aut], Sonya Sterba [ctb], Dan Bauer [ctb], Phil Chalmers [cre, aut] |
Maintainer: | Phil Chalmers <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.4 |
Built: | 2024-11-01 04:24:45 UTC |
Source: | https://github.com/philchalmers/plotsemm |
Graphing Nonlinear Relations Among Latent Variables from Structural Equation Mixture Models
Contains a graphical user interface to generate the diagnostic plots proposed by Bauer (2005) and Pek & Chalmers (2015) to investigate nonlinear latent variable interactions in latent regression models.
Creates plots which accompany Bauers (2005) semiparametric method of modeling
Structural Equation Mixture Models (SEMMs) by allowing researchers to visualize
potential nonlinear relationships between a latent predictor and outcome. Additionally,
a graphical user interface (GUI) is available for interactive use and is found in the function
plotSEMM_GUI
.
Bethany Kok and Phil Chalmers [email protected]
Pek, J. & Chalmers, R. P. (2015). Diagnosing Nonlinearity With Confidence Envelopes for a Semiparametric Approach to Modeling Bivariate Nonlinear Relations Among Latent Variables. Structural Equation Modeling, 22, 288-293. doi:10.1080/10705511.2014.937790
Pek, J., Chalmers, R. P., Kok B. E., & Losardo, D. (2015). Visualizing Confidence Bands for Semiparametrically Estimated Nonlinear Relations among Latent Variables. Journal of Educational and Behavioral Statistics, 40, 402-423. doi:10.3102/1076998615589129
Requires plotSEMM_setup
be run first. Generates (a) the potential nonlinear
regression function; (b) bivariate distribution of the latent variables;
(c) marginal distributions of the latent variables; (d) within class linear
regression functions; and (e) within class marginal distributions for the latent variables.
plotSEMM_contour(SEMLIdatapks, EtaN2 = "Eta2", EtaN1 = "Eta1", classinfo = TRUE, lnty = 3, lncol = 1, title = "", leg = TRUE, cex = 1.5, ...)
plotSEMM_contour(SEMLIdatapks, EtaN2 = "Eta2", EtaN1 = "Eta1", classinfo = TRUE, lnty = 3, lncol = 1, title = "", leg = TRUE, cex = 1.5, ...)
SEMLIdatapks |
object returned from |
EtaN2 |
Label for the X axis. If no value is provided, defaults to "Eta2." |
EtaN1 |
Label for the Y axis. If no value is provided, defaults to "Eta1." |
classinfo |
Logical variable. TRUE shows the lines for each class as well as the combined estimate. FALSE shows only the combined estimate. If no value is provided, defaults to TRUE. |
lnty |
Determines the line types used for the class lines. If no value is provided, defaults to 3.
See |
lncol |
Determines the line colors used for the class lines. If no value is provided, defaults to 1.
See |
title |
Titles the graph. |
leg |
Logical variable. If TRUE, a legend accompanies the graph. If FALSE, no legend appears. Defaults to TRUE. |
cex |
par(cex) value. Default is 1.5 |
... |
addition inputs, mostly from plotSEMM_GUI() |
Bethany Kok and Phil Chalmers [email protected]
Pek, J. & Chalmers, R. P. (2015). Diagnosing Nonlinearity With Confidence Envelopes for a Semiparametric Approach to Modeling Bivariate Nonlinear Relations Among Latent Variables. Structural Equation Modeling, 22, 288-293. doi:10.1080/10705511.2014.937790
Pek, J., Chalmers, R. P., Kok B. E., & Losardo, D. (2015). Visualizing Confidence Bands for Semiparametrically Estimated Nonlinear Relations among Latent Variables. Journal of Educational and Behavioral Statistics, 40, 402-423. doi:10.3102/1076998615589129
## Not run: ## code for latent variables with two classes pi <- c(0.602, 0.398) alpha1 <- c(3.529, 2.317) alpha2 <- c(0.02, 0.336) beta21 <- c(0.152, 0.053) psi11 <- c(0.265, 0.265) psi22 <- c(0.023, 0.023) plotobj <- plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22) plotSEMM_contour(plotobj) plotSEMM_contour(plotobj, EtaN1 = "Latent Predictor", EtaN2 = "Latent Outcome", classinfo = FALSE, lncol = 5) ## End(Not run)
## Not run: ## code for latent variables with two classes pi <- c(0.602, 0.398) alpha1 <- c(3.529, 2.317) alpha2 <- c(0.02, 0.336) beta21 <- c(0.152, 0.053) psi11 <- c(0.265, 0.265) psi22 <- c(0.023, 0.023) plotobj <- plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22) plotSEMM_contour(plotobj) plotSEMM_contour(plotobj, EtaN1 = "Latent Predictor", EtaN2 = "Latent Outcome", classinfo = FALSE, lncol = 5) ## End(Not run)
Graphical user interface with the shiny package. Supports manual input as well as importing from precomputed Mplus files. An online tutorial and additional materials can be found at http://www.yorku.ca/pek/index_files/appendices.htm
plotSEMM_GUI(...)
plotSEMM_GUI(...)
... |
additional arguments passed to |
Phil Chalmers [email protected] and Jolynn Pek
Bauer, D.J. (2005). A semiparametric approach to modeling nonlinear relations among latent variables. Structural Equation Modeling: A Multidisciplinary Journal, 12(4), 513-535.
Pek, J. & Chalmers, R. P. (2015). Diagnosing Nonlinearity With Confidence Envelopes for a Semiparametric Approach to Modeling Bivariate Nonlinear Relations Among Latent Variables. Structural Equation Modeling, 22, 288-293. doi:10.1080/10705511.2014.937790
Pek, J., Chalmers, R. P., Kok B. E., & Losardo, D. (2015). Visualizing Confidence Bands for Semiparametrically Estimated Nonlinear Relations among Latent Variables. Journal of Educational and Behavioral Statistics, 40, 402-423. doi:10.3102/1076998615589129
Pek, J., Losardo, D., & Bauer, D. J. (2011). Confidence intervals for a semiparametric approach to modeling nonlinear relations among latent variables. Structural Equation Modeling, 18, 537-553.
Pek, J., Sterba, S. K., Kok, B. E., & Bauer, D. J. (2009). Estimating and visualizing non-linear relations among latent variables: A semiparametric approach. Multivariate Behavioral Research, 44, 407-436.
## Not run: plotSEMM_GUI() plotSEMM_GUI(launch.browser=TRUE) #if using RStudio, will launch system browser default ## End(Not run)
## Not run: plotSEMM_GUI() plotSEMM_GUI(launch.browser=TRUE) #if using RStudio, will launch system browser default ## End(Not run)
Requires plotSEMM_setup
be run first. Generates a plot which expresses
the mixing probabilities for each latent class conditioned on the latent predictor.
plotSEMM_probability(SEMLIdatapks, EtaName = "Eta1", lnty = 3, lncol = 1, title = "", leg = TRUE, cex = 1.5, ...)
plotSEMM_probability(SEMLIdatapks, EtaName = "Eta1", lnty = 3, lncol = 1, title = "", leg = TRUE, cex = 1.5, ...)
SEMLIdatapks |
object returned from |
EtaName |
Label of the latent predictor. If no value is provided, defaults to Eta1. |
lnty |
Determines the line types used for the class lines. If no value is provided,
defaults to 3. See |
lncol |
Determines the line colors used for the class lines. If no value is
provided, defaults to 1. See |
title |
Titles the graph. |
leg |
Logical variable. If TRUE, a legend accompanies the graph. If FALSE, no legend appears. Defaults to TRUE. |
cex |
par(cex) value. Default is 1.5 |
... |
addition inputs, mostly from plotSEMM_GUI() |
Bethany Kok and Phil Chalmers [email protected]
Pek, J. & Chalmers, R. P. (2015). Diagnosing Nonlinearity With Confidence Envelopes for a Semiparametric Approach to Modeling Bivariate Nonlinear Relations Among Latent Variables. Structural Equation Modeling, 22, 288-293. doi:10.1080/10705511.2014.937790
Pek, J., Chalmers, R. P., Kok B. E., & Losardo, D. (2015). Visualizing Confidence Bands for Semiparametrically Estimated Nonlinear Relations among Latent Variables. Journal of Educational and Behavioral Statistics, 40, 402-423. doi:10.3102/1076998615589129
plotSEMM_setup
, plotSEMM_contour
## Not run: # 2 class empirical example on positive emotions and heuristic processing in # Pek, Sterba, Kok & Bauer (2009) pi <- c(0.602, 0.398) alpha1 <- c(3.529, 2.317) alpha2 <- c(0.02, 0.336) beta21 <- c(0.152, 0.053) psi11 <- c(0.265, 0.265) psi22 <- c(0.023, 0.023) plotobj <- plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22) plotSEMM_probability(plotobj) plotSEMM_probability(plotobj , EtaName = "Latent Predictor", lnty = 2, title = "Probability") ## End(Not run)
## Not run: # 2 class empirical example on positive emotions and heuristic processing in # Pek, Sterba, Kok & Bauer (2009) pi <- c(0.602, 0.398) alpha1 <- c(3.529, 2.317) alpha2 <- c(0.02, 0.336) beta21 <- c(0.152, 0.053) psi11 <- c(0.265, 0.265) psi22 <- c(0.023, 0.023) plotobj <- plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22) plotSEMM_probability(plotobj) plotSEMM_probability(plotobj , EtaName = "Latent Predictor", lnty = 2, title = "Probability") ## End(Not run)
Takes user input generated from SEMM software such as Mplus (Muthen & Muthen, 2007),
Mx (Neale, Boker, Xie & Maes, 2004) or MECOSA (Arminger, Wittenberg, & Schepers, 1996)
in Gauss and generates model predicted data for processing in graphing functions
plotSEMM_contour
and plotSEMM_probability
. Reterns a data.frame
to be passed to other functions in the package.
plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22, points = 50)
plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22, points = 50)
pi |
Vector: K marginal class probabilities. |
alpha1 |
Vector: K means of the latent predictor. |
alpha2 |
Vector: K inercepts slopes from the within-class regression of the latent outcome on the latent predictor. |
beta21 |
Vector: K slopes from the within-class regression of the latent outcome on the latent predictor. |
psi11 |
Vector: K within-class variances of the latent predictor. |
psi22 |
Vector: K within-class variances of the latent outcome. |
points |
number of points to use. Default is 50 |
All the parameter estimates required by the arguments are generated from software with the capability of estimating SEMMs.
Bethany Kok and Phil Chalmers [email protected]
Pek, J. & Chalmers, R. P. (2015). Diagnosing Nonlinearity With Confidence Envelopes for a Semiparametric Approach to Modeling Bivariate Nonlinear Relations Among Latent Variables. Structural Equation Modeling, 22, 288-293. doi:10.1080/10705511.2014.937790
Pek, J., Chalmers, R. P., Kok B. E., & Losardo, D. (2015). Visualizing Confidence Bands for Semiparametrically Estimated Nonlinear Relations among Latent Variables. Journal of Educational and Behavioral Statistics, 40, 402-423. doi:10.3102/1076998615589129
plotSEMM_contour
,plotSEMM_probability
## Not run: # 2 class empirical example on positive emotions and heuristic processing # in Pek, Sterba, Kok & Bauer (2009) pi <- c(0.602, 0.398) alpha1 <- c(3.529, 2.317) alpha2 <- c(0.02, 0.336) beta21 <- c(0.152, 0.053) psi11 <- c(0.265, 0.265) psi22 <- c(0.023, 0.023) plotobj <- plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22) ## End(Not run)
## Not run: # 2 class empirical example on positive emotions and heuristic processing # in Pek, Sterba, Kok & Bauer (2009) pi <- c(0.602, 0.398) alpha1 <- c(3.529, 2.317) alpha2 <- c(0.02, 0.336) beta21 <- c(0.152, 0.053) psi11 <- c(0.265, 0.265) psi22 <- c(0.023, 0.023) plotobj <- plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22) ## End(Not run)