onevar: Creates a 'matrix' of one-variable models.

View source: R/onevar.R

onevarR Documentation

Creates a matrix of one-variable models.

Description

This function simplifies working with one-variable models in, for example, fDMA. It produces a matrix corresponding to the set of models consisting of models with a constant and just one extra variable, and a model with a constant only.

Usage

onevar(x)

Arguments

x

matrix of independent variables, see mods.incl in fDMA

Value

matrix, inclusion of a variable is indicated by 1, omitting by 0

Examples


wti <- crudeoil[-1,1]
drivers <- (lag(crudeoil[,-1],k=1))[-1,]
ld.wti <- (diff(log(wti)))[-1,]
ld.drivers <- (diff(log(drivers)))[-1,]

mds <- diag(1,ncol(ld.drivers),ncol(ld.drivers))
mds <- cbind(rep(1,ncol(ld.drivers)),mds)
mds <- rbind(rep(0,ncol(mds)),mds)
mds[1,1] <- 1

m1 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,mods.incl=mds)

# Equivalently: 

m2 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,mods.incl=onevar(ld.drivers))


fDMA documentation built on July 26, 2023, 6:09 p.m.

Related to onevar in fDMA...