path: Extract Path Coefficients

Description Usage Arguments Details Value Examples

Description

Extract and display an equation of a pairwise path between two variables.

Usage

1
path(x, from, to, round = 3)

Arguments

x

object of class "sgSEMp1", which is the return value of function sgSEMp1().

from

character string. Name of the predictor.

to

character string. Name of the response variable.

round

a positive integer. The coefficients are rounded to this decimal place.

Details

Extract the "best" model between any two variables. The model name and the model equation are printed on screen. The model coefficients, as well as the model R object are also returned.

Value

A list of the following items: 1) model: the best fitted model, 2) model.print: a character string of the model equation and 3) coefs: Model coefficients vector.

Examples

1
2
3
4
5
6
7
8
9
##' ## Load the sample acrylic data set
data(acrylic)

## Run semi-gSEM principle one
ans <- sgSEMp1(acrylic, predictor = "IrradTot", response = "YI")

## Extract relations between IrradTot and IAD2
cf <- path(ans, from = "IrradTot", to = "IAD2")
print(cf)

Example output

Working on  YI ~ IrradTot 
Working on  YI ~ IAD1 
Working on  YI ~ IAD2 
Working on  YI ~ IAD2p 
Working on  YI ~ IAD3 
Working on  IAD1 ~ IrradTot 
Working on  IAD1 ~ IAD2 
Working on  IAD1 ~ IAD2p 
Working on  IAD1 ~ IAD3 
Working on  IAD2 ~ IrradTot 
Working on  IAD2 ~ IAD1 
Working on  IAD2 ~ IAD2p 
Working on  IAD2 ~ IAD3 
Working on  IAD2p ~ IrradTot 
Working on  IAD2p ~ IAD1 
Working on  IAD2p ~ IAD2 
Working on  IAD2p ~ IAD3 
Working on  IAD3 ~ IrradTot 
Working on  IAD3 ~ IAD1 
Working on  IAD3 ~ IAD2 
Working on  IAD3 ~ IAD2p 
Model type: Quad 
Model equation (round = 3):
[1] "IAD2 = -0.001 - 0 * IrradTot - 0 * IrradTot^2"
$model

Call:
lm(formula = "IAD2~IrradTot+I(IrradTot^2)", data = x)

Coefficients:
  (Intercept)       IrradTot  I(IrradTot^2)  
   -8.417e-04      4.092e-05     -1.085e-07  


$model.print
[1] "IAD2 = -0.001 - 0 * IrradTot - 0 * IrradTot^2"

$coefs
  (Intercept)      IrradTot I(IrradTot^2) 
       -0.001         0.000         0.000 

gSEM documentation built on May 2, 2019, 11:27 a.m.

Related to path in gSEM...