lavCor | R Documentation |

Fit an unrestricted model to compute polychoric, polyserial and/or Pearson correlations.

```
lavCor(object, ordered = NULL, group = NULL, missing = "listwise",
ov.names.x = NULL, sampling.weights = NULL,
se = "none", test = "none",
estimator = "two.step", baseline = FALSE, ...,
cor.smooth = FALSE, cor.smooth.tol = 1e-04, output = "cor")
```

`object` |
Either a |

`ordered` |
Character vector. Only used if |

`group` |
Only used if |

`missing` |
If |

`sampling.weights` |
Only used if |

`ov.names.x` |
Only used if |

`se` |
Only used if |

`test` |
Only used if output is |

`estimator` |
If |

`baseline` |
Only used if output is |

`...` |
Optional parameters that are passed to the |

`cor.smooth` |
Logical. Only used if |

`cor.smooth.tol` |
Numeric. Smallest eigenvalue used when reconstructing the correlation matrix after an eigenvalue decomposition. |

`output` |
If |

This function is a wrapper around the `lavaan`

function,
but where the model is defined as the unrestricted model. The
following free parameters are included: all covariances/correlations among
the variables, variances for continuous variables, means for continuous
variables, thresholds for ordered variables, and if exogenous variables
are included (`ov.names.x`

is not empty) while some variables
are ordered, also the regression slopes enter the model.

By default, if `output = "cor"`

or `output = "cov"`

, a symmetric
matrix (of class `"lavaan.matrix.symmetric"`

, which only affects the
way the matrix is printed). If `output = "th"`

, a named vector of
thresholds. If `output = "fit"`

or `output = "lavaan"`

,
an object of class `lavaan`

.

Olsson, U. (1979). Maximum likelihood estimation of the polychoric correlation coefficient. Psychometrika, 44(4), 443-460.

Olsson, U., Drasgow, F., & Dorans, N. J. (1982). The polyserial correlation coefficient. Psychometrika, 47(3), 337-347.

`lavaan`

```
# Holzinger and Swineford (1939) example
HS9 <- HolzingerSwineford1939[,c("x1","x2","x3","x4","x5",
"x6","x7","x8","x9")]
# Pearson correlations
lavCor(HS9)
# ordinal version, with three categories
HS9ord <- as.data.frame( lapply(HS9, cut, 3, labels = FALSE) )
# polychoric correlations, two-stage estimation
lavCor(HS9ord, ordered=names(HS9ord))
# thresholds only
lavCor(HS9ord, ordered=names(HS9ord), output = "th")
# polychoric correlations, with standard errors
lavCor(HS9ord, ordered=names(HS9ord), se = "standard", output = "est")
# polychoric correlations, full output
fit.un <- lavCor(HS9ord, ordered=names(HS9ord), se = "standard",
output = "fit")
summary(fit.un)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.