Learn R Programming

metRology (version 0.9-16.1)

update.uncert: Update and recalculate an uncertainty estimate

Description

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.

Usage

## S3 method for class '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, ...)

Arguments

object
An object of class uncert
expr
An expression, formula or function.
method
Uncertainty evaluation method. May be any of the methods listed for uncert.
x, u, df
Named list, vector or array of values to update elements of object uncert. See Details for options.
c
Update to uncert$budget$c No effect except for updates using uncert.default.
cov, cor
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.
distrib
Named list or character vector of updated distribution names.
distrib.pars
Named list of updates for distribution names and parameters.
delta
Scalar value updating delta for numeric evaluation methods.
B
Updated number of Monte Carlo iterations for uncertMC objects or specification of B when updating uncertMC objects using method="MC".
keep.x
Update to keep.x passed to uncertMC for Monte Carlo updates.
...
Other values passed to uncert or uncertMC

Value

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.

References

None, yet.

See Also

uncert-class, uncert-class, uncertMC, uncertMC-class

Examples

Run this code
#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