exponentialMSE: Get the MSE between an exponential and a series of reach...

View source: R/models.R

exponentialMSER Documentation

Get the MSE between an exponential and a series of reach deviations.

Description

This function is part of a set of functions to fit and evaluate an exponential function to describe a series of reach deviations.

Usage

exponentialMSE(
  par,
  signal,
  timepoints = c(0:(length(signal) - 1)),
  mode = "learning",
  setN0 = NULL
)

Arguments

par

A named numeric vector with the model parameters (see exponentialModel).

signal

A numeric vector of length N with reach deviations matching the perturbation schedule.

timepoints

Either an integer with the number of trials (N) or a vector with N trial numbers (this can have missing values or fractions). The exponential will be evaluated at those timepoints.

mode

String: "learning" or "washout", sets the function's direction.

setN0

NULL or number, if the asymptote is known, it can be set here.

Details

The 'par' argument is a named numeric vector that should have the following element: - lambda: the learning rate - N0: the asymptote

Value

A float: the mean squared error between the total model output and the reach deviations.

Examples

data(tworatedata)
learning <- rowMeans(tworatedata[which(tworatedata$block == 2),c(4:20)], na.rm=TRUE)
exponentialMSE(par=c('lambda'=0.2, 'N0'=25), signal=learning)

thartbm/handlocs documentation built on Feb. 18, 2025, 10:53 p.m.