add_car1: Add the CAR(1) autocorrelation structure.

View source: R/add_car1.R

add_car1R Documentation

Add the CAR(1) autocorrelation structure.

Description

Add the CAR(1) autocorrelation structure.

Usage

add_car1(x, response, gr_vars = c(".index", "series"))

Arguments

x

A dataframe.

response

The column of x containing the resonse variable.

gr_vars

Grouping variables withing which to calculate lagged residuals.

Value

The input dataframe with the fitted values transformed to have the CAR(1) autocorrelation structure.

Examples

data_ar <- read.csv(paste0(system.file("extdata", package = "bgamcar1"), "/data_ar.csv"))
data_ar$`ar[1]` <- .7
data_ar$.epred <- 0
add_car1(data_ar, "y", gr_vars = "series")

bentrueman/bgamcar1 documentation built on July 6, 2024, 11:16 p.m.