Learn R Programming

gSEM (version 0.4.3.4)

sgSEMp2: Semi-supervised Generalized Structural Equation Modelling (gSEM) - Principle 2

Description

This function builds an gSEM model using gSEM principle 2. Principle 2 resembles the multiple regression principle in the way multiple predictors are considered simultaneously. Specifically, the first-level predictors to the system level variable, such as, Time and unit level variables, acted on the system level variable collectively by an additive model. This collective additive model can be found with a generalized stepwise variable selection (using the step() function in R, which performs variable selection on the basis of AIC) and this proceeds iteratively.

Usage

sgSEMp2(x, predictor = NULL, response = NULL)

Arguments

x
A dataframe, requiring at least 2 columns. By default its first column stores the main or primary influencing predictor, or exogenous variable e.g.., time, or a main predictor, the second column stores the response variable, and other columns store intermediate variables.
predictor
A character string of the column name of the system predictor OR a numeric number indexing the column of the main predictor.
response
A character string of the column name of the main response OR a numeric number indexing the column of the system response.

Value

A list of the following items:
  • "Graph": A network graph that contains the group and individual relationships between response and predictors determined by principle 2.
  • "res.print": A matrix. For each row, first column is the response variable, second column is the predictor, the other columns show corresponding summary information.

Details

Data is analysed first using Principle 1 to find the best models. If needed, transformations based on the best models are applied to the predictors. Starting from the system response variable, each variable is regressed on all other variables except for the system response in an additive multiple regression model, which is reduced by a stepwise selection using stepAIC(). Then, for each selected variable, fitted regression for 6 selected functional forms and pick the best.

See Also

sgSEMp1() and plot.sgSEMp2()

Examples

Run this code
# Using built-in dataset
data(acrylic)
ans <- sgSEMp2(acrylic)
ans$res.print
plot(ans)

## Not run: 
# # Using simulated data
# x4=runif(100,0,2)
# x3=1+2.5*x4+rnorm(100,0,0.5)
# x1=runif(100,1,4)
# x2=-1-x1+x3+rnorm(100,0,0.3)
# y=2+2*exp(x1/3)+(x2-1)^2-x3+rnorm(100,0,0.5)
# # Check the pairwise plot 
# sim=cbind(x4,y,x1,x2,x3)
# pairs(sim)
# ans <- sgSEMp2(as.data.frame(sim))
# plot(ans)
# ## End(Not run)

Run the code above in your browser using DataLab