interpolate_rt {rtestim} | R Documentation |
Interpolate (or extrapolate) Rt estimates to intermediate design points
Description
Interpolate (or extrapolate) Rt estimates to intermediate design points
Usage
interpolate_rt(object, xout, ...)
## S3 method for class 'cv_poisson_rt'
interpolate_rt(object, xout, which_lambda = c("lambda.min", "lambda.1se"), ...)
## S3 method for class 'poisson_rt'
interpolate_rt(object, xout, lambda = NULL, ...)
Arguments
object |
A fitted object produced by |
xout |
a vector of new positions at which Rt should be produced, but where counts may not have been observed. |
... |
additional arguments passed to methods. |
which_lambda |
Select which lambdas from the object to use. If not provided, all Rt's are returned. Note that new lambdas not originally used in the estimation procedure may be provided, but the results will be calculated by linearly interpolating the estimated Rt's. The strings |
lambda |
Vector. A user supplied sequence of tuning parameters which
determines the balance between data fidelity and
smoothness of the estimated Rt; larger |
Value
A vector or matrix of interpolated Rt estimates.
Examples
y <- c(1, rpois(100, dnorm(1:100, 50, 15) * 500 + 1))
out <- estimate_rt(y)
# originally estimated at
out$x
# get the Rt at 3 new points (for all estimated lambdas)
int <- interpolate_rt(out, c(10.5, 11.5, 12.5))
# get the Rt at a single value of lambda
interpolate_rt(out, c(10.5, 11.5, 12.5), lambda = out$lambda[20])
y <- c(1, rpois(100, dnorm(1:100, 50, 15) * 500 + 1))
out <- estimate_rt(y, nsol = 10)
interpolate_rt(out, xout = c(1.5, 2.5))