UtilitiesVGAMextra: Utility Functions for the 'VGAMextra' Package

UtilitiesVGAMextraR Documentation

Utility Functions for the VGAMextra Package


A set of common utility functions required by time series family functions at 'VGAMextra'.


  Is.Numeric(x, isInteger  = FALSE, length.arg = NULL, Nnegative  = NULL)
  is.FormulaAR(Model = ~ 1, Resp  = 1) 
  cross.gammas(x, y = NULL, lags = 1)
  WN.lags(y, lags, to.complete = NULL)
  extract.Residuals(object, TSprocess,...)
  weightsVGAMextra(object, type.w = "prior",...)



A vector of quantiles. Particularly, for Is.Numeric it is a single number (or vector) to be tested: Whether is numeric or not.


Vector of quantiles to be lagged. Then, the cross - covariances are computed from x and y_t, x and y_{t -1}, etcetera.


Logical. If TRUE, it verifies that quantiles x are integers. Default is FALSE.


Integer indicating the number of lags or delays to be applied to vector y. Then, calculate the cross-covariance between the pair of signals x and delayed samples computed from y.


Integer. If length.arg > 0, it verifies that the length of x matches length.arg.


Formula. A symbolic form of the models fitted by the vglm call. See formula for further details.


Logical. If TRUE, it verifies that x (all entries) are positive.


Integer. The number of responses in the Model. It must macth the number of respones entered in the vglm call.


An object of class 'vglm'. See vglm-class for details.


Logical, what time series model is being fitted. Choices are 'AR', 'MA', 'ARMA' and 'ARIMA'.


Character. What type of weights are to be used. Default is "prior". These are extracted from the slot @prior.weights of object.


Use this argument to fill in the first 'p' observations when computing the lagged vectors in time series.


Additional parameters required by function extract.Residuals.


A set of utility functions in VGAMextra for different purposes.

Specially for time series family functions in VGAMextra which involve specific checks on the majority of arguments entered by the user.


Is.Numeric() returns a logical vector (or value) (TRUE or FALSE), after verifying whether quantiles x satisfies all conditions entered.

For is.FormulaAR(), this function returns a logical value, after verifying whether the expression entered for the Model argument in cm.ARMA is an object of class 'formula'.

Particularly, cross.gammas() computes either the single lagged covariance(s) from quantiles given in x or the lagged cross-covariance(s) from values given in x and y.

extract.Residuals() extracts the residuals of the process from slot @residuals, whilst

fittedVGAMextra and weightsVGAMextra return the fitted values and the weights from the vglm object, correspondingly.

isNA and inspectVGAMextra are essentially required when implementing link functions in VGAMextra.


V. Miranda and T. W. Yee.

See Also



# Example 1.
myModel1 <- ~ x1 + x2
is.FormulaAR(myModel1)       # TRUE

test <- list( cbind(y1, y2) ~ x1, ~ x2 - 1)
is.FormulaAR(test)          # FALSE
is.FormulaAR(test[[1]], 2)  # TRUE

# Example 2.

x1 <- c(1:3, 4.5, -Inf)
Is.Numeric(x1)                                        # TRUE
Is.Numeric(x1, length.arg = 5)                        # TRUE
Is.Numeric(x1, length.arg = 5, isInteger = TRUE)      # FALSE
Is.Numeric(x1, length.arg = 5, Nnegative = TRUE)      # FALSE

# Example 3. 
# Here, 'cross.gammas' computes Cov(x, y_{t - 1}), Cov(x, y_{t - 2}) and
# Cov(x, y_{t - 3}). 

x <- runif(50)
y <- runif(50)
cross.gammas(x, y, lags = 3)

VGAMextra documentation built on Nov. 2, 2023, 5:59 p.m.