showClass("equality_restriction")
man <- make_manifest(covmat = ability.cov)
## Here is how to set up an equality restriction in a SEFA model the hard way
beta <- matrix(NA_real_, nrow = nrow(cormat(man)), ncol = 2)
rownames(beta) <- rownames(cormat(man))
beta[6,2] <- Inf # "fix" beta[6,2] to Inf provisionally
## Note 11L corresponds to beta[5,2] and 12L corresponds to beta[6,2]
ER <- new("equality_restriction", free = 11L, fixed = 12L, dims = dim(beta),
rownames = rownames(cormat(man)), level = 1L)
free <- is.na(beta) # i.e. all but beta[6,2]
beta <- new("parameter.coef.SEFA", x = beta, free = free, num_free = sum(free),
equalities = list(ER))
Phi <- diag(2)
free <- lower.tri(Phi)
Phi <- new("parameter.cormat", x = Phi, free = free, num_free = sum(free))
## Now set up a restriction to prohibit the equal coefficients from being zero
blockers <- matrix(FALSE, nrow = nrow(cormat(man)), ncol = 2)
blockers[5:6,2] <- TRUE # these two cells are hence not allowed to both be zero
res <- make_restrictions(manifest = man, beta = beta, Phi = Phi,
discrepancy = "MLE", criteria = list("block_1st"),
methodArgs = list(blockers = blockers))
## Not run:
# ## Here is the easy way to do the same thing, in the following pop-up menus
# ## select the options to impose equality restrictions and inequality
# ## restrictions (block those coefficients from being zero in a SEFA model)
# res <- make_restrictions(manifest = man, factors = 2, model = "SEFA")
# ## End(Not run)
show(res)
Run the code above in your browser using DataLab