Description Usage Arguments Details Value See Also Examples
Fit Smith et al's (2006) TwoRate Model to a set of reach deviations and a perturbation schedule.
1 2 3  fitTwoRateReachModel(reaches, schedule, oneTwoRates = 2, verbose = FALSE,
grid = "uniform", gridsteps = 7, checkStability = TRUE, method = "NM",
fnscale = 1)

reaches 
A sequence of reach deviations. 
schedule 
A sequence of feedback manipulations. 
oneTwoRates 
How many processes to fit? (1 or 2) 
verbose 
Should detailed information be outputted during the fitting? 
grid 
How are parameters values for grid search distributed in [0,1]? One of 'uniform' (default), 'restricted' or 'skewed'. 
gridsteps 
How many values of each parameter are used in grid search? 
checkStability 
Use additional stability constraints? (default=TRUE) 
method 
Fitting method, currently one of "NelderMead" (default and
very robust, also 'NM', a linear optimization method) or "BFGS" (a
quasiNewton, nonlinear method, also 'QN' or 'QuasiNewton'). See

fnscale 
Fitting is done on function/fnscale, where fnscale is already
multiplied by 1 to make it an optimization where appropriate. By default it
is set to 1. To make different schedules more comparable, use the largest
deviation from zero in the schedule; fnscale=max(abs(schedule), na.rm=T).
See 
This function runs a grid search first, and picks the best 5 are
fit with least square optimization after which the best fit is returned.
Mean squared error, as given by
twoRateReachModelErrors
is used to determine quality of fit.
The sequences of reaches
and the schedule
should have the same
length. NAs in the reaches
will be ignored, but in the
schedule
they indicate errorclamp trials.
The model prediction base on the parameters can be retrieved by evaluating
them, based on the perturbation schedule, with
twoRateReachModel
.
In the TwoRate Model of motor learning, the motor output X on a trial t, is the sum of the output of a slow and fast process:
X(t) = Xs(t) + Xf(t)
And each of these two processes retain part of their previous learning and learn from previous errors:
Xs(t) = Rs . Xs(t1) + Ls . E(t1)
Xf(t) = Rf . Xf(t1) + Lf . E(t1)
The four parameters Rs, Ls, Rf and Lf are returned, except when a oneprocess fit is requested, in which case only Rs and Ls are fit.
The set of parameters that minimizes the difference between model
output and the reaches
given the perturbation schedule
.
twoRateReachModelErrors
and
twoRateReachModel
Smith MA, Ghazizadeh A, Shadmehr R (2006). Interacting Adaptive Processes with Different Timescales Underlie ShortTerm Motor Learning. PLoS Biol. 2006 Jun;4(6):e179. https://doi.org/10.1371/journal.pbio.0040179
1 2 3 4 5 6 7 8 9 10 11  data("RotAdapt")
param < fitTwoRateReachModel(RotAdapt$reaches,RotAdapt$schedule, method='BFGS')
param
tworatemodel < twoRateReachModel(param, RotAdapt$schedule)
str(tworatemodel)
plot(RotAdapt$reaches, ylim=c(35,35), col='gray')
lines(tworatemodel$total)
lines(tworatemodel$slow, col='blue')
lines(tworatemodel$fast, col='red')

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.