applystnd.Hs: Standardize Spacial Covariates with Existing Object

Description Usage Arguments Value See Also Examples

View source: R/applystnd.Hs.R

Description

Standardize spacial covariates with respect to both the space and time dimensions

Usage

1
applystnd.Hs(Hs0, x)

Arguments

Hs0

Spacial covariates (of interpolation sites). An n* x p_s numeric matrix.

x

Spacial standardization object, as created by stnd.Hs.

Value

An n* x p_s matrix.

See Also

stnd.Hst.ls, applystnd.Hst.ls.

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
26
27
28
29
30
31
32
n.all <- 21
Hs.all <- cbind(1, rnorm(n.all, 1, 0.1), rnorm(n.all, -200, 21))

ndx.interp <- c(1,3,5)
ndx.support <- I(1:n.all)[ -ndx.interp ]


Hs <- Hs.all[ndx.support, , drop=FALSE]

xsns.obj <- stnd.Hs(Hs)

Hs0 <- Hs.all[ndx.interp, , drop=FALSE]

sHs0 <- applystnd.Hs(Hs0, xsns.obj)
sHs0

xsns.obj$sHs

crossprod(xsns.obj$sHs) / nrow(Hs)

crossprod(sHs0) / nrow(sHs0)


## The function is currently defined as
function (Hs0, x) 
{
    sHs0 <- t((t(Hs0) - x$h.mean)/x$h.sd)
    if (x$intercept) {
        sHs0[, 1] <- 1/sqrt(x$n)
    }
    return(sHs0)
  }

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