unload.Hst.ls: Convert a Space-Time Covariate into Data

Description Usage Arguments Value See Also Examples

View source: R/unload.Hst.ls.R

Description

Convert a spacio-temporal covariate into contemporaneous data

Usage

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

Arguments

Hst.ls

Space-time covariates. A list of length τ, 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 τ x n matrix.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
	
###### 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)
  }

widals documentation built on Dec. 8, 2019, 1:07 a.m.