> Alternatively, you can
> directly construct a parameter table.
>
> DD <- data.frame(
> id=NA,
> lhs=NA,
> op=NA,
> rhs=NA,
> user=NA,
> group=NA,
> free=NA,
> ustart=NA,
> exo=NA,
> label=NA,
> plabel=NA)
In recent versions of lavaan (> 0.5-21), only a few columns are required
if you provide a parameter table. Essential columns are "lhs", "op" and
"rhs". In this case, we assume everything is free. If you add a 'free'
column, non-zero numbers (often just 1) indicate free values, everything
else is fixed to zero. Except if you add a 'ustart' column, which is
useful to provide non-zero but fixed parameters.
As an example:
example(cfa)
PT <- parTable(fit)[,c("lhs","op","rhs","free","ustart")]
PT$free[ PT$free > 0] <- 1
PT
fit2 <- sem(PT, data = HolzingerSwineford1939)
fit2
lavaan (0.5-23.1020) converged normally after 35 iterations
Number of observations 301
Estimator ML
Minimum Function Test Statistic 85.306
Degrees of freedom 24
P-value (Chi-square) 0.000
Yves.