Merge Contemporaneous Space-Time Covariates

Share:

Description

Fuse together two lists of spacio-temporal covariates

Usage

1
fuse.Hst.ls(Hst.ls1, Hst.ls2)

Arguments

Hst.ls1

Space-time covariates. A list of length τ, each element should be a numeric n x p_1 matrix.

Hst.ls2

Space-time covariates. A list of length τ, each element should be a numeric n x p_2 matrix.

Value

An unnamed list of length τ, each element will be a numeric n x (p_1+p_2) matrix.

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
set.seed(9999)

tau <- 5
n <- 7

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

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

fuse.Hst.ls(Hst.ls1, Hst.ls2)


## The function is currently defined as
function (Hst.ls1, Hst.ls2) 
{
    tau <- length(Hst.ls1)
    for (i in 1:tau) {
        Hst.ls1[[i]] <- cbind(Hst.ls1[[i]], Hst.ls2[[i]])
    }
    return(Hst.ls1)
  }