if (FALSE) {
### An example using the formula interface
data(swiss)
posterior <- MCMCfactanal(~Agriculture+Examination+Education+Catholic
+Infant.Mortality, factors=2,
lambda.constraints=list(Examination=list(1,"+"),
Examination=list(2,"-"), Education=c(2,0),
Infant.Mortality=c(1,0)),
verbose=0, store.scores=FALSE, a0=1, b0=0.15,
data=swiss, burnin=5000, mcmc=50000, thin=20)
plot(posterior)
summary(posterior)
### An example using the matrix interface
Y <- cbind(swiss$Agriculture, swiss$Examination,
swiss$Education, swiss$Catholic,
swiss$Infant.Mortality)
colnames(Y) <- c("Agriculture", "Examination", "Education", "Catholic",
"Infant.Mortality")
post <- MCMCfactanal(Y, factors=2,
lambda.constraints=list(Examination=list(1,"+"),
Examination=list(2,"-"), Education=c(2,0),
Infant.Mortality=c(1,0)),
verbose=0, store.scores=FALSE, a0=1, b0=0.15,
burnin=5000, mcmc=50000, thin=20)
}
Run the code above in your browser using DataLab