Recipe function to quickly create factor loadings

1 | ```
prep.loadings(map, params, idvar, exo.names = character(0))
``` |

`map` |
list giving how the latent variables map onto the observed variables |

`params` |
parameter numbers |

`idvar` |
Names of the variables used to identify the factors |

`exo.names` |
names of the exogenous covariates |

The default pattern for 'idvar' is to fix the first factor loading
for each factor to one. The variable names listed in 'idvar' have
their factor loadings fixed to one. However, if the names of the
latent variables are used for 'idvar', then all the factor loadings
will be freely estimated and you should fix the factor variances
in the noise part of the model (e.g. `prep.noise`

).

This function does not have the full set of features possible in
the dynr package. In particular, it does not have regime-swtiching
factor loadings, any intercepts, or any covariates. For complete
functionality use `prep.measurement`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
#Single factor model with one latent variable fixing first loading
prep.loadings(list(eta1=paste0('y', 1:4)), paste0("lambda_",2:4))
#Single factor model with one latent variable fixing the fourth loading
prep.loadings(list(eta1=paste0('y', 1:4)), paste0("lambda_",1:3), idvar='y4')
#Single factor model with one latent variable freeing all loadings
prep.loadings(list(eta1=paste0('y', 1:4)), paste0("lambda_", 1:4), idvar='eta1')
# Two factor model with simple structure
prep.loadings(list(eta1=paste0('y', 1:4), eta2=paste0('y', 5:7)),
paste0("lambda_", c(2:4, 6:7)))
#Two factor model with repeated use of a free parameter
prep.loadings(list(eta1=paste0('y', 1:4), eta2=paste0('y', 5:8)),
paste0("lambda_", c(2:4, 6:7, 4)))
#Two factor model with a cross loading
prep.loadings(list(eta1=paste0('y', 1:4), eta2=c('y5', 'y2', 'y6')),
paste0("lambda_", c("21", "31", "41", "22", "62")))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.