
Baseline models
baseline.Rd
Fits baseline models. Baseline models are stimulus-agostic models used as sanity checks in cognitive model comparisons. Other cognitive models should beat a baseline model -- if not, the other cognitive models don't describe patterns in the responses well.
baseline_const_c()
predicts a constant value for continuous responses.baseline_const_d()
predicts a constant value for discrete responses.baseline_mean_c()
fits the mean of the observed responses for continuous responses.baseline_mean_d()
fits the mean of the observed responses for discrete responses.
Usage
baseline_const_c(formula, const, data, options, discount, ...)
baseline_const_d(formula, const, data, ...)
baseline_mean_c(formula, data, ...)
baseline_mean_d(formula, data, ...)
Arguments
- formula
A formula, the variable in
data
to be modeled. For example,y ~ .
models a response variabley
(note the~ .
after the variable name).- const
A number, the value to predict.
- data
A data frame, the data to be modeled.
- options
(optional) A list, list entries change the modeling procedure. For example,
list(lb = c(k=0))
changes the lower bound of parameter k to 0, orlist(fit_measure = "mse")
changes the goodness of fit measure in parameter estimation to mean-squared error, for all options, see cm_options.- discount
A number, how many initial trials to not use during parameter fitting.
- ...
other arguments, ignored.
Value
Returns a cognitive model object, which is an object of class cm. A model, that has been assigned to m
, can be summarized with summary(m)
or anova(m)
. The parameter space can be viewed using pa. rspace(m)
, constraints can be viewed using constraints(m)
.
Details
baseline_const_c/d
predicts the value given in const
for all trials. For example const = 0.50
would predict Pr=0.50 for each trial, which is a commmon baseline model for tasks with two-outcome discrete choices.
Parameter
baseline_const_c/d
has no free parameterbaseline_mean_c/d
has 1 free parameter,mu
, the meanbaseline_mean_c
, if estimated via log likelihood, has an additional free parameter,sigma
, the standard deviation of the normal log likelihood.
Author
Jana B. Jarecki, jj@janajarecki.com
Examples
# Data D: let y hold the observed responses
# Make a model that predicts Pr = 0.50
D <- data.frame(y = c(1,1,0), x = c(1,2,3))
M <- baseline_const_d(y ~ ., const = 0.50, data = D)
predict(M) # predicts 0.5, 0.5, 0.5
#> [1] 0.5 0.5 0.5
npar(M) # 0 parameter
#> [1] 0
logLik(M) # log likelihood (binomial)
#> 'log Lik.' -2.079442 (df=0)
M <- baseline_mean_d(y ~ ., D) # Pr = mean(observed variable)
#> Fitting free parameters [mu] by maximizing loglikelihood (binomial pdf) with auto.
#> Error: Can't compute the goodness of fit loglikelihood, because:
#> Error in log(pred) : non-numeric argument to mathematical function
predict(M) # predicts 0.66, 0.66, 0.66
#> [1] 0.5 0.5 0.5
coef(M) # mean counts as free parameter
#> NULL
npar(M) # 1 free parameter, the mean
#> [1] 0