blimp {misty} | R Documentation |
Create, Run, and Print Blimp Models
Description
This wrapper function creates a Blimp input file, runs the input file by using
the blimp.run()
function, and prints the Blimp output file by using the
blimp.print()
function.
Usage
blimp(x, file = "Blimp_Input.imp", data = NULL, comment = FALSE, replace.inp = TRUE,
blimp.run = TRUE, posterior = FALSE, folder = "Posterior_",
format = c("csv", "csv2", "excel", "rds", "workspace"), clear = TRUE,
replace.out = c("always", "never", "modified"), Blimp = .detect.blimp(),
result = c("all", "default", "algo.options", "data.info", "model.info",
"warn.mess", "error.mess", "out.model", "gen.param"),
exclude = NULL, color = c("none", "blue", "green"),
style = c("bold", "regular"), not.result = TRUE, write = NULL,
append = TRUE, check = TRUE, output = TRUE)
Arguments
x |
a character string containing the Blimp input text. |
file |
a character string indicating the name of the Blimp input
file with or without the file extension |
data |
a matrix or data frame from which the variables names for
the section |
comment |
logical: if |
replace.inp |
logical: if |
blimp.run |
logical: if |
posterior |
logical: if |
folder |
a character string indicating the prefix of the folder for
saving the posterior distributions. The default setting is
|
format |
a character vector indicating the file format(s) for saving the
posterior distributions, i.e., |
clear |
logical: if |
replace.out |
a character string for specifying three settings:
|
Blimp |
a character string for specifying the name or path of the Blimp executable to be used for running models. This covers situations where Blimp is not in the system's path, or where one wants to test different versions of the Blimp program. Note that there is no need to specify this argument for most users since it has intelligent defaults. |
result |
a character vector specifying Blimp result sections included
in the output (see 'Details' in the |
exclude |
a character vector specifying Blimp input command or result
sections excluded from the output (see 'Details' in the
|
color |
a character vector with two elements indicating the colors
used for the main headers (e.g., |
style |
a character vector with two elements indicating the style
used for headers (e.g., |
not.result |
logical: if |
write |
a character string naming a file for writing the output into
a text file with file extension |
append |
logical: if |
check |
logical: if |
output |
logical: if |
Details
VARIABLES
SectionThe
VARIABLES
section used to assign names to the variables in the data set can be specified by using thedata
argument:Write Blimp Data File
: In the first step, the Blimp data file is written by using thewrite.mplus()
function, e.g.write.mplus(data1, file = "data1.dat")
.Specify Blimp Input
: In the second step, the Blimp input is specified as a character string. TheVARIABLES
option is left out from the Blimp input text, e.g.,input <- 'DATA: data1.dat;\nMODEL: y ~ x1@b1 x2@b2 d2;'
.Run Blimp Input
: In the third step, the Blimp input is run by using theblimp()
function. The argumentdata
needs to be specified given that theVARIABLES
section was left out from the Blimp input text in the previous step, e.g.,blimp(input, file = "Ex4.3.imp", data = data1)
.
Note that unlike Mplus, Blimp allows to specify a CSV data file with variable names in the first row. Hence, it is recommended to export the data from R using the
write.csv()
function to specify the data file in theDATA
section of the Blimp input file without specifying theVARIABLES
section.
Value
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
x |
a character vector containing the Blimp input text |
args |
specification of function arguments |
write |
write command sections |
result |
list with result sections ( |
Author(s)
Takuya Yanagida
References
Keller, B. T., & Enders, C. K. (2023). Blimp user’s guide (Version 3). Retrieved from www.appliedmissingdata.com/blimp
See Also
blimp.update
, blimp.run
,
blimp.print
, blimp.plot
, blimp.bayes
Examples
## Not run:
#----------------------------------------------------------------------------
# Example 1: Write data, specify input without VARIABLES section, and run input
# Write Data File
# Note that row.names = FALSE needs to be specified
write.csv(data1, file = "data1.csv", row.names = FALSE)
# Specify Blimp input
input1 <- '
DATA: data1.csv;
ORDINAL: d;
MISSING: 999;
FIXED: d;
CENTER: x1 x2;
MODEL: y ~ x1 x2 d;
SEED: 90291;
BURN: 1000;
ITERATIONS: 10000;
'
# Run Blimp input
blimp(input1, file = "Ex4.3.imp")
#----------------------------------------------------------------------------
# Example 2: Write data, specify input with VARIABLES section, and run input
# Write Data File
write.mplus(data1, file = "data1.dat", input = FALSE)
# Specify Blimp input
input2 <- '
DATA: data1.dat;
VARIABLES: id v1 v2 v3 y x1 d x2 v4;
ORDINAL: d;
MISSING: 999;
FIXED: d;
CENTER: x1 x2;
MODEL: y ~ x1 x2 d;
SEED: 90291;
BURN: 1000;
ITERATIONS: 10000;
'
# Run Blimp input
blimp(input2, file = "Ex4.3.imp")
#----------------------------------------------------------------------------
# Example 3: Alternative specification using the data argument
# Write Data File
write.mplus(data1, file = "data1.dat", input = FALSE)
# Specify Blimp input
input3 <- '
DATA: data1.dat;
ORDINAL: d;
MISSING: 999;
FIXED: d;
CENTER: x1 x2;
MODEL: y ~ x1 x2 d;
SEED: 90291;
BURN: 1000;
ITERATIONS: 10000;
'
# Run Blimp input
blimp(input3, file = "Ex4.3.imp", data = data1)
## End(Not run)