Encoding: UTF-8
Title: Model Implied Instrumental Variable (MIIV) Estimation of Structural Equation Models
Version: 0.5.8
Description: Functions for estimating structural equation models using instrumental variables.
URL: https://github.com/zackfisher/MIIVsem
BugReports: https://github.com/zackfisher/MIIVsem/issues
Depends: R (≥ 2.10)
Imports: stats, utils, lavaan, numDeriv, Matrix, car, boot
License: GPL-2
LazyData: true
ByteCompile: true
RoxygenNote: 7.1.1
NeedsCompilation: no
Packaged: 2021-07-11 17:30:26 UTC; lola
Author: Zachary Fisher [aut, cre], Kenneth Bollen [aut], Kathleen Gates [aut], Mikko Rönkkö [aut]
Maintainer: Zachary Fisher <fish.zachary@gmail.com>
Repository: CRAN
Date/Publication: 2021-07-13 12:30:02 UTC

Model Implied Instrumental Variable Estimation of Structural Equation Models

Description

MIIVsem is a package for estimating structural equation models using model-implied instrumental variables (MIIVs).

Author(s)

Maintainer: Zachary Fisher fish.zachary@gmail.com

Authors:

See Also

Useful links:


Industrialization-Democracy Data

Description

A dataset from Bollen (1989) containing measures of political democracy and industrialization for 75 developing countries in 1960 and 1965. The variables are as follows:

Usage

bollen1989a

Format

A data frame with 75 rows and 9 variables

Details

References

Bollen, K. A. (1989). Structural equation models. New York: Wiley-Interscience.

Examples


## Not run: 
  model <- '
    Eta1 =~ y1 + y2  + y3  + y4  
    Eta2 =~ y5 + y6  + y7  + y8    
    Xi1  =~ x1 + x2 + x3 
    Eta1 ~ Xi1  
    Eta2 ~ Xi1 
    Eta2 ~ Eta1 
    y1   ~~ y5
    y2   ~~ y4
    y2   ~~ y6
    y3   ~~ y7
    y4   ~~ y8
    y6   ~~ y8 devtools::build_win()
  '

## End(Not run)


Union sentiment data

Description

A dataset from McDonald and Clelland (1984) reanalyzed by Bollen (1989) containing data on union sentiment of southern nonunion textile workers.

Usage

bollen1989b

Format

A data frame with 173 rows and 5 variables

Details

References

Bollen, K. A. 1989. Structural Equations with Latent Variables. New York: Wiley

McDonald, A, J., & Clelland, D. A. (1984). Textile Workers and Union Sentiment. Social Forces, 63(2), 502–521.

Examples


## Not run: 
 model <- '
   unionsen ~  deferenc + laboract + yrsmill
   deferenc ~  age
   laboract ~  age + deferenc
   yrsmill  ~~ age
 '

## End(Not run)


Subjective class data

Description

The following data is from Bollen (1989) using data from Kluegel et al. (1977). These data include measures of actual income (inc) and occupational prestige (occ), measures of respondents' subjective assessments of income (subinc), occupational prestige (subocc), and overall SES status (subgen).

Usage

bollen1989c

Format

A data frame with 432 rows and 5 variables

Details

References

Bollen, K. A. 1989. Structural Equations with Latent Variables. New York: Wiley

Kluegel, J. R., Singleton, R., & Starnes, C. E. (1977). Subjective Class Identification: A Multiple Indicator Approach. American Sociological Review, 42(4), 599–611.

Examples


## Not run: 
 model <-    '
	subinc  ~ inc + subocc
   subocc  ~ occ + subinc
   subgen  ~ subinc + subocc
	subinc ~~ subocc + subgen
   subocc ~~ subgen
	inc    ~~ occ
 '

## End(Not run)


Perceived accessibility data

Description

Data come from a survey that was conducted in rural clusters of Tanzania in 1993. The goal was to collect information on the perceived accessibility of a specific family planning facility that serviced each cluster. Six informants were chosen: 3 female and 3 male. New informants were chosen for each cluster. Each informant was independently asked to rate the accessibility of the facility, and how easy it was to get to the facility. More specifically the women informants were asked to rate how women of childbearing age perceived the accessibility and easiness and men were asked to rate how accessible and easy men perceived access to the clinic to be. Higher values indicate greater accessibility and ease of travel. The female informants' ratings are 1 to 3 and the male informants' ratings are 4 to 6.

Usage

bollen1996

Format

A data frame with 220 rows and 12 variables

Details

References

Bollen, K. A., Speizer, I. S., & Mroz, T. A. (1996). Family Planning Facilities in Rural Tanzania: His and Her Perceptions of Time and Distance.

Examples


## Not run: 
 model <- ' 
    femaleAccess  =~ access1 + access2 + access3
    maleAccess    =~ access4 + access5 + access6
    femaleEasy    =~ easy1   + easy2   + easy3
    maleEasy      =~ easy4   + easy5   + easy6 
 '

## End(Not run)


build the missing data model syntax

Description

build the missing data model syntax

Usage

buildMissingSyntax(pt)

build the restriction matrix

Description

Function returns a list r with information regarding coefficient restrictions and estimation. The field R contains a restriction matrix for imposing cross-coefficient restrictions. If no cross-coefficient restrictions are present R is set to NULL. The vector q contains a vector of lagrangean multipliers. The vector constrained gives the constrained coefficients in convenient form.

Usage

buildRestrictMat(d)

Arguments

d

A list containing equation information.


build the sum of squares and cross products matrix

Description

Build sum of squares and crossproducts matrix (SSCP). From the means, covariances, and n's you can recover the raw sum-of-squares and products matrix for all the variables. Say the matrix of all the variables is X, with mean vector bar(x), and covariance matrix S, based on sample-size n. Then the SSCP matrix is X'X = (n - 1)S + n bar(x) bar(x)'. You then need to add the row/column for the constant, which is just n in the 1, 1 position and n bar(x) elsewhere.

Usage

buildSSCP(sample.cov, sample.mean, sample.nobs)

Arguments

sample.cov

Numeric matrix. A sample variance-covariance matrix. The rownames and colnames must contain the observed variable names.

sample.mean

A sample mean vector.

sample.nobs

Number of observations in the full data frame.


build the variance covariance point estimates model syntax

Description

build the variance covariance point estimates model syntax

Usage

buildVarCovSyntax(pt)

identify best scaling indicator

Description

identify best scaling indicator

Usage

chooseSI(model, data, scaling, lag = FALSE)

estimate the 2SLS point estimates

Description

estimate the 2SLS point estimates

Usage

est2SLSCoef(d = d, r = NULL, poly.mat = NULL, sscp.mat = NULL)

estimate the 2SLS coefficient covariance matrix

Description

estimate the 2SLS coefficient covariance matrix

Usage

est2SLSCoefCov(
  d,
  poly.mat = NULL,
  cov.mat = NULL,
  mean.vec = NULL,
  acov = NULL,
  acov.sat = NULL,
  r = NULL
)

estimate the 2SLS equation specific sigma squared

Description

estimate the 2SLS equation specific sigma squared

Usage

est2SLSSigmaSq(d, cov.mat)

Calculate the residual covariance matrix

Description

Calculate the residual covariance matrix

Usage

estResidualCov(d, sample.cov)

estimate the SEs using two-stage ML

Description

estimate the SEs using two-stage ML

Usage

estTwoStageML(g, v, eqns, pt)

estimate the variance and covariance parameters

Description

estimate the variance and covariance parameters

Usage

estVarCovarCoef(
  data,
  g,
  eqns,
  pt,
  ordered,
  vc.coef.estimator = "ML",
  vc.coef.missing = "FIML"
)

return a dataframe of parameter estimates for a fitted model.

Description

return a dataframe of parameter estimates for a fitted model.

Usage

estimatesTable(x, v = NULL, sarg = FALSE)

Arguments

x

An object of class miive

v

A list containing variance snd covariance parameter information.

sarg

Logical. Should Sargan test results be included.


provides factor scores for miiv model

Description

provides factor scores for miiv model

Usage

factorScores(model, data, lv_scores, lv_estimator)

Attractiveness and academic ability

Description

This data comes from a study by Felson and Borhnstedt (1979) of perceived attractiveness and academic ability in teenagers, sixth through ninth grade. The six variables are perception of academic ability (academic), perception of physical attractiveness (attract), grade point average (gpa), height, weight, and a strangers' rating of attractiveness (rating).

Usage

felson1979

Format

A data frame with 209 rows and 7 variables

Details

References

Felson, R.B. & Bohrnstedt, G.W. (1979). "Are the good beautiful or the beautiful good?" The relationship between children's perceptions of ability and perceptions of physical attractiveness. Social Psychology Quarterly, 42, 386–392.

Examples


## Not run: 
  model <-  '
	 acad    ~ gpa + attract
    attract ~ height + weight + rating + acad
  '

## End(Not run)



fill the parameter table

Description

fill the parameter table

Usage

fillParTable(eqns, pt, v = NULL)

provides model lists for latent variable gimme

Description

provides model lists for latent variable gimme

Usage

getModelList(
  data,
  model,
  scaling = "first.indicator",
  lag = FALSE,
  dfm = FALSE
)

Model-implied instrumental variable (MIIV) estimation

Description

Estimate structural equation models using model-implied instrumental variables (MIIVs).

Usage

miive(
  model = model,
  data = NULL,
  instruments = NULL,
  sample.cov = NULL,
  sample.mean = NULL,
  sample.nobs = NULL,
  sample.cov.rescale = TRUE,
  estimator = "2SLS",
  se = "standard",
  bootstrap = 1000L,
  boot.ci = "norm",
  missing = "listwise",
  est.only = FALSE,
  var.cov = FALSE,
  miiv.check = TRUE,
  ordered = NULL,
  sarg.adjust = "none",
  overid.degree = NULL,
  overid.method = "stepwise.R2"
)

Arguments

model

A model specified using lavaan model syntax or a miivs object returned by the miivs function. See Details for more information about permissible operators and example model syntax.

data

A data frame, list or environment or an object coercible by as.data.frame to data frame. The most common application is to supply a data.frame.

instruments

This allows user to specify the instruments for each equation. See Details and the miivs.out argument of summary.miivs for more information on the correct input format. External (auxiliary) instruments can be supplied, however, the miiv.check argument must be set to FALSE. In the typical application, the program will choose the MIIVs for each equation based on the model specification. To view the model implied instruments after estimation see the eq.info argument of summary.miive.

sample.cov

Numeric matrix. A sample variance-covariance matrix. The rownames and colnames attributes must contain all the observed variable names indicated in the model syntax.

sample.mean

A sample mean vector. If sample.cov is provided and the sample.mean argument is NULL, intercepts for all endogenous variables will not be estimated.

sample.nobs

Number of observations in the full data frame.

sample.cov.rescale

If TRUE, the sample covariance matrix provided by the user is internally rescaled by multiplying it with a factor (N-1)/N.

estimator

Options "2SLS" or "GMM" for estimating the model parameters. Default is "2SLS". Currently, only 2SLS is supported.

se

If "standard", asymptotic standard errors are computed. If "bootstrap" (or "boot"), bootstrap standard errors are computed.

bootstrap

Number of bootstrap draws, if bootstrapping is used. The default is 1000

boot.ci

Method for calculating bootstrap confidence intervals. Options are normal approximation ("norm"), basic bootstrap interval ("basic"), percentile interval ("perc"), and adjusted bootstrap percentile ("bca"). The default is normal approximation. See boot.ci for more information.

missing

Default is "listwise" however, a maximum likelihood related missing data method called "twostage" is also available. See Details below on missing for more information.

est.only

If TRUE, only the coefficients are returned.

var.cov

If TRUE, variance and covariance parameters are estimated.

miiv.check

Default is TRUE. miiv.check provides a check to determine whether user-upplied instruments are implied by the model specification (e.g. valid MIIVs). When auxiliary or external instruments are provided miiv.check should be set to FALSE.

ordered

A vector of variable names to be treated as ordered factors in generating the polychoric correlation matrix and subsequent PIV estimates. See details on ordered below for more information.

sarg.adjust

Adjusment methods used to adjust the p-values associated with the Sargan test due to multiple comparisons. Defaults is none. For options see p.adjust.

overid.degree

A numeric value indicating the degree of overidentification to be used in estimation.

overid.method

The method by which excess MIIVs should be pruned to satisfy the overid.degree. Options include random (minimum.eigen) or stepwise R2. (stepwise.R2).The default is stepwise.R2.

Details

Sargan's Test of Overidentification

An essential ingredient in the MIIV-2SLS approach is the application of overidentification tests when a given model specification leads to an excess of instruments. Empirically, overidentification tests are used to evalulate the assumption of orthogonality between the instruments and equation residuals. Rejection of the null hypothesis implies a deficit in the logic leading to the instrument selection. In the context of MIIV-2SLS this is the model specification itself. By default, MIIVsem provides Sargan's overidentification test (Sargan, 1958) for each overidentified equation in the system. When cross-equation restrictions or missing data are present the properties of the test are not known. When the system contains many equations the sarg.adjust option provides methods to adjust the p-values associated with the Sargan test due to multiple comparisons. Defaults is none. For other options see p.adjust.

References

Bollen, K. A. (1996). An Alternative 2SLS Estimator for Latent Variable Models. Psychometrika, 61, 109-121.

Bollen, K. A. (2001). Two-stage Least Squares and Latent Variable Models: Simultaneous Estimation and Robustness to Misspecifications. In R. Cudeck, S. Du Toit, and D. Sorbom (Eds.), Structural Equation Modeling: Present and Future, A Festschrift in Honor of Karl Joreskog (pp. 119-138). Lincoln, IL: Scientific Software.

Bollen, K. A., & Maydeu-Olivares, A. (2007). A Polychoric Instrumental Variable (PIV) Estimator for Structural Equation Models with Categorical Variables. Psychometrika, 72(3), 309.

Freedman, D. (1984). On Bootstrapping Two-Stage Least-Squares Estimates in Stationary Linear Models. The Annals of Statistics, 12(3), 827–842.

Greene, W. H. (2000). Econometric analysis. Upper Saddle River, N.J: Prentice Hall.

Hayashi, F. (2000). Econometrics. Princeton, NJ: Princeton University Press

Sargan, J. D. (1958). The Estimation of Economic Relationships using Instrumental Variables. Econometrica, 26(3), 393–415.

Savalei, V. (2010). Expected versus Observed Information in SEM with Incomplete Normal and Nonnormal Data. Psychological Methods, 15(4), 352–367.

Savalei, V., & Falk, C. F. (2014). Robust Two-Stage Approach Outperforms Robust Full Information Maximum Likelihood With Incomplete Nonnormal Data. Structural Equation Modeling: A Multidisciplinary Journal, 21(2), 280–302.

See Also

MIIVsemmiivs


two-stage least square estimator for a system of equations

Description

two-stage least square estimator for a system of equations

Usage

miive.2sls(d, g, r, est.only, se, missing, var.cov, sarg.adjust = "none")

Arguments

d

a list containing equation information

g

a list containing data matrices and characteristics

r

a list containing coefficient restrictions

est.only

should we only calculate coefficient estimates

se

se estimation


Model-implied instrumental variable (MIIV) search

Description

A key step in the MIIV-2SLS approach is to transform the SEM by replacing the latent variables with their scaling indicators minus their errors. Upon substitution the SEM is transformed from a model with latent variables to one containing observed variables with composite errors. The miivs function automatically makes this transformation. The miivs function will also identify equation-specific model-implied instrumental variables in simultaneous equation models without latent variables.

Usage

miivs(model)

Arguments

model

A model specified using lavaan model syntax. See the model argument within the lavaanify function for more information. See the documentation below for a description of how to specify the scaling indicator in latent variable models and impose equality constraints on the parameter estimates.

Details

The miivs function displays a table containing the following information for each equation in the system:

Value

A list of model equations.

References

Bollen, K. A. (1996). An Alternative 2SLS Estimator for Latent Variable Models. Psychometrika, 61, 109-121.

Bentler, P. M., and Weeks, D. G. (1980). Linear Structural Equations with Latent Variables. Psychometrika, 45, 289–308.

See Also

miive


Parse user-implied instrumental variables

Description

Parse user-implied instrumental variables

Usage

parseInstrumentSyntax(d, instruments, miiv.check)

Print method for a MIIV estimation object

Description

Print method for a MIIV estimation object

Usage

## S3 method for class 'miive'
print(x, ...)

Arguments

x

a miive object

...

Optional arguments to print, not used by user.


Print method for a MIIV search object

Description

Print method for a MIIV search object

Usage

## S3 method for class 'miivs'
print(x, ...)

Arguments

x

a miivs object

...

Optional arguments to print, not used by user.


Process data.

Description

Process data.

Usage

processData(
  data = data,
  sample.cov = sample.cov,
  sample.mean = sample.mean,
  sample.nobs = sample.nobs,
  ordered = ordered,
  missing = missing,
  se = se,
  pt = pt
)

Prune MIIVs based on some specified criterion.

Description

Prune MIIVs based on some specified criterion.

Usage

pruneExcessMIIVs(
  d,
  overid.degree,
  overid.method,
  data = NULL,
  sample.cov = NULL,
  sample.polychoric = NULL,
  sample.mean = NULL,
  sample.nobs = NULL,
  overid.boot = FALSE,
  cat.vars = NULL
)

Reisenzein data

Description

This dataset comes from Reisenzein (1986). In this paper Reisenzein designed a randomized experiment to test Weiner's attribution-affect model of helping behavior. According to this theory, whether people help others is determined by their anger or sympathy. Anger and sympathy are affected by perceived controllability. If the individuals have gotten into difficult situations as a result of their own controllable actions, then this negatively affects sympathy and positively affects anger of the potential helpers. The opposite holds if the situation seems beyond the individuals’ control. This data comes from an experiment that describes a person collapsing and lying on the floor of a subway. Subjects were told that the person was either drunk (controllable situation) or ill (uncontrollable situation). This randomized story was intended to affect perceptions of controllability, and controllability in turn affected feelings of sympathy and anger. Finally, sympathy should positively affect helping behavior while anger would negatively affect helping.

Usage

reisenzein1986

Format

A data frame with 138 rows and 13 variables

Details

References

Reisenzein, R. (1986). A Structural Equation Analysis of Weiner's Attribution-Affect Model of Helping Behavior. Journal of Personality and Social Psychology, 50(6), 1123–33.


Summary information for a MIIV estimation object

Description

Summary information for a MIIV estimation object

Usage

## S3 method for class 'miive'
summary(object, eq.info = FALSE, restrict.tests = FALSE, rsquare = FALSE, ...)

Arguments

object

An object of class miive

eq.info

A logical indicating whether equation-specific information should be printed. Useful in models with large numbers of variables.

restrict.tests

A logical indicating whether two test statistics for a large-sample wald test of linaer hypotheses imposed on the MIIV-2SLS coefficient matrix should be provided. The first statistic is an approximate F and the second is Chi-square. Assumptions and additional details for each test are given by Greene (2000, p. 346-347) and Henningsen and Hamman (2007).

rsquare

A logical indicating whether R-square values for endogeneous variables are included in the output. Only available when var.cov is TRUE.

...

Optional arguments to summary, not used by user.

References

Greene, W. H. (2000). Econometric analysis. Upper Saddle River, N.J: Prentice Hall.

Henningsen, A., and Hamann, J.D. (2007). systemfit: A Package for Estimating Systems of Simultaneous Equations in R. Journal of Statistical Software 23(4), 1-40.


Summary information for a MIIV search object

Description

Summary information for a MIIV search object

Usage

## S3 method for class 'miivs'
summary(object, miivs.out = FALSE, eq.info = FALSE, ...)

Arguments

object

An object of class miivs

miivs.out

A logical indicating whether the model-implied instrumental variables found for model should be printed to the console. This is a temporary convenience function to provide an editable, baseline format, for the instruments argument of miive.

eq.info

A logical indicating whether equation-specific information should be printed. Useful in models with a large number of variables.

...

Optional arguments to summary, not used by user.

mirror server hosted at Truenetwork, Russian Federation.