‘update’ allows modification of components of ‘uncert’ or ‘uncertMC’ objects, including the uncertainty estimation method used, and will recalculate the estimate and return a new ‘uncert’ or ‘uncertMC’ object. Individual elements of most components can be amended.
# S3 method for uncert
update(object, expr = NULL, method = NULL, x = NULL, u = NULL, c=NULL,
df = NULL, cov = NULL, cor = NULL, distrib = NULL,
distrib.pars = NULL, delta = NULL, B = NULL, keep.x = NULL, ...)
An object of class ‘uncert’
An expression, formula or function.
Uncertainty evaluation method. May be any of the methods listed for uncert
.
Named list, vector or array of values to update elements of
object uncert
. See Details for options.
Update to uncert$budget$c
No effect except for updates using uncert.default
.
A covariance or correlation matrix. Only one of u
and cov
should be specified; if both are specified, cov
will take precedence and a warning will be issued.
Named list or character vector of updated distribution names.
Named list of updates for distribution names and parameters.
Scalar value updating delta
for numeric evaluation methods.
Updated number of Monte Carlo iterations for ‘uncertMC’ objects or specification of
B
when updating ‘uncertMC’ objects using method="MC"
.
Update to keep.x
passed to uncertMC
for Monte Carlo updates.
Other values passed to uncert
or uncertMC
An object of class ‘uncert’ or, for method="MC"
of class ‘uncertMC’.
See uncert-class
and uncertMC-class
for details.
Update will use the values provided to update the object given, call the original function with the revised parameters and return the result as an object of class ‘uncert’ or ‘uncert’ depending on the uncertainty evaluation method used.
Note that updating with a different value of method
may result in an object of
different class. Updating an ‘uncertMC’ object with a method other than "MC"
will return an object of class ‘uncert’; similarly, updating an ‘uncert’ object
using method="MC"
will return an object of class ‘uncertMC’.
Updates to vector or list elements of uncert
such as x
, u
, df
etc. can be specified as named lists, named vectors or arrays, with names corresponding to
names of the input quantities in the uncertainty budget (that is, the names may correspond
to one or more of row.names(uncert$budget)
). If names are present, only the
corresponding individual members are updated.
If names are not present, the complete vector or list in uncert
is replaced, and names added.
Matrix elements cor
and cov
must be specified completely; see
buildCor
, updateCor
and associated functions for
covariance matrices for compact update methods.
None, yet.
# NOT RUN {
#From uncert:
expr <- expression(a+b*2+c*3+d/2)
x <- list(a=1, b=3, c=2, d=11)
u <- lapply(x, function(x) x/10)
u.expr<-uncert(expr, x, u, method="NUM")
u.expr
update(u.expr, u=list(a=0.3))
update(u.expr, method="MC")
# }
Run the code above in your browser using DataLab