Learn R Programming

SpatioTemporal (version 1.1.9.1)

estimateBetaFields: Regression Estimates of beta-Fields

Description

Estimates the latent-beta fields for a STdata/STmodel object by regressing the observations for each site on the temporal trends.

Usage

estimateBetaFields(STdata = NULL, subset = NULL)

Arguments

STdata

A STdata/STmodel object containing observations. Use either this or the obs, date, and ID inputs.

subset

A subset of locations for which to estimate the beta-fields. A warning is given for each name not found in ID.

Value

A list with two matrices; the estimated beta-coefficients and standard deviations of the estimates.

See Also

Other data matrix: SVDmiss, SVDsmooth, createDataMatrix, mesa.data.raw

Other STdata functions: c.STmodel, createDataMatrix, createSTdata, createSTmodel, detrendSTdata, removeSTcovarMean, updateTrend.STdata

Other STmodel functions: createCV, createDataMatrix, createSTmodel, dropObservations, loglikeSTdim, loglikeST, predictNaive, processLUR, processLocation, updateCovf, updateTrend.STdata

Examples

Run this code
# NOT RUN {
require(plotrix)

##load data
data(mesa.model)

##Regression based estimate of the beta-fields
beta <- estimateBetaFields(mesa.model)

##check regression coefficients
summary(beta$beta)

##or plot as a function of distance to coast,
##with uncertainties
par(mfrow=c(2,2))
for(i in 1:3){
  plotCI(mesa.model$LUR[[1]][,"log10.m.to.a1"], beta$beta[,i],
         uiw=1.96*beta$beta.sd[,i],
         ylab=colnames(beta$beta)[i])
}

##or compare to the fields from predict.STmodel
data(pred.mesa.model)

##Study the results
##Start by comparing beta fields
par(mfcol=c(1,1), mar=c(4.5,4.5,2,.5), pty="s")
plotCI(x=beta$beta[,1], y=pred.mesa.model$beta$EX[,1],
       uiw=1.96*sqrt(pred.mesa.model$beta$VX[,1]),
       main="Temporal Intercept",
       xlab="Empirical estimate",
       ylab="Spatio-Temporal Model")
plotCI(x=beta$beta[,1], y=pred.mesa.model$beta$EX[,1],
       uiw=1.96*beta$beta.sd[,1], add=TRUE, err="x")
abline(0,1,col="grey")

##or just the regression part of the beta fields
points(x=beta$beta[,1], y=pred.mesa.model$beta$mu[,1],
       col=2, pch=19)
# }

Run the code above in your browser using DataLab