derive_timeseries {itsadug} | R Documentation |
Derive the time series used in the AR1 model.
Description
Derive the time series used in the AR1 model.
Usage
derive_timeseries(model, AR.start = NULL)
Arguments
model |
GAMM model that includes an AR1 model. |
AR.start |
Vector with AR.start information, necessary for the AR1 model. Optional, defaults to NULL. |
Value
A vector with time series indication based on the AR1 model.
Author(s)
Jacolien van Rij
See Also
Other functions for model criticism:
acf_n_plots()
,
acf_plot()
,
acf_resid()
,
resid_gam()
,
start_event()
,
start_value_rho()
Examples
data(simdat)
# add missing values to simdat:
simdat[sample(nrow(simdat), 15),]$Y <- NA
simdat <- start_event(simdat, event=c('Subject', 'Trial'))
## Not run:
# Run GAMM model:
m1 <- bam(Y ~ te(Time, Trial)+s(Subject, bs='re'), data=simdat,
rho=.5, AR.start=simdat$start.event)
simdat$Event <- NA
simdat[!is.na(simdat$Y),]$Event <- derive_timeseries(m1)
acf_resid(m1, split_pred=list(Event=simdat$Event))
# And this works too:
simdat$Event <- derive_timeseries(simdat$start.event)
acf_resid(m1, split_pred=list(Event=simdat$Event))
# Note that acf_resid automatically makes use of derive_timeseries:
acf_resid(m1, split_pred='AR.start')
## End(Not run)
[Package itsadug version 2.4.1 Index]