| fit_var | R Documentation |
Fits a transparent VAR(1) baseline from intensive longitudinal data using
ordinary least squares: current variables are regressed on an intercept and
lag-1 predictors. The lag construction, scaling, within-person centring,
and day-boundary behaviour match fit_graphical_var(), but no regularization or
EBIC model selection is applied.
fit_var(
data,
vars,
id = NULL,
day = NULL,
beep = NULL,
lags = 1L,
scale = TRUE,
center_within = TRUE,
delete_missings = TRUE,
min_obs = NULL,
subject = NULL
)
data |
A |
vars |
Character vector of variable names. |
id |
Character. Name of the person-ID column, or |
day |
Character. Name of the day/session column, or |
beep |
Character. Name of the measurement-occasion column, or |
lags |
Integer. Only |
scale |
Logical. Whether to standardize variables before lagging.
Default |
center_within |
Logical. Whether to centre within person when more than
one id is present. Default |
delete_missings |
Logical. Drop incomplete current/lagged rows. Default
|
min_obs |
Integer or |
subject |
Optional vector naming the subject(s) to analyse. |
A var_result object with temporal OLS coefficients, residual
covariance, residual precision, contemporaneous partial correlations, and
tidy access through edges(), coefs(), nodes(), and summary().
set.seed(1)
d <- data.frame(id = 1, A = rnorm(80), B = rnorm(80), C = rnorm(80))
fit <- fit_var(d, vars = c("A", "B", "C"), id = "id")
edges(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.