# Generalized Context Model

### Description

Constructs a Generalized Context Model.

### Usage

1 2 |

### Arguments

`learning` |
an object of class |

`response` |
an object of class |

`parameters` |
an (optional) named list with (starting) values of the parameters. If no values are supplied, defaults are used. |

`fixed` |
a logical vector indicating whether model parameters are fixed or free |

`data` |
data frame containing the variables listed in the formula argument. |

`subset` |
subset of data to fit model to. |

`ntimes` |
a vector with number of observations for each replication. |

`replicate` |
logical to indicate whether model parameters are identical for each replication in ntimes. |

`remove.intercept` |
(logical) should the intercept term be removed from the x matrix of the model? |

### Details

The Generalized Context Model (Nosofsky, 1986) is an exemplar model.
It predicts the value of a criterion at t based on the similarity of a probe cue
*x[t]* to stored cues *x[t-k]*, *k=1,...,t-1*.

The similarity between two cues is computed as

*s(x[t],x[k]) = exp(-lambda * d(x[t],x[k])^(q) )*

where *d(x[t],x[k])* is the generalized Minkowski distance

*d(x[t],x[k]) = (sum[j] w[j] | x[jt] - x[jk] |^(r))^(1/r)*

When making a response to cue *x[t]*, first the overall similarity to each of the previously encountered exemplars of each of the levels of outcome y is determined as

The GCM can be seen as a mixture model. Each encountered exemplar adds a new component to the mixture. The mixture proportions are defined by the similarities. See the package manual for more information.

A more general version of the GCM is implemented by `gGCM`

.

### Value

An object of class `GCM`

.

### References

Nosofsky, R.M. (1986). Attention, Similarity, and the
Identification-Categorization Relationship. *Journal of Experimental
Psychology: General*, *115*, 39-57.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## open weather prediction data
data(WPT)
controls <- subset(WPT,id %in% paste("C",1:16,sep=""))
## initialize model, use remove.intercept=TRUE so that the x matrix will contain
## four columns.
mod <- GCM(y~x1+x2+x3+x4,response=r~1,data=controls,
fix=list(r=TRUE,q=TRUE),ntimes=rep(200,16),
remove.intercept=TRUE)
## Not run:
## estimate free parameters
## discount (ignore) first 5 responses in each series
## as these can give deterministic predictions
mod <- fit(mod,discount=5)
## End(Not run)
summary(mod)
``` |