createStrumModel(formulas, ascertainment = NULL, defaultError = '', assumeExogCovariate = TRUE, fixLoadingToOne = TRUE)
strumModel
.
strum
function. The formulas argument is given as a charactor string of several expressions that defines the relationship among the variables. Blank lines and comments (line start with #) can be included between formulas.
Three different equations are allowed in the formulas syntax:
The "=~" operator may be read as "measured by" and it specifies the measurement model equations in the model. The left hand side of the "=~" must contain one unobserved or latent factors. The right hand side of the "=~" are observed variables, observed covariates, and/or any measurement errors enclosed with "<>".
The "~" operator specifies the structural equations in the model. The left hand side of the "~" must contain one unobserved or latent factor variable name. The right hand side of the "~" are unobserved or latent factors, observed covariates, and/or any random effects enclosed with "<>".
By default, the endogenous error terms are uncorrelated, but the exogenous variables are correlated. To add a correlation between endogenous terms, use "cov" operator. For example,
cov(x,y) = NA.
By default, the value of fixLoadingToOne
equals TRUE, setting
the first indicator variable for each factor to have a coefficient of 1. To
disable this option selectively for a coefficient to be estimated, use "coef"
operator. For example,
coef(y1,z1) = NA.
The "=" operator specifies the constraints in the model, i.e., fixing a model parameter - fixed variance, fixed covariance, or fixed coefficient. The left hand side of the "=" must contain a reserved word for constraint - "var", "cov", or "coef" - with one or two variable names depending on the word. The right hand side of the "=" is a fixed value. Here are some examples:
var(stress) = .1
cov(z1,z2) = 4
coef(y1,z1) = 2
If a random effect such as p
, e
, a
or c
is not included in the model formulas, then, by default, the value of
defaultError
is included in the model. For quantitative traits, the
e
term should always be present. Therefore, the program automatically
include e
term even if no error terms are specified either in
formulas
nor in defaultError
.
Note again that "a" (additive), "p" (polygenic), "c" (common environmental) and "e"(independent environmental) are reserved variable names to specify a type of variance component, so that may not be used as input arguments.
strumModel
# Model formulas.
#----------------
strumForm = 'bp =~ SBP + DBP
anger =~ A1 + A2 + A3
stress =~ S1 + S2 + S3
bp ~ anger + stress + <p,e>
stress ~ anger + rs6040343
var(stress)=.1
'
# Create a strumModel.
#---------------------
myStrumModel = createStrumModel(
formulas = strumForm,
ascertainment = "disease"
)
Run the code above in your browser using DataLab