# netSEMm: network Structural Equation Modeling (netSEM) In netSEM: Network Structural Equation Modeling

## Description

This function carries out netSEM

## Usage

 ```1 2``` ```netSEMm(x, exogenous = NULL, endogenous = NULL, nlsInits = data.frame(a1 = 1, a2 = 1, a3 = 1), str = FALSE) ```

## Arguments

 `x` A dataframe. By default it considers all columns as exogenous variables, except first column which stores the system endogenous variable. `exogenous, ` by defult it consideres all columns as exogenous variables except column number 1, which is the main endogenous response. `endogenous` A character string of the column name of the main endogenous OR a numeric number indexing the column of the main endogenous. `nlsInits` a data frame of initial vectors for nls. Each column corresponds to a coefficient. The data frame can be generated by the genInit() function. Each row is one initial vecotor. Currently the only nls function included is y = a + b * exp(c * x). `str` A boolean, whether or not this is a 'strength' type problem

## Details

netSEM builds a network model of multiple continuous variables. Each pair of variables is tested for sensible paring relation chosen from 7 pre-selected common functional forms in linear regression settings. Adjusted R-squared is used for model selection for every pair.

P-values reported in the "res.print" field of the return list contains the P-values of estimators of linear regression coefficients. The P-values are ordered in the common order of coefficients, i.e. in the order of increasing exponents. For example, in the quadratic functional form y ~ b0 + b1x + b2x^2, the three P-values correspond two those of \hatb0, \hatb1 and \hatb2, respectively. If there are less than 3 coefficients to estimate, the extra P-value field is filled with NA's.

## Value

An object of class netSEM, which is a list of the following items:

• "table": A matrix. For each row, first column is the endogenous variable, second column is the predictor, the other columns show corresponding summary information: Best functional form, R-squared, adj-R-squared, P-value1, P-value2 and P-value3. The P-values correspond to those of estimators of linear regression coefficients. See details.

• "bestModels": A matrix. First dimension indicates predictors. The second dimension indicates endogenous variables. The i-jth cell of the matrix stores the name of the best functional form corresponding to the j-th endogenous variable regressed on the i-th predictor.

• "allModels": A three dimensional list. The first dimension indicates predictors. The second dimension indicates endogenous variables. Third dimension indicates the fitting results of all 6 functional forms. The i-j-k-th cell of the list stores a "lm" object, corresponding to the j-th endogenous, i-th predictor and the k-th functional form.

The object has two added attributes:

• "attr(res.best, "Step")": A vector. For each variable, it shows in which step it is choosen to be significantly related to endogenous variable.

• "attr(res.best, "diag.Step")": A matrix. First dimension is predictors; second dimension is endogenous variables. Each cell shows in which step the pairwise relation is being fitted.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23``` ```## Load the sample acrylic data set data(acrylic) ## Run netSEM ans <- netSEMm(acrylic) ## Subset dataset res <- subsetData(ans,cutoff=c(0.3,0.6,0.8)) ## Plot the network model with adjusted-R-squred of c(0.3,0.6,0.8) plot(ans,res) ## Summary summary(ans) ## Extract relations between IrradTot and IAD2 cf <- path(ans,from ="IAD2",to="IrradTot") print(cf) ## Print three components of the result ans\$table ans\$bestModels ans\$allModels ```

netSEM documentation built on May 2, 2019, 6:32 a.m.