| S4GenericsFAiR {FAiR} | R Documentation |
It is not necessary to understand this help page if one merely wants to estimate a factor analysis model. This help page is intended for those who want to modify or extend FAiR or otherwise want some idea of how FAiR works “behind the scenes”.
Factanal is just a wrapper around a call to
genoud in the rgenoud package. These S4
generic functions are passed to various arguments of
genoud as part of the optimization process. With
the exception of the methods for create_start, it would be very
unusual for any of these methods to be called directly by the user.
## S4 method for signature 'restrictions, manifest.basic': fitS4(par, restrictions, manifest, lower, mapping_rule) ## S4 method for signature 'restrictions, manifest.basic': bfgs_fitS4(par, restrictions, manifest, helper, lower) ## S4 method for signature 'restrictions, manifest.basic': gr_fitS4(par, restrictions, manifest, helper, lower) ## S4 method for signature 'restrictions, manifest.basic': bfgs_helpS4(initial, restrictions, manifest, done, lower) ## S4 method for signature 'restrictions, manifest.basic': create_start(number, start, restrictions, manifest, reject)
par |
A numeric vector containing values for all the free parameters
to be estimated, which corresponds to the par argument for
genoud and for optim. |
initial |
Same as par. |
restrictions |
An object of restrictions-class. |
manifest |
An object of manifest-class. |
lower |
A small numeric scalar indicating the lower bound for positive
definiteness or minimum uniqueness; see the corresponding argument
to Factanal. |
mapping_rule |
a logical indicating whether to invoke the mapping rule in
semi-exploratory models. It takes the value of FALSE when called by
optim. |
helper |
A list that contains necessary information for the bfgs_fitS4
and gr_fitS4 methods that is passed to the BFGShelp argument for
genoud. |
done |
A logical indicating whether the optimization has terminated
or could terminate immediately if a stopping condition is met; see the
documentation of the BFGShelp argument to genoud. |
number |
An integer representing the number of starting values to create |
start |
A numeric vector or matrix containing initial communality estimates |
reject |
Logical indicating whether to reject starting values that fail the constraints required by the model |
... |
Further arguments to be passed to downstream functions; not currently used. |
The fitS4 method is responsible for producing a complete numeric vector of
fit criteria and is passed to the fn argument of genoud.
The default method simply calls restrictions2model and then calls an internal
function that evaluates all the functions in the criteria slot of the object of
restrictions-class.
The bfgs_fitS4 method produces a scalar fit criterion, and this
method is passed to the BFGSfn argument of genoud
and is in turned passed to the fn argument of optim. Usually,
this criterion is the last criterion produced by the fitS4 method, which is the
discrepancy function. The gr_fitS4 method produces the gradient
of the function defined by the bfgs_fitS4 method under traditional maximum
likelihood estimation; otherwise it is an internal function. Either way, this function
is passed to the gr argument of genoud and
optim. Both bfgs_fitS4 and gr_fitS4 take an
argument called helper, which is produced by the bfgs_helpS4
method and corresponds to the BFGShelp argument of
genoud. The BFGShelp method produces a list
that contains information about the initial value of the genetic individual
when optim is called. The bfgs_fitS4 methods and gr_fitS4
methods can behave differently depending on the contents of helper.
The create_start method creates a matrix of starting values that is
then passed to the starting.values argument of
genoud. If you think the starting values are inadequate
in a particular situation, it is much easier to create a matrix of starting
values in the global environment and pass it through the ... of
Factanal to the starting.values argument of
genoud yourself. See Factanal for details
on doing so.
fitS4 |
produces a numeric vector of fits |
bfgs_fitS4 |
produces a numeric scalar as a fit |
gr_fitS4 |
produces a numeric vector that is the gradient at the scalar fit |
bfgs_helpS4 |
produces a list of ancillary material for bfgs_fitS4 and
gr_fitS4 |
create_start |
produces a numeric matrix that constitutes the starting population |
There are methods for every flavor of restrictions-class, although in
many cases the methods are simply inherited. Currently, there are only methods for
objects of class "manifest.basic", which are inherited by objects of class
"manifest.data" and "manifest.data.mcd". However, it is possible to
tailor methods for different flavors of manifest-class or to create
new classes that inherit from restrictions-class and write (some)
methods for them.
Ben Goodrich
Factanal, manifest-class, restrictions-class and
genoud
showMethods("fitS4")
showMethods("bfgs_fitS4")
showMethods("gr_fitS4")
showMethods("bfgs_helpS4")
showMethods("create_start")