Learn R Programming

ThurMod (version 1.1.11)

read.mplus: Reads results from Mplus output file.

Description

This function reads and returns results from an Mplus output file.

Usage

read.mplus(blocks, itf, model, output_path, convergence = TRUE,
  fit.stat = TRUE, loading = TRUE, cor = TRUE, intercept = TRUE,
  threshold = TRUE, resvar = TRUE, standardized = FALSE)

Value

Returns a list containing the specified results, after model analysis, by reading the results from the 'output_path'.

Arguments

blocks

A matrix defining the blocks of the model. The number of rows must be the number of blocks, each row represents a block and contains the item numbers. The number of columns present the number of items per block.

itf

A vector defining the items-to-factor relation. For example `c(1,1,1,2,2,2)` defines six items, the first three correspond to factor 1, the second three correspond to factor 2.

model

A descriptor for the model. Can be one of `'lmean'`, `'uc'`, `'irt'` or `'simple2'`, `'simple3'` or `'simple5'`. The Number behind the `'simple'` statement defines the Thurstone case.

output_path

Path to the Mplus output file. Defaults to `'myFC_model.out'`.

convergence

Logical. Should a message for convergence be returned? Defaults to `TRUE`.

fit.stat

Logical. Should fit statistics be returned? Defaults to `TRUE`.

loading

Logical. Should loading estimates be returned? Defaults to `TRUE`.

cor

Logical. Should latent correlation estimates be returned? Defaults to `TRUE`.

intercept

Logical. Should intercepts be returned? Does only work for `model = 'lmean'`. Defaults to `TRUE`.

threshold

Logical. Should thresholds be returned? Does only work for `model = 'uc'` or `'irt'`. Defaults to `TRUE`.

resvar

Logical. Should residual variances be returned? Defaults to `TRUE`.

standardized

Logical. Should standardized values be returned? Defaults to `FALSE`.

Examples

Run this code

# read and save data set FC
data(FC)

write.table(FC,paste0(tempdir(),'/','my_data.dat'),quote=FALSE, sep=" ",
col.names = FALSE, row.names = FALSE)


# set seed and define blocks
set.seed(1)
blocks <- matrix(sample(1:15,15), ncol = 3)

# define the item-to-factor relation
itf <- rep(1:3,5)

# perform analysis 
if (FALSE) {
fit.mplus(blocksort(blocks),itf,'irt',data_path = 'mydata.dat', data_full = TRUE,
input_path = paste0(tempdir(),'/','myFC_model'))


# After estimation
read.mplus(blocks,itf,'irt',output_path = paste0(tempdir(),'/','myFC_model.out'))
}

Run the code above in your browser using DataLab