Recalibrate x, y data using SITAR random effects
A function to recalibrate x,y data using SITAR random effects
recalib(xc, yc, id = NULL, data, xcnew = NULL, ycnew = NULL, model, from, to)
xc
: character vector defining column name(s) of x
data to be recalibrated.
yc
: character vector defining column name(s) of y
data to be recalibrated.
id
: factor defining from
and to
rows. If NULL
then recalibrate all rows.
data
: dataframe containing xc
, yc
and id
.
xcnew
: column names for replacement columns xc
. If default NULL
then use names xcnew1... .
ycnew
: column names for replacement columns yc
. If default NULL
then use names ycnew1... .
model
: sitar
model defining the random effects to be used for recalibration.
from
: level of id
defining existing data (must be a single row in coef{model}
).
to
: level of id
defining data to be recalibrated (a single row in coef{model}
).
Returns the dataframe data
with the from
rows of xc
and yc
recalibrated.
recalib
recalibrates the values of xc
and yc
based on model
. xc
values are changed to:
(xc-c(coef[from,'b']))*exp(coef[from,'c']-coef[to,'c'])+coef[to,'b'].
yc
values are changed to: yc-coef[from,'a']+coef[to,'a']
.
Tim Cole tim.cole@ucl.ac.uk