glc {grt} | R Documentation |
General Linear Classifier
Description
Fit a general linear classifier (a.k.a. linear decison-bound model).
Usage
glc(formula, data, category, par = list(), zlimit = Inf,
covstruct=c("unstructured", "scaledIdentity", "diagonal", "identity"),
fixed = list(), opt = c("nlminb", "optim"),
lower=-Inf, upper=Inf, control=list())
Arguments
formula |
A formula of the form |
data |
A data frame from which variables specified in |
category |
(Optional.) A factor specifying the true category membership of the stimuli. |
par |
object of class |
zlimit |
numeric. The z-scores (or discriminant scores) beyond the specified value will be truncated. Default to |
covstruct |
An optional character string. Only used when the initial parameters are not fully specified. see |
fixed |
A named list of logical vectors specifying whether each of |
opt |
A character string specifying the optimizer to be used: either |
lower , upper |
Bounds on the parameters. see ‘Details’ for default values. |
control |
A list of control parameters passed to the internal optimization function. See ‘Details’ of |
Details
If par
is not fully specified in the argument, the function attempts to calculate the initial parameter values by internally calling the functions mcovs
and ldb
. If category
is also not specified, the response specified in the formula
is used as the grouping factor in mcovs
.
The default lower and upper values vary depending on the dimension of the model (i.e., the number of variables in the right hand side of formula
). In all cases, default lower and upper values for the noise
parameter is .001 and 500 respectively. In cases when an one-dimensional model is fitted, lower and upper bounds for the bias
parameters are selected based on the range of the data
input so that the decision bound is found within the reasonable range of the data and convergence can be reached. In all other cases, coeffs
and bias
has no limits.
When an one-dimensional model is being fit, fixed$coeffs
always becomes TRUE
.
Value
object of the class glc
, i.e., a list containing the following components:
terms |
the |
call |
the matched call. |
model |
the design matrix used to fit the model. |
category |
the category vector as specified in the input. |
initpar |
the initial parameter used to fit the model. |
par |
the fitted parameter. |
logLik |
the log-likelihood at convergence. |
References
Alfonso-Reese, L. A. (2006) General recognition theory of categorization: A MATLAB toolbox. Behavior Research Methods, 38, 579-583.
Ashby, F. G., & Gott, R. E. (1988). Decision rules in the perception and categorization of multidimensional stimuli. Journal of Experimental Psychology: Learning, Memory, & Cognition, 14, 33-53.
Ashby, F. G. (1992) Multidimensional models of perception and cognition. Lawrence Erlbaum Associates.
See Also
gqc
,
ldb
,
logLik.glc
,
coef.glc
,
predict.glc
,
scale.glc
,
plot.glc
,
plot3d.glc
Examples
data(subjdemo_2d)
d2 <- subjdemo_2d
#fit a 2d suboptimal model
fit.2dl <- glc(response ~ x + y, data=d2, category=d2$category, zlimit=7)
#fit a 1d model (on the dimention 'y') on the same dataset
fit.1dy <- glc(response ~ y, data=d2, category=d2$category, zlimit=7)
#or using update()
#fit.1dy <- update(fit.2dl, . ~ . -x)
#fit a 2d optimal model
fit.2dlopt <- glc(response ~ x + y, data=d2, category=d2$category, zlimit=7,
fixed=list(coeffs=TRUE, bias=TRUE))
#calculate AIC and compare
AIC(fit.2dl, fit.1dy, fit.2dlopt)