glc: General Linear Classifier

Description Usage Arguments Details Value References See Also Examples

Description

Fit a general linear classifier (a.k.a. linear decison-bound model).

Usage

1
2
3
4
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 response ~ x1 + x2 + ..., where the response specifies the grouping factor (generally a participant's response) and the right hand side specifies the relevant dimensions or features of the stimuli.

data

A data frame from which variables specified in formula are taken.

category

(Optional.) A factor specifying the true category membership of the stimuli.

par

object of class glcStruct or named list containing a set of initial parameters (i.e., noise, coeffs, bias) used to fit the data.

zlimit

numeric. The z-scores (or discriminant scores) beyond the specified value will be truncated. Default to Inf.

covstruct

An optional character string. Only used when the initial parameters are not fully specified. see ldb.

fixed

A named list of logical vectors specifying whether each of noise, coeffs, and bias parameters should be fixed to the initial value. Default to list(noise=FALSE, coeffs=FALSE, bias=FALSE. A fatal error will be returned if set to all TRUE.

opt

A character string specifying the optimizer to be used: either nlminb (the default) or optim. If “optim”, “L-BFGS-B” method is used (see ‘Details’ of optim) .

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 nlminb or optim.

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 terms object used.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

grt documentation built on May 2, 2019, 7:10 a.m.