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

Description Usage Arguments Details Value See Also Examples

View source: R/load.Hst.ls.2Zs.R

Description

Insert an observation matrix into space-time covariates, but segregate based on missing values

Usage

1
load.Hst.ls.2Zs(Z, Z.na, Hst.ls.Z, xwhich, rgr.lags = c(0))

Arguments

Z

Observation data. A τ x n numeric matrix.

Z.na

Missing data indicator. A τ x n boolean matrix.

Hst.ls.Z

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

xwhich

Which column-pair of Hst.ls.Z[[i]] to insert into the ith row of Z. A scalar positive integer. By 'column-pair', we mean, e.g., a value of 1 will fill columns 1 and 2, a value of 2 will fill columns 3 and 4, a value of 3 will fill columns 5 and 6, etc.

rgr.lags

Temporal lagging of Z. A scalar integer.

Details

This function, along with load.Hst.ls.Z, allows the user to convert a set of observations into covariates for another set of observations. Unlike load.Hst.ls.Z, this function splits Z based on the argument Z.na. Values associated with FALSE elements of Z.na are placed into the first column of the specified column-pair of Hst.ls.Z, Values associated with TRUE elements of Z.na are placed into the second column of the specified column-pair of Hst.ls.Z (all other values in in the specified column-pair of Hst.ls.Z are zeroed).

Value

An unnamed list of length τ, each element will be a numeric n x p_st matrix.

See Also

load.Hst.ls.Z.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
###### here's an itty-bitty example

tau <- 7
n <- 5

Z <- matrix(1, tau, n)

Z.na <- matrix(FALSE, tau, n)
Z.na[2:3, 4] <- TRUE

Z[Z.na] <- 2

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


load.Hst.ls.2Zs(Z, Z.na, Hst.ls.Z=Hst.ls, 1, 0)


########## insert into cols 3 and 4

load.Hst.ls.2Zs(Z, Z.na, Hst.ls.Z=Hst.ls, 2, 0)

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