resFun {spsh} | R Documentation |
Calculation of the Objective Function Value
Description
Contains the objective functions to calculate (weighted) sum of squared residuals or likelihoods. The assumption made is that the residuals are identically, independantly and normally distributed. The normal distribution of the model residuals is standardly given with mean = 0, and variance = 1.if weighting is not considered. There are three methods to consider weights: a) fixed skalar values for each data type, b) a vector of weights for each data type. The vector has to have the same length as the vector of the data type. c) It is possible to estimate the
Usage
resFun(
p,
shpmodel = "01110",
retdata = NULL,
condata = NULL,
pretrans = NULL,
weight = NULL,
method = "rss",
trim.query = FALSE,
ivap.query = NULL,
hclip.query = FALSE,
parL = NULL
)
Arguments
p |
Vector of model parameters handed used to calculate the soil hydraulic property model values in shypFun.
Depends on | |||||||
shpmodel |
Character identifying the soil hydraulic property model. See shypFun. | |||||||
retdata |
A dataframe or matrix with 2 columns. The first with pressure head values in [cm] and the second with volumetric water contents in [cm cm-3]. | |||||||
condata |
A dataframe or matrix with 2 columns. The first with pressure head values in [cm] and the second with hydraulic conductivity values in log10[cm d-1]. | |||||||
pretrans |
A vector to back transform the parameters before the soil hydraulic property function values calculated. | |||||||
weight |
Specification of weight method. See weightFun. | |||||||
method |
| |||||||
trim.query |
Default | |||||||
ivap.query |
Default is | |||||||
hclip.query |
Implemented purely for future compatability. | |||||||
parL |
Defaults to |
Details
Model errors may be specified or estimated as nuisance parameters weighting the data classes. In case the model error !=1, the output statistics are weighted accordingly.
Value
Returns scalar of sum of squared (weighted) residuals or vector of weighted residuals, as specified by
user | user defined weights |
none | no weights are considered, i.e. no measurement error assumed |
range | rescaling (normalization of observations to the intervall [0,1] |
fix1 | fixed scalar weight for THETA is 1/0.05^2 and weight for log10K is 1 |
est1 | Two scalar model weights 1/sigma_i^2 are treated as free parameters to be estimated by inversion, one for THETA and one for log10K . Only simultaneously estimateable |
Examples
# load data
data("shpdata1")
# observations
retdata <- shpdata1$LFH1$wrc[!is.na(shpdata1$LFH1$wrc[,1]),]
condata <- shpdata1$LFH1$hcc
# 7 - resFun ------------------------------------------------------------
# soil hydraulic property model parameters, van Genuchten-Mualem
p <- c("thr" = 0.16, "ths" = 0.46, "alf1" = 0.03, "n1" = 1.42, "Ks" = 26, "tau" = .5)
# calculate weighted residuals
wres <- resFun(p, retdata = retdata, condata = condata, pretrans = NULL,
weight = list("wth" = 0.0025, "wKh" = 1), method = "res", trim = FALSE)
## residuals of the soil water retention curve [-]
theta.wres <- wres[1:dim(retdata)[1]]
## residuals of the log10 hydraulic conductivity curve [cm/d]
log10K.wres <- wres[(dim(retdata)[1]+1) : length(wres)]