Description Usage Arguments Value Author(s) References Examples
This function can help you to construct a 2nd-order CFA model with interaction term, and return model fit & factor scores.
1 |
data |
your data. |
model |
A 1-order CFA model formula. |
eta |
First argument of 2-order CFA model. |
ksi |
Second argument of 2-order CFA model. |
method |
Which method you want to use to construct interaction term. 'full' for full model; 'marsh' for marsh model; 'cross' for cross-product. |
product |
If you choose 'cross' method, then you need to give us which combination product you want to use. eg: product=c(f1f4,f2f4) (default=NULL) |
DV |
If you choose 'lms' method, then you need to give us dependent variable in regression model. eg: DV='finalscore' (default=NULL) |
ID |
ID variable. eg: ID='id' (default=NULL) |
Missing_value |
Missing flag in your dataset. eg: If you set -999 as missing, then you need set Missing_value=-999 .(default=NULL) |
data_format |
Mplus format setting. (only in 'lms' method) eg: data_format=(2F8.0, 5F8.2) . (default=NULL) |
save_data |
Should save Mplus file which in D:/Mplus_in_R ? (default=TRUE) |
fit |
a model fit of CFA model (only in 'full', 'marsh', 'cross' model) |
Summaries |
Mplus summaries (only in 'lms' model) |
Parameters |
Mplus Parameters (only in 'lms' model) |
fscore_2inter |
combine your original data with factor scores from the results. |
ml2lab-nctu <mllab.nctu@gmail.com>
Marsh, H. W., Wen, Z., & Hau, K.-T. (2004). Structural Equation Models of Latent Interactions: Evaluation of Alternative Estimation Strategies and Indicator Construction. Psychological Methods, 9(3), 275-300. http://dx.doi.org/10.1037/1082-989X.9.3.275
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | demo_data <- seafooood::demo_data
# Step 1: Construct a 1-order CFA model
CFA_model <-'f1 =~ V1 + V2 +V3
f2 =~ V4 + V5 +V6
f3 =~ V7 + V8 +V9
f4 =~ V10 + V11 +V12
f5 =~ V13 + V14 +V15
f6 =~ V16 + V17 +V18
'
# Step 2-1: choose 'full' model method
full_result <- thx_seafood(data = demo_data,
model = CFA_model,
eta = c('f1','f2','f3'),
ksi = c('f4','f5','f6'),
method = "full"
)
# see model fit
summary(full_result$fit)
# see new data
full_data <- full_result$fscore_2inter
# Step 2-2: choose 'marsh' model method
marsh_result <- thx_seafood(data = demo_data,
model = CFA_model,
eta = c('f1','f2','f3'),
ksi = c('f4','f5','f6'),
method = "marsh"
)
summary(marsh_result$fit)
marsh_data <- marsh_result$fscore_2inter
# Step 2-3: choose 'cross' model method
cross_result <- thx_seafood(data = demo_data,
model = CFA_model,
eta = c('f1','f2','f3'),
ksi = c('f4','f5','f6'),
method = "cross",
product = c('f1f5','f1f6','f2f5')
)
summary(cross_result$fit)
cross_data <- cross_result$fscore_2inter
# Step 2-4: choose 'lms' model method
# file will save in "D:/Mplus_in_R"
lms_result <- thx_seafood(data = ori_data,
model = CFA_model,
eta = c('f1','f2','f3'),
ksi = c('f4','f5','f6'),
method = "lms",
DV = "V19"
)
lms_result$Summaries
lms_result$Parameters
lms_data <- lms_result$fscore_2inter
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.