Standardize Spacial Covariates

Share:

Description

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

Usage

1
stnd.Hs(Hs, Hs0 = NULL, intercept = TRUE)

Arguments

Hs

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

Hs0

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

intercept

Include intercept term? Boolean.

Value

A named list.

sHs

An n x p_s numeric matrix.

sHs0

An n* x p_s numeric matrix.

h.mean

The covariates' mean over space.

h.sd

The covariates' standard deviation over space.

n

Number of support sites.

intercept

The supplied intercept argument.

See Also

stnd.Ht, stnd.Hst.ls, applystnd.Hs.

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
##### Please see the examples in Hst.sumup



## The function is currently defined as
function (Hs, Hs0 = NULL, intercept = TRUE) 
{
    n <- nrow(Hs)
    h.mean <- apply(Hs, 2, mean)
    h.sd <- apply(t(t(Hs) - h.mean), 2, function(x) {
        sqrt(sum(x^2))
    })
    h.sd[h.sd == 0] <- 1
    sHs <- t((t(Hs) - h.mean)/h.sd)
    if (intercept) {
        sHs[, 1] <- 1/sqrt(n)
    }
    sHs0 <- NULL
    if (!is.null(Hs0)) {
        sHs0 <- t((t(Hs0) - h.mean)/h.sd)
        if (intercept) {
            sHs0[, 1] <- 1/sqrt(n)
        }
    }
    ls.out <- list(sHs = sHs, sHs0 = sHs0, h.mean = h.mean, h.sd = h.sd, 
        n = n, intercept = intercept)
    return(ls.out)
  }