numberPredictableObservations {ClusterVAR} | R Documentation |
Determine the number of observations that can be predicted
Description
numberPredictableObservations
is a function to determine the number of observations in a given dataset that can be predicted based on the availability of previous observations, considering a specified time-lag.
Usage
numberPredictableObservations(Data, yVars, Beep, Day = NULL, ID,
xContinuous = NULL, xFactor = NULL, Lags, ...)
Arguments
Data |
The data provided in a data.frame. |
yVars |
An integer vector specifying the position of the column(s) in dataframe |
Beep |
An integer specifying the position of the column in dataframe |
Day |
Optional. An integer specifying the position of the column in dataframe |
ID |
An integer specifying the position of the column in dataframe |
xContinuous |
Optional argument. An integer vector specifying the position of the column(s) in dataframe Data that contain the continuous exogenous variable(s), if present. Exogenous variables are also known as covariates or as moderators for the within-person mean. |
xFactor |
Optional argument. An integer vector specifying the position of the column(s) in dataframe Data that contain the categorical exogenous variable(s), if present. Exogenous variables are also known as covariates or as moderators for the within-person mean. |
Lags |
An integer or integer vector specifying the number of VAR(p) lags to consider. Needs to be a sequence of subsequent integers. The maximum number supported is |
... |
Additional arguments passed to the function. |
Details
This function determines the number of observations in a given dataset that can be predicted based on previous observations. For instance, in a lag-1 model, if an observation is missing, the observation at the next time-point cannot be predicted. Similarly, in a lag-2 model, if an observation is missing, the observations at the next two time-points cannot be predicted. The output gives the number of predictable observations for each of the endogenous variables that was specified under yVars
. The number of predictable observations is the same for all endogenous variables.
Value
Predictable observations per subject |
The number of predictable observations for each endogenous variable per subject, considering a specified time-lag. |
Total predictable observations |
The total number of predictable observations summed over all subjects in the dataset for each endogenous variable, considering a specified time-lag. |
Author(s)
Anja Ernst & Jonas Haslbeck
Examples
head(SyntheticData)
Obs <- numberPredictableObservations(Data = SyntheticData, yVars = 1:4,
Beep = 9, Day = 10, ID = 5, Lags = 1:3)
Obs
Obs$`Predictable observations per subject`$`1 Lag`