stnd.Hs {widals} | R Documentation |
Standardize Spacial Covariates
Description
Standardize spacial covariates with respect to both the space and time dimensions
Usage
stnd.Hs(Hs, Hs0 = NULL, intercept = TRUE)
Arguments
Hs |
Spacial covariates (of supporting sites). An |
Hs0 |
Spacial covariates (of interpolation sites). An |
intercept |
Include intercept term? Boolean. |
Value
A named list.
sHs |
An |
sHs0 |
An |
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
##### 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)
}
[Package widals version 0.6.1 Index]