Learn R Programming

First, make sure that you have the latest version of R on your computer, or at least a very recent version. To install the package from GitHub, type the following commands in your R or RStudio console:

install package dependencies first

install.packages("mgcv")

install.packages("ggm")

install and load devtools to be able to install packages from GitHub with install_github

install.packages("devtools")

library(devtools)

The graph package is no longer on CRAN, but is on BiocManager

install.packages("BiocManager")

BiocManager::install("graph")

install pwSEM from Bill's GitHub

install_github("BillShipley/pwSEM",dependencies=TRUE,build_vignettes=TRUE)

or

library(pak)

pak::pkg_install("BillShipley/pwSEM")

library(pwSEM)

?pwSEM

If everything worked, the last command should have opened the help file for the pwSEM function. If things do not work Step 1

Read the error messages and make sure all packages dependencies are installed and loaded, especially package mgcv and ggm. If a message says that a package could not be loaded, try installing it manually by typing:

manually installing dependencies

install.packages("packagename")

until all packages are installed. A current bug in install_github on Windows prevents the installation of package dependencies of dependencies (mgcv and ggm). Step 2

Although this should not be required, for certain packages with compiled code, Rtools and MiKTeX need to be installed on Windows to be able to build source packages. For Mac users, Xcode is required and can be installed through the apple store. Here is a more detailed list of prerequisites for building source packages for Windows, Mac and Linux. Step 3

In case something goes wrong with the package installation and the previous instructions do not work, here is the code for every function in the package. The code can be copied and pasted in the R console to get the definition of all functions. However, in this case, help files won't be available.

Copy Link

Version

Install

install.packages('pwSEM')

Monthly Downloads

116

Version

1.0.0

License

MIT + file LICENSE

Maintainer

Bill Shipley

Last Published

July 2nd, 2025

Functions in pwSEM (1.0.0)

vanishing.tetrads

The vanishing.tetrads function
view.paths

view.paths
sim_tetrads

sim_tetrads: Simulated data to be used with the vanishing.tetrads function Data generated using this directed acyclic graph, with L being latent: L->X1, L->X2, L->X3->X4
DAG.to.MAG.in.pwSEM

Title DAG.to.MAG.in.pwSEM
perm.generalized.covariance

perm.generalized.covariance
nested_data

nested_data:
basiSet.MAG

basiSet.MAG
CI.algorithm

The CI.algorithm function
MAG.to.DAG.in.pwSEM

Title MAG.to.DAG.in.pwSEM
get.AIC

Title get.AIC
pwSEM

The pwSEM function
generalized.covariance

Generalized covariance function
MCX2

Title Monte Carlo chi-square (MCX2)
sim_poisson.no.nesting

sim_poisson.no.nesting: Simulated data with correlated errors involving endogenous variables, Poisson-distributed data and without any grouping structure Data generated using this mixed acyclic graph: X1->X2->X3->X4 and X2<->X4
sim_normal.no.nesting

sim_normal.no.nesting Simulated data with correlated errors involving endogenous variables, normally-distributed data and without any grouping structure Data generated using this mixed acyclic graph: X1->X2->X3->X4 and X2<->X4
sim_normal.with.nesting

sim_normal.with.nesting: Simulated data with correlated errors involving endogenous variables, normally-distributed data and without any grouping structure Data generated using this mixed acyclic graph: X1->X2->X3->X4 and X2<->X4
summary.pwSEM.class

Summary Method for pwSEM Class