logDenGaussian: logDenGaussian

Description Usage Arguments Details Value Author(s) See Also

View source: R/logDenGaussion.R

Description

Invokes the model and calculate an unnormalized logDensity (-1/2*misfit) assuming (multivariate) Gaussian errors in both data in priors.

Usage

1
2
3
4
5
logDenGaussian(theta,
 logDenAccept = numeric(0), metropolisStepTemp = c(parms = 1), 
    ..., fModel, theta0 = theta, obs, invCovar, thetaPrior = NULL, 
    invCovarTheta = NULL, namesTheta = NULL, blockIndices = NULL, 
    scale = -1/2)

Arguments

theta

the parameter vector to be optimized (may be more than updated, if used with blocks).

logDenAccept

scalar: logDen for parms from revious run for two step Metropolis decision

metropolisStepTemp

numeric named vector: the temperature for internal metropolis step

...

any other arguments passed to fModel

fModel

the model function, which predicts the output based on theta

theta0

parameter vector, first argument to fModel. Before invocation components theta overwrite theta0

obs

vector of data to compare with

invCovar

the inverse of the Covariance of obs (its uncertainty) << alternatively a vector of variances (diagonal covariance matrix) can be supplied and calculation is much more efficient

thetaPrior

the prior estimate of the parameters

invCovarTheta

the inverse of the Covariance of the prior parameter estimates << alternatively a vector of variances (diagonal covariance matrix) can be supplied and calculation is much more efficient

namesTheta

names assigned to theta (if not NULL), before invoking mofModel

blockIndices

integer vector: index of the components in theta and theta0 that should be regarded in this block

scale

factor to mulitply the misfit (e.g. -1/2 to obtain the unnormalized logDensity)

Details

If thetaPrior is not specified (NULL) then no penalty is assigned to parameters.

Supports a two-step Metropolis descision. If logDenAccept["parms"] is provided, then a Metropolis descision is done based only on the parameters. If it fails, then c(obs=NA, parms=-Inf) is returned. The possible costly evaluation of fModel is avoided.

Value

the misfit: scale *( t(tmp.diffObs) %*% invCovar %*% tmp.diffObs + t(tmp.diffParms) %*% invCovarTheta %*% tmp.diffParms )

Author(s)

Thomas Wutzler

See Also

twDEMCBlockInt dummyTwDEMCModel


twDEMC documentation built on May 31, 2017, 3:44 a.m.