Hals.ses {widals}R Documentation

Effective Standard Errors

Description

Calculate the ALS so-called 'effective standard errors'

Usage

Hals.ses(Z, Hs, Ht, Hst.ls, rho, reg, b.lag, test.rng)

Arguments

Z

Space-time data. A \tau x n numeric matrix.

Hs

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

Ht

Temporal covariates (of supporting sites). A \tau x p_t numeric matrix.

Hst.ls

Space-time covariates (of supporting sites). A list of length \tau, each element should be a numeric n x p_st matrix.

rho

ALS signal-to-noise ratio (SNR). A non-negative scalar.

reg

ALS regularizer. A non-negative scalar.

b.lag

ALS lag. A scalar integer, typically -1 (a-prior), or 0 (a-posteriori).

test.rng

Temporal test range. A vector of temporal indices of the model test range.

Value

A named list.

estimates

A p_s+p_t+p_st x 2 matrix, each row giving the ALS partial slope estimate/prediction at time \tau, and the 'effective standard error (prediction error)' for the partial slope.

inv.LHH

A (p_s+p_t+p_st) x (p_s+p_t+p_st) matrix. This is the (ALS predicted) covariate precision matrix at time \tau.

ALS.g

The ALS gain at time \tau.

Examples


## Please see the example in H.als.b

## The function is currently defined as
function (Z, Hs, Ht, Hst.ls, rho, reg, b.lag, test.rng) 
{
    tau <- nrow(Z)
    xALS <- H.als.b(Z = Z, Hs = Hs, Ht = Ht, Hst.ls = Hst.ls, 
        rho = rho, reg = reg, b.lag = b.lag, Hs0 = NULL, Ht0 = NULL, 
        Hst0.ls = NULL)
    rmse <- sqrt(mean((Z[test.rng, ] - xALS$Z.hat[test.rng, ])^2))
    rmse
    als.se <- rmse * sqrt(xALS$ALS.g) * sqrt(diag(xALS$inv.LHH))
    return(list(estimates = cbind(xALS$B[tau, ], als.se), inv.LHH = xALS$inv.LHH, 
        ALS.g = xALS$ALS.g))
  }

[Package widals version 0.6.1 Index]