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

Description Usage Arguments Value Examples

View source: R/onevar.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
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))

## End(Not run)

fDMA documentation built on July 17, 2020, 5:06 p.m.

Related to onevar in fDMA...