pValue: Find p-values (1 - percentile) by comparing a single analysis...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pValue.R

Description

This function will provide p value from comparing a lavaan) or a OpenMx result from the simulation result (in SimResult).

Usage

1
2
pValue(target, dist, usedFit = NULL, nVal = NULL, pmMCARval = NULL, 
	pmMARval = NULL, df = 0)

Arguments

target

A value, multiple values, a lavaan object, or an OpenMx object used to find p values. This argument could be a cutoff of a fit index.

dist

The comparison distribution, which can be a vector of numbers, a data frame, or a result object.

usedFit

The vector of names of fit indices that researchers wish to find the p value from.

nVal

The sample size value that researchers wish to find the fit indices cutoffs from

pmMCARval

The percent missing completely at random value that researchers wish to find the fit indices cutoffs from.

pmMARval

The percent missing at random value that researchers wish to find the fit indices cutoffs from.

df

The degree of freedom used in spline method in predicting the fit indices by the predictors. If df is 0, the spline method will not be applied.

Details

In comparing fit indices, the p value is the proportion of the number of replications that provide poorer fit (e.g., less CFI value or greater RMSEA value) than the analysis result from the observed data.

Value

The p values of fit indices are provided, as well as two additional values: andRule and orRule. The andRule is based on the principle that the model is retained only when all fit indices provide good fit. The proportion is calculated from the number of replications that have all fit indices indicating a better model than the observed data. The proportion from the andRule is the most stringent rule in retaining a hypothesized model. The orRule is based on the principle that the model is retained only when at least one fit index provides good fit. The proportion is calculated from the number of replications that have at least one fit index indicating a better model than the observed data. The proportion from the orRule is the most lenient rule in retaining a hypothesized model.

Author(s)

Sunthud Pornprasertmanit (psunthud@gmail.com)

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
# Compare an analysis result with a result of simulation study
library(lavaan)
loading <- matrix(0, 9, 3)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loading[7:9, 3] <- NA
targetmodel <- estmodel(LY=loading, modelType="CFA", indLab=paste("x", 1:9, sep=""))
out <- analyze(targetmodel, HolzingerSwineford1939)

loading.trivial <- matrix("runif(1, -0.2, 0.2)", 9, 3)
loading.trivial[is.na(loading)] <- 0
mismodel <- model.lavaan(out, std=TRUE, LY=loading.trivial)

# The actual number of replications should be much greater than 20.
simout <- sim(20, n=nrow(HolzingerSwineford1939), mismodel)

# Find the p-value comparing the observed fit indices against the simulated 
# sampling distribution of fit indices
pValue(out, simout)

## End(Not run)

Example output

Loading required package: lavaan
This is lavaan 0.6-3
lavaan is BETA software! Please report any bugs.
 
#################################################################
This is simsem 0.5-14
simsem is BETA software! Please report any bugs.
simsem was first developed at the University of Kansas Center for
Research Methods and Data Analysis, under NSF Grant 1053160.
#################################################################

Attaching package: 'simsem'

The following object is masked from 'package:lavaan':

    inspect

Progress: 1 / 20 
Progress: 2 / 20 
Progress: 3 / 20 
Progress: 4 / 20 
Progress: 5 / 20 
Progress: 6 / 20 
Progress: 7 / 20 
Progress: 8 / 20 
Progress: 9 / 20 
Progress: 10 / 20 
Progress: 11 / 20 
Progress: 12 / 20 
Progress: 13 / 20 
Progress: 14 / 20 
Progress: 15 / 20 
Progress: 16 / 20 
Progress: 17 / 20 
Progress: 18 / 20 
Progress: 19 / 20 
Progress: 20 / 20 
Warning messages:
1: In lav_object_post_check(object) :
  lavaan WARNING: some estimated ov variances are negative
2: In lav_object_post_check(object) :
  lavaan WARNING: some estimated ov variances are negative
3: In lav_object_post_check(object) :
  lavaan WARNING: some estimated ov variances are negative
4: In lav_object_post_check(object) :
  lavaan WARNING: some estimated ov variances are negative
5: In lav_object_post_check(object) :
  lavaan WARNING: some estimated ov variances are negative
  chisq     aic     bic   rmsea     cfi     tli    srmr andRule  orRule 
   0.55    0.00    0.00    0.55    0.45    0.45    0.40    0.00    0.55 

simsem documentation built on March 29, 2021, 1:07 a.m.

Related to pValue in simsem...