Type: Package
Title: Some Multivariate Analyses using Structural Equation Modeling
Version: 1.2
Date: 2026-02-16
Depends: R (≥ 4.3.0), OpenMx
Imports: stats
Encoding: UTF-8
Description: A set of functions for some multivariate analyses utilizing a structural equation modeling (SEM) approach through the 'OpenMx' package. These analyses include canonical correlation analysis (CANCORR), redundancy analysis (RDA), and multivariate principal component regression (MPCR). It implements procedures discussed in Gu and Cheung (2023) <doi:10.1111/bmsp.12301>, Gu, Yung, and Cheung (2019) <doi:10.1080/00273171.2018.1512847>, and Gu et al. (2023) <doi:10.1080/00273171.2022.2141675>.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
LazyLoad: yes
LazyData: yes
ByteCompile: yes
URL: https://github.com/mikewlcheung/mulsem
BugReports: https://github.com/mikewlcheung/mulsem/issues
Suggests: roxygen2
RoxygenNote: 7.3.3
NeedsCompilation: no
Packaged: 2026-02-16 14:16:24 UTC; mikewlcheung
Author: Mike Cheung ORCID iD [aut, cre], Fei Gu ORCID iD [ctb], Yiu-Fai Yung [ctb]
Maintainer: Mike Cheung <mikewlcheung@nus.edu.sg>
Repository: CRAN
Date/Publication: 2026-02-17 01:00:02 UTC

mulSEM: Some Multivariate Analyses using Structural Equation Modeling

Description

A set of functions for some multivariate analyses utilizing a structural equation modeling (SEM) approach through the 'OpenMx' package. These analyses include canonical correlation analysis (CANCORR), redundancy analysis (RDA), and multivariate principal component regression (MPCR). It implements procedures discussed in Gu and Cheung (2023) doi:10.1111/bmsp.12301, Gu, Yung, and Cheung (2019) doi:10.1080/00273171.2018.1512847, and Gu et al. (2023) doi:10.1080/00273171.2022.2141675.

A set of functions for some multivariate analyses utilizing a structural equation modeling (SEM) approach through the 'OpenMx' package. These analyses include canonical correlation analysis (CANCORR), redundancy analysis (RDA), and multivariate principal component regression (MPCR). It implements procedures discussed in Gu and Cheung (2023) doi:10.1111/bmsp.12301, Gu, Yung, and Cheung (2019) doi:10.1080/00273171.2018.1512847, and Gu et al. (2023) doi:10.1080/00273171.2022.2141675.

Author(s)

Maintainer: Mike Cheung mikewlcheung@nus.edu.sg (ORCID)

Other contributors:

Mike W.-L. Cheung mikewlcheung@nus.edu.sg, Fei Gu fgu@vt.edu, Yiu-Fai Yung Yiu-Fai.Yung@sas.com

References

Gu, F., & Cheung, M. W.-L. (2023). A model-based approach to multivariate principal component regression: Selection of principal components and standard error estimates for unstandardized regression coefficients. British Journal of Mathematical and Statistical Psychology, 76(3), 605-622. doi:10.1111/bmsp.12301

Gu, F., Yung, Y.-F., & Cheung, M. W.-L. (2019). Four covariance structure models for canonical correlation analysis: A COSAN modeling approach. Multivariate Behavioral Research, 54(2), 192-223. doi:10.1080/00273171.2018.1512847

Gu, F., Yung, Y.-F., Cheung, M. W.-L., Joo, B.-K., & Nimon, K. (2023). Statistical inference in redundancy analysis: A direct covariance structure modeling approach. Multivariate Behavioral Research, 58(5), 877-893. doi:10.1080/00273171.2022.2141675

See Also

Useful links:

Examples


## Canonical Correlation Analysis
cancorr(X_vars=c("Weight", "Waist", "Pulse"),
        Y_vars=c("Chins", "Situps", "Jumps"),
        data=sas_ex1)

## Redundancy Analysis
rda(X_vars=c("x1", "x2", "x3", "x4"),
    Y_vars=c("y1", "y2", "y3"),
    data=sas_ex2)

## Multivariate Principal Component Regression
mpcr(X_vars=c("AU", "CC", "CL", "CO", "DF", "FB", "GR", "MW"),
     Y_vars=c("IDE", "IEE", "IOCB", "IPR", "ITS"),
     pca="COR", pc_select=1,
     data=Nimon21)



Correlation matrix of a model of motivation

Description

This dataset includes a correlation matrix of 12 variables (n=533) of a model of motivation reported by Chittum, Jones, and Carter (2019).

Usage

Chittum19

Format

A list with the following components:

data

A 12x12 correlation matrix.

n

A sample size (533).

Source

Chittum, J. R., Jones, B. D., & Carter, D. M. (2019). A person-centered investigation of patterns in college students' perceptions of motivation in a course. Learning and Individual Differences, 69, 94-107. doi:10.1016/j.lindif.2018.11.007

References

Gu, F., Yung, Y.-F., Cheung, M. W.-L., Joo, B.-K., & Nimon, K. (2023). Statistical inference in redundancy analysis: A direct covariance structure modeling approach. Multivariate Behavioral Research, 58(5), 877-893. doi:10.1080/00273171.2022.2141675

Examples


data(Chittum19)

## Redundancy Analysis
rda(X_vars=c("Empowerment", "Usefulness", "Success", "Interest", "Caring"),
    Y_vars=c("Final_Exam", "Learning", "Course_Rating", "Instr_Rating",
             "Effort", "Cog_Engage", "Cost"),
    Cov=Chittum19$data, numObs=Chittum19$n)


Correlation matrix of artificial data

Description

This dataset includes a correlation matrix of nine artificial variables used in Table 1 of Lambert, Wildt, and Durand (1988).

Usage

Lambert88

Format

A 9x9 correlation matrix.

Source

Lambert, Z. V., Wildt, A. R., & Durand, R. M. (1988). Redundancy analysis: An alternative to canonical correlation and multivariate multiple regression in exploring interset associations. Psychological Bulletin, 104(2), 282-289. doi:10.1037/0033-2909.104.2.282

References

Gu, F., Yung, Y.-F., Cheung, M. W.-L., Joo, B.-K., & Nimon, K. (2023). Statistical inference in redundancy analysis: A direct covariance structure modeling approach. Multivariate Behavioral Research, 58(5), 877-893. doi:10.1080/00273171.2022.2141675

Examples

data(Lambert88)


## Redundancy Analysis
rda(X_vars=paste0("x", 1:5), Y_vars=paste0("y", 1:4), Cov=Lambert88, numObs=100)


Raw data used in Nimon, Joo, and Bontrager (2021)

Description

This dataset includes the raw data of 13 variables reported by Nimon, Joo, and Bontrager (2021).

Usage

Nimon21

Format

A data frame with 13 variables.

Source

Nimon, K., Joo, B.-K. (Brian), & Bontrager, M. (2021). Work cognitions and work intentions: A canonical correlation study. Human Resource Development International, 24(1), 65-91. doi:10.1080/13678868.2020.1775038

References

Gu, F., & Cheung, M. W.-L. (2023). A Model-based approach to multivariate principal component regression: Selection of principal components and standard error estimates for unstandardized regression coefficients. British Journal of Mathematical and Statistical Psychology, 76(3), 605-622. doi:10.1111/bmsp.12301

Gu, F., Yung, Y.-F., Cheung, M. W.-L., Joo, B.-K., & Nimon, K. (2023). Statistical inference in redundancy analysis: A direct covariance structure modeling approach. Multivariate Behavioral Research, 58(5), 877-893. doi:10.1080/00273171.2022.2141675

Examples


data(Nimon21)

## Redundancy Analysis
rda(X_vars=c("AU", "CC", "CL", "CO", "DF", "FB", "GR", "MW"),
    Y_vars=c("IDE", "IEE", "IOCB", "IPR", "ITS"),
    data=Nimon21)

## Multivariate Principal Component Regression
mpcr(X_vars=c("AU", "CC", "CL", "CO", "DF", "FB", "GR", "MW"),
     Y_vars=c("IDE", "IEE", "IOCB", "IPR", "ITS"),
     pca="COR", pc_select=1,
     data=Nimon21)


Correlation matrix of a model of disgust

Description

This dataset includes a correlation matrix of 13 variables (n=679) between five subscales (y1 to y5) of the Disgust Emotion Scale and eight subscales (x1 to x8) of the Disgust Scale reported by Thorndike (2000, p. 238).

Usage

Thorndike00

Format

A list with the following components:

data

A 13x13 correlation matrix.

n

A sample size (679).

Source

Thorndike, R. M. (2000). Canonical correlation analysis. In H. E. A. Tinsley & S. D. Brown (Eds.), Handbook of applied multivariate statistics and mathematical modeling (pp. 237-263). San Diego, CA: Academic Press.

References

Gu, F., Yung, Y.-F., & Cheung, M. W.-L. (2019). Four covariance structure models for canonical correlation analysis: A COSAN modeling approach. Multivariate Behavioral Research, 54(2), 192-223. doi:10.1080/00273171.2018.1512847

Examples


data(Thorndike00)

## Canonical Correlation Analysis
## Note. We swap the X_vars and Y_vars because cancorr() expects that
## X_vars cannot have more variables than Y_vars.

cancorr(X_vars=c("y1", "y2", "y3", "y4", "y5"),
        Y_vars=c("x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8"),
        Cov=Thorndike00$data, numObs=Thorndike00$n)


Canonical correlation analysis

Description

This function conducts canonical correlation analysis using the OpenMx package. Missing data are handled with the full information maximum likelihood method when raw data are available. It provides standard errors for the estimates.

Usage

cancorr(
  X_vars,
  Y_vars,
  data = NULL,
  Cov = NULL,
  numObs = NULL,
  model = c("CORR-W", "CORR-L", "COV-W", "COV-L"),
  extraTries = 50,
  ...
)

Arguments

X_vars

A vector of characters of the X variables.

Y_vars

A vector of characters of the Y variables.

data

A data frame containing raw data. If NULL, Cov and numObs must be provided.

Cov

A covariance or correlation matrix. Required when data is NULL.

numObs

A sample size. Required when data is NULL.

model

Four models defined in Gu, Yung, and Cheung (2019). CORR and COV refer to analyses of correlation structures and covariance structures, respectively.

extraTries

This function calls OpenMx::mxTryHard() to obtain parameter estimates and their standard errors. extraTries is the number of extra runs. If extraTries=0, OpenMx::mxRun() is called.

...

Additional arguments passed to either OpenMx::mxTryHard() or OpenMx::mxRun().

Value

A list with class CanCorr. It stores the model in OpenMx objects. The fitted object is stored in mx.fit.

Note

cancorr expects the number of variables in Y_vars to be equal to or greater than that in X_vars. If there are fewer in Y_vars, you may swap between X_vars and Y_vars.

Author(s)

Mike W.-L. Cheung mikewlcheung@nus.edu.sg

References

Gu, F., Yung, Y.-F., & Cheung, M. W.-L. (2019). Four covariance structure models for canonical correlation analysis: A COSAN modeling approach. Multivariate Behavioral Research, 54(2), 192-223. doi:10.1080/00273171.2018.1512847

See Also

Thorndike00, sas_ex1

Examples


## Canonical Correlation Analysis
cancorr(X_vars=c("Weight", "Waist", "Pulse"),
        Y_vars=c("Chins", "Situps", "Jumps"),
        data=sas_ex1)


Multivariate Principal Component Regression (MPCR)

Description

Conduct multivariate principal component regression

Usage

mpcr(
  X_vars,
  Y_vars,
  data = NULL,
  Cov = NULL,
  Means = NULL,
  numObs = NULL,
  pca = c("COV", "COR"),
  pc_select = NULL,
  extraTries = 50,
  ...
)

Arguments

X_vars

A vector of characters of the X variables.

Y_vars

A vector of characters of the Y variables.

data

A data frame containing raw data. If NULL, Cov and numObs must be provided.

Cov

A covariance or correlation matrix. Required when data is NULL.

Means

An optional mean vector. Can be provided when data is NULL.

numObs

A sample size. Required when data is NULL.

pca

Whether principal component analysis is based on unstandardized (COV) or standardized (COR) variables.

pc_select

PCs selected in the regression analysis. For example, pc_select=c(1,2) to use the first two PCs in the multiple regression analysis.

extraTries

This function calls OpenMx::mxTryHard() to obtain parameter estimates and their standard errors. extraTries is the number of extra runs. If extraTries=0, OpenMx::mxRun() is called.

...

Additional arguments passed to either OpenMx::mxTryHard() or OpenMx::mxRun().

Details

This function conducts multivariate principal component regression using the OpenMx package. Missing data are handled with the full information maximum likelihood method when raw data are available. It provides standard errors for the estimates.

Value

A list with class MPCR. It stores the model in OpenMx objects. The fitted object is stored in mx.fit.

Author(s)

Mike W.-L. Cheung mikewlcheung@nus.edu.sg

References

Gu, F., & Cheung, M. W.-L. (2023). A model-based approach to multivariate principal component regression: Selection of principal components and standard error estimates for unstandardized regression coefficients. British Journal of Mathematical and Statistical Psychology, 76(3), 605-622. doi:10.1111/bmsp.12301

See Also

Nimon21

Examples


## Multivariate Principal Component Regression
mpcr(X_vars=c("AU", "CC", "CL", "CO", "DF", "FB", "GR", "MW"),
     Y_vars=c("IDE", "IEE", "IOCB", "IPR", "ITS"),
     pca="COR", pc_select=1,
     data=Nimon21)


Print Method for CanCorr Objects

Description

Print method for CanCorr objects.

Usage

## S3 method for class 'CanCorr'
print(x, digits = 4, ...)

Arguments

x

An object returned from the class of CanCorr.

digits

Number of digits in printing the matrices. The default is 4.

...

Unused.

Value

No return value, called for side effects

Author(s)

Mike W.-L. Cheung mikewlcheung@nus.edu.sg


Print Method for MPCR Objects

Description

Print method for MPCR objects.

Usage

## S3 method for class 'MPCR'
print(x, digits = 4, ...)

Arguments

x

An object returned from the class of MPCR.

digits

Number of digits in printing the matrices. The default is 4.

...

Unused.

Value

No return value, called for side effects

Author(s)

Mike W.-L. Cheung mikewlcheung@nus.edu.sg


Print Method for RDA Objects

Description

Print method for RDA objects.

Usage

## S3 method for class 'RDA'
print(x, digits = 4, ...)

Arguments

x

An object returned from the class of RDA.

digits

Number of digits in printing the matrices. The default is 4.

...

Unused.

Value

No return value, called for side effects

Author(s)

Mike W.-L. Cheung mikewlcheung@nus.edu.sg


Redundancy analysis

Description

This function conducts redundancy analysis using the OpenMx package. Missing data are handled with the full information maximum likelihood method when raw data are available. It provides standard errors for the standardized estimates.

Usage

rda(
  X_vars,
  Y_vars,
  data = NULL,
  Cov = NULL,
  numObs = NULL,
  extraTries = 50,
  ...
)

Arguments

X_vars

A vector of characters of the X variables.

Y_vars

A vector of characters of the Y variables.

data

A data frame containing raw data. If NULL, Cov and numObs must be provided.

Cov

A covariance or correlation matrix. Required when data is NULL.

numObs

A sample size. Required when data is NULL.

extraTries

This function calls OpenMx::mxTryHard() to obtain parameter estimates and their standard errors. extraTries is the number of extra runs. If extraTries=0, OpenMx::mxRun() is called.

...

Additional arguments passed to either OpenMx::mxTryHard() or OpenMx::mxRun().

Value

A list with class RDA. It stores the model in OpenMx objects. The fitted object is stored in mx.fit.

Author(s)

Mike W.-L. Cheung mikewlcheung@nus.edu.sg

References

Gu, F., Yung, Y.-F., Cheung, M. W.-L., Joo, B.-K., & Nimon, K. (2023). Statistical inference in redundancy analysis: A direct covariance structure modeling approach. Multivariate Behavioral Research, 58(5), 877-893. doi:10.1080/00273171.2022.2141675

See Also

Chittum19, sas_ex2

Examples


## Redundancy Analysis
rda(X_vars=c("x1", "x2", "x3", "x4"),
    Y_vars=c("y1", "y2", "y3"),
    data=sas_ex2)


Sample data for canonical correlation analysis from the SAS manual

Description

This dataset includes six variables of fitness club data from the SAS manual.

Usage

sas_ex1

Format

A data frame with 20 rows and 6 variables:

Weight

Weight measurement

Waist

Waist measurement

Pulse

Pulse measurement

Chins

Number of chin-ups

Situps

Number of sit-ups

Jumps

Number of jumps

Source

https://documentation.sas.com/doc/en/statcdc/14.2/statug/statug_cancorr_example01.htm

Examples

data(sas_ex1)


## Canonical Correlation Analysis
cancorr(X_vars=c("Weight", "Waist", "Pulse"),
        Y_vars=c("Chins", "Situps", "Jumps"),
        data=sas_ex1)


Sample data for redundancy analysis from the SAS manual

Description

This dataset includes seven variables from the SAS manual.

Usage

sas_ex2

Format

A matrix with 10 rows and 7 columns:

y1, y2, y3

Y variables

x1, x2, x3, x4

X variables

Source

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_transreg_details23.htm

Examples

data(sas_ex2)


## Redundancy Analysis
rda(X_vars=c("x1", "x2", "x3", "x4"),
    Y_vars=c("y1", "y2", "y3"),
    data=sas_ex2)