Package 'plotSEMM'

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

Help Index


Graphing Nonlinear Relations Among Latent Variables from Structural Equation Mixture Models

Description

Graphing Nonlinear Relations Among Latent Variables from Structural Equation Mixture Models

Details

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.

Author(s)

Bethany Kok and Phil Chalmers [email protected]

References

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


Nonlinear regression function

Description

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.

Usage

plotSEMM_contour(SEMLIdatapks, EtaN2 = "Eta2", EtaN1 = "Eta1",
  classinfo = TRUE, lnty = 3, lncol = 1, title = "", leg = TRUE,
  cex = 1.5, ...)

Arguments

SEMLIdatapks

object returned from plotSEMM_setup

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 par for information about line type.

lncol

Determines the line colors used for the class lines. If no value is provided, defaults to 1. See par for information about line type.

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()

Author(s)

Bethany Kok and Phil Chalmers [email protected]

References

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

Examples

## 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)

PlotSEMM GUI

Description

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

Usage

plotSEMM_GUI(...)

Arguments

...

additional arguments passed to shiny::runApp, such as launch.browser = TRUE

Author(s)

Phil Chalmers [email protected] and Jolynn Pek

References

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.

Examples

## Not run: 
plotSEMM_GUI()
plotSEMM_GUI(launch.browser=TRUE) #if using RStudio, will launch system browser default

## End(Not run)

Probability plot

Description

Requires plotSEMM_setup be run first. Generates a plot which expresses the mixing probabilities for each latent class conditioned on the latent predictor.

Usage

plotSEMM_probability(SEMLIdatapks, EtaName = "Eta1", lnty = 3, lncol = 1,
  title = "", leg = TRUE, cex = 1.5, ...)

Arguments

SEMLIdatapks

object returned from plotSEMM_setup

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 par for information about line type.

lncol

Determines the line colors used for the class lines. If no value is provided, defaults to 1. See par for information about line type.

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()

Author(s)

Bethany Kok and Phil Chalmers [email protected]

References

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

See Also

plotSEMM_setup, plotSEMM_contour

Examples

## 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)

Set up function for plotSEMM

Description

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.

Usage

plotSEMM_setup(pi, alpha1, alpha2, beta21, psi11, psi22, points = 50)

Arguments

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

Details

All the parameter estimates required by the arguments are generated from software with the capability of estimating SEMMs.

Author(s)

Bethany Kok and Phil Chalmers [email protected]

References

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

See Also

plotSEMM_contour,plotSEMM_probability

Examples

## 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)