Description Usage Arguments Details Value Author(s) References Examples

Constructs a Rescorla-Wagner learning model.

1 2 3 |

`formula` |
an object of class |

`parameters` |
an optional named list with (starting) values of the parameters. Missing parameters in the list will be set to default values. |

`data` |
(optional) data frame for evaluation of the formula. |

`subset` |
(optional) subset of the data. |

`fixed` |
(optional) logical vector indicating whether parameters are fixed (TRUE) or freely estimable (FALSE). |

`parStruct` |
(optional) ParStruct object. Note that if parStruct is given, the ‘fixed’ argument above will be ignored. |

`remove.intercept` |
should an intercept be included in the predictors? If set to TRUE, an intercept term (if present) will be removed from x. This can be useful when the predictors are categorical variables, where removing the intercept in the formula will result in an extra dummy variable. |

`base` |
which level of the criterion variable is considered the base category? If set to a positive integer, that level will not be included in the criterion matrix y. |

`ntimes` |
an optional vector with, for each repetition in the data, the total number of trials. |

`replicate` |
are the repeated series true replications, i.e., are the model parameters considered identical for each series? |

The Rescorla-Wagner model (Rescorla & Wagner, 1972) is an associative learning model.

The associative strength of the connection between an CS j and US k is updated as:

*w[j,k,t] = w[j,k,t-1] + (alpha[j]*beta[k,m])*(lambda[k] y[t,k] - sum[i] w[i,k,t-1] x[t,i])*x[t,j]*

In this expression *lambda[k]* is a scaling parameter; when *y[k]* takes values 0 and 1 when US k is absent/present respectively, then *lambda[k]* reflects the maximum conditioning US k can produce, i.e., it represents the limit of learning. The *alpha[j]* and *beta[k]* are rate parameters dependent, respectively, on the CS *x[j]* and US *y[k]*. These parameters are viewed as having fixed values based on the physical properties of the particular CS and US. On any given trial the current associative strength, *sum[i] w[ik]x[i](t)*, is compared with *lambda[k]*y[k]* and the difference is treated like an error to be corrected; this happens by producing a change in associative strength accordingly. Consequently, the Rescorla-Wagner model is an error-correction model.

An object of class `LearningModel`

Maarten Speekenbrink

Rescorla, R. A., and Wagner, A. R. (1972). A theory of Pavlovian conditioning:
Variations in the effectiveness of reinforcement and nonreinforcement. In A. H.
Black and W. F. Prokasy (Eds.), *Classical Conditioning II*,
Appleton-Century-Crofts. pp. 64-99.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ```
## Open weather prediction data
data(WPT)
## Initialize model
lMod <- RescorlaWagner(y~x1+x2+x3+x4,data=WPT,ntimes=c(200,200),
remove.intercept=TRUE)
## Compute associative strengths
lMod <- runm(lMod)
## Estimate free parameters
## Not run: lMod <-fit(lMod)
summary(lMod)
## Not run:
## Now include a response model
rMod <- RatioRuleResponse(r~1,data=WPT,ntimes=c(200,200))
mMod <- McplModel(lMod,rMod)
fMod <- fit(mMod)
summary(fMod)
## End(Not run)
## The following model only learns to expect the presence/absence of the second
## outcome, which completely determines the presence/absence of the first
## outcome.
lMod2 <- RescorlaWagner(as.numeric(y==1)~x1+x2+x3+x4,data=WPT,ntimes=c(200,200),
remove.intercept=TRUE)
# compute associative strengths
lMod2 <- runm(lMod2)
## Not run:
## Now include a response model. Note that the response in the model should
## have the same format as the outcome in the learning model.
rMod2 <- GlmResponse(as.numeric(r==1)~predict(lMod2)-1,family=binomial(),data=WPT,ntimes=c(200,200))
mMod2 <- McplModel(lMod2,rMod2)
fMod2 <- fit(mMod2)
summary(fMod2)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.