xmu_make_mxData | R Documentation |
xmu_make_mxData
is an internal function to upgrade a dataframe to mxData
. It can also drop variables and rows
from the dataframe.
The most common use will be to give it a dataframe, and get back an mxData
object of type raw, cov, cor (WLS is just raw).
xmu_make_mxData(
data = NULL,
type = c("Auto", "FIML", "cov", "cor", "WLS", "DWLS", "ULS"),
manifests = NULL,
numObs = NULL,
weight = NULL,
fullCovs = NULL,
dropMissingDef = TRUE,
verbose = FALSE,
use = "pairwise.complete.obs"
)
data |
A |
type |
What data type is wanted out c("Auto", "FIML", "cov", "cor", 'WLS', 'DWLS', 'ULS') |
manifests |
If set, only these variables will be retained. |
numObs |
Only needed if you pass in a cov/cor matrix wanting this to be upgraded to mxData |
weight |
Passes weight values to mxData |
fullCovs |
Covariate names if any (NULL = none) These are checked by |
dropMissingDef |
Whether to automatically drop missing def var rows for the user (default = TRUE). You get a polite note. |
verbose |
If verbose, report on columns kept and dropped (default FALSE) |
use |
When type = cov or cor, should this drop NAs? (use = "pairwise.complete.obs" by default, with a polite note) |
mxData()
Other xmu internal not for end user:
umxModel()
,
umxRenameMatrix()
,
umx_APA_pval()
,
umx_fun_mean_sd()
,
umx_get_bracket_addresses()
,
umx_make()
,
umx_standardize()
,
umx_string_to_algebra()
,
xmuHasSquareBrackets()
,
xmuLabel_MATRIX_Model()
,
xmuLabel_Matrix()
,
xmuLabel_RAM_Model()
,
xmuMI()
,
xmuMakeDeviationThresholdsMatrices()
,
xmuMakeOneHeadedPathsFromPathList()
,
xmuMakeTwoHeadedPathsFromPathList()
,
xmuMaxLevels()
,
xmuMinLevels()
,
xmuPropagateLabels()
,
xmuRAM2Ordinal()
,
xmuTwinSuper_Continuous()
,
xmuTwinSuper_NoBinary()
,
xmuTwinUpgradeMeansToCovariateModel()
,
xmu_CI_merge()
,
xmu_CI_stash()
,
xmu_DF_to_mxData_TypeCov()
,
xmu_PadAndPruneForDefVars()
,
xmu_bracket_address2rclabel()
,
xmu_cell_is_on()
,
xmu_check_levels_identical()
,
xmu_check_needs_means()
,
xmu_check_variance()
,
xmu_clean_label()
,
xmu_data_missing()
,
xmu_data_swap_a_block()
,
xmu_describe_data_WLS()
,
xmu_dot_make_paths()
,
xmu_dot_make_residuals()
,
xmu_dot_maker()
,
xmu_dot_move_ranks()
,
xmu_dot_rank_str()
,
xmu_extract_column()
,
xmu_get_CI()
,
xmu_lavaan_process_group()
,
xmu_make_TwinSuperModel()
,
xmu_make_bin_cont_pair_data()
,
xmu_match.arg()
,
xmu_name_from_lavaan_str()
,
xmu_path2twin()
,
xmu_path_regex()
,
xmu_print_algebras()
,
xmu_rclabel_2_bracket_address()
,
xmu_safe_run_summary()
,
xmu_set_sep_from_suffix()
,
xmu_show_fit_or_comparison()
,
xmu_simplex_corner()
,
xmu_standardize_ACEcov()
,
xmu_standardize_ACEv()
,
xmu_standardize_ACE()
,
xmu_standardize_CP()
,
xmu_standardize_IP()
,
xmu_standardize_RAM()
,
xmu_standardize_SexLim()
,
xmu_standardize_Simplex()
,
xmu_start_value_list()
,
xmu_starts()
,
xmu_summary_RAM_group_parameters()
,
xmu_twin_add_WeightMatrices()
,
xmu_twin_check()
,
xmu_twin_get_var_names()
,
xmu_twin_make_def_means_mats_and_alg()
,
xmu_twin_upgrade_selDvs2SelVars()
# =========================
# = Continuous ML example =
# =========================
data(mtcars)
tmp = xmu_make_mxData(data= mtcars, type = "Auto"); # class(tmp); # "MxDataStatic"
# names(tmp$observed) # "mpg" "cyl" "disp"
manVars = c("mpg", "cyl", "disp")
tmp = xmu_make_mxData(data= mtcars, type = "Auto", manifests = manVars);
tmp$type == "raw" # TRUE
# ==============================
# = All continuous WLS example =
# ==============================
tmp = xmu_make_mxData(data= mtcars, type = "WLS" , manifests = manVars, verbose= TRUE)
tmp$type == "raw" # TRUE (WLS is triggered by the fit function, not the data type)
# ============================
# = Missing data WLS example =
# ============================
tmp = mtcars; tmp[1, "mpg"] = NA # add NA
tmp = xmu_make_mxData(data= tmp, type = "WLS", manifests = manVars, verbose= TRUE)
## Not run:
# ==========================
# = already mxData example =
# ==========================
m1 = umxRAM("auto", data = mxData(mtcars, type = "raw"),
umxPath(var= "wt"),
umxPath(mean= "wt")
)
## End(Not run)
# ========================
# = Cov and cor examples =
# ========================
tmp = xmu_make_mxData(data= mtcars, type = "cov", manifests = c("mpg", "cyl"))
tmp = xmu_make_mxData(data= mtcars, type = "cor", manifests = c("mpg", "cyl"))
tmp = xmu_make_mxData(data= cov(mtcars[, c("mpg", "cyl")]),
type = "cov", manifests = c("mpg", "cyl"), numObs=200)
# mxData input examples
tmp = mxData(cov(mtcars[, c("mpg", "cyl")]), type = "cov", numObs= 100)
xmu_make_mxData(data= tmp, type = "cor", manifests = c("mpg", "cyl")) # consume mxData
xmu_make_mxData(data= tmp, type = "cor", manifests = c("mpg")) # trim existing mxData
xmu_make_mxData(data= tmp, type = "cor") # no manifests specified (use all)
xmu_make_mxData(data= tmp, manifests = c("mpg", "cyl")) # auto
# =======================
# = Pass string through =
# =======================
xmu_make_mxData(data= c("a", "b", "c"), type = "Auto")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.