AR1_MODEL-cash-..init..: Initialization method

AR1_MODEL$..init..R Documentation

Initialization method

Description

This function will be called after an instance is built. User input will be stored in the environment. The response variable of this model is y. The formula of y is defined in AR1_MODEL$formula, the null formula is defined in AR1_MODEL$null_formula, the alternative is defined in AR1_MODEL$alt_formula.

Arguments

phi

Numeric. The parameter for the AR(1) term. Default is phi = 0.5.

sigma

Positive numeric. Default is sigma = 1.

x

Random variable or closed form expression. Default is x = rand_uniform(-1, 1, env = new.env(parent = parent.env(self))).

e

Random variable or closed form expression. Default is e = rand_normal(0, sigma, env = new.env(parent = parent.env(self))).

Value

Return the object itself.

Examples


# Instantiate
x <- rand_uniform()
e <- rand_normal(sigma = 0.5)

test <- ar1_model(phi = 0.9, x = x, e = e)

test

# Generate data
test$gen(10)

# Generate lineup
test$gen_lineup(10, k = 3)

# Plot the lineup
test$plot_lineup(test$gen_lineup(100))

test <- ar1_model(phi = 0.1, x = x, e = e)
test$plot_lineup(test$gen_lineup(100))

test <- ar1_model(phi = 0.3, x = x, e = e)
test$plot_lineup(test$gen_lineup(100))

test <- ar1_model(phi = 0.5, x = x, e = e)
test$plot_lineup(test$gen_lineup(100))

test <- ar1_model(phi = 0.7, x = x, e = e)
test$plot_lineup(test$gen_lineup(100))

TengMCing/visage documentation built on Aug. 28, 2024, 3:27 p.m.