Learn R Programming

widals (version 0.6.2)

load.Hst.ls.Z: Load Observations into Space-Time Covariates

Description

Insert an observation matrix into space-time covariates

Usage

load.Hst.ls.Z(Z, Hst.ls.Z, xwhich, rgr.lags = c(0))

Value

An unnamed list of length \(\tau\), each element will be a numeric \(n\) x \(p_st\) matrix.

Arguments

Z

Observation data. A \(\tau\) x \(n\) numeric matrix.

Hst.ls.Z

Space-time covariates. A list of length \(\tau\), each element should be a numeric \(n\) x \(p_st\) matrix.

xwhich

Which column of Hst.ls.Z[[i]] to insert into the \(i\)th row of Z. A scalar positive integer.

rgr.lags

Temporal lagging of Z. A scalar integer.

Details

This function, along with load.Hst.ls.2Zs, allows the user to convert a set of observations into covariates for another set of observations.

See Also

load.Hst.ls.2Zs.

Examples

Run this code



###### here's an itty-bitty example

tau <- 7
n <- 5

Z <- matrix(1, tau, n)

Hst.ls <- list()
for(i in 1:tau) { Hst.ls[[i]] <- matrix(rnorm(n*4), nrow=n) }

load.Hst.ls.Z(Z, Hst.ls.Z=Hst.ls, 1, 0)


########## insert into col 3

load.Hst.ls.Z(Z, Hst.ls.Z=Hst.ls, 3, 0)




############ lag Z examples

Z <- matrix(1:tau, tau, n)

######### lag -1 Z

load.Hst.ls.Z(Z, Hst.ls.Z=Hst.ls, 1, -1)

######### lag 0 Z -- default

load.Hst.ls.Z(Z, Hst.ls.Z=Hst.ls, 1, 0)

######### lag +1 Z

load.Hst.ls.Z(Z, Hst.ls.Z=Hst.ls, 1, +1)



Run the code above in your browser using DataLab