# load.Hst.ls.Z: Load Observations into Space-Time Covariates In widals: Weighting by Inverse Distance with Adaptive Least Squares for Massive Space-Time Data

## Description

Insert an observation matrix into space-time covariates

## Usage

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

## Arguments

 `Z` Observation data. A τ x n numeric 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 of `Hst.ls.Z[[i]]` to insert into the ith 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.

## Value

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

`load.Hst.ls.2Zs`.
 ``` 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51``` ```###### 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) ## The function is currently defined as function (Z, Hst.ls.Z, xwhich, rgr.lags = c(0)) { tau <- nrow(Z) min.ndx <- max(1, -min(rgr.lags) + 1) max.ndx <- min(tau, tau - max(rgr.lags)) for (i in min.ndx:max.ndx) { Hst.ls.Z[[i]][, xwhich] <- t(Z[i + rgr.lags, ]) } return(Hst.ls.Z) } ```