unload.Hst.ls {widals}R Documentation

Convert a Space-Time Covariate into Data

Description

Convert a spacio-temporal covariate into contemporaneous data

Usage

unload.Hst.ls(Hst.ls, which.col, rgr.lags)

Arguments

Hst.ls

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

which.col

Which column of Hst.ls[[i]] to insert into the ith row of Z. A scalar positive integer.

rgr.lags

Temporal lagging of Z. A scalar integer.

Value

A numeric \tau x n matrix.

See Also

load.Hst.ls.Z, load.Hst.ls.2Zs.

Examples

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

tau <- 7
n <- 5

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

Zh <- unload.Hst.ls(Hst.ls, 1, 0)


## The function is currently defined as
function (Hst.ls, which.col, rgr.lags) 
{
    n <- nrow(Hst.ls[[1]])
    tau <- length(Hst.ls)
    Z.out <- matrix(NA, tau, n)
    min.ndx <- max(1, -min(rgr.lags) + 1)
    max.ndx <- min(tau, tau - max(rgr.lags))
    for (i in min.ndx:max.ndx) {
        Z.out[i - rgr.lags, ] <- Hst.ls[[i]][, which.col]
    }
    return(Z.out)
  }

[Package widals version 0.6.1 Index]