Learn R Programming

metRology (version 0.9-16.1)

drop1.uncert: Single variable deletions from the uncertainty budget.

Description

drop1 calculates revised combined uncertainty for single variable deletions from an object of class 'uncert'.

Usage

## S3 method for class 'uncert':
drop1(object, scope, simplify = TRUE, 
	which=c("\% Change", "var", "u", "var.change", "u.change"), ...)

## S3 method for class 'uncertMC':
drop1(object, scope, simplify = TRUE, 
	which=c("\% Change", "var", "u", "var.change", "u.change"), ...)

#Print and plot methods 
## S3 method for class 'drop1.uncert':
print(x, \dots, digits=2)

## S3 method for class 'drop1.uncert':
plot(x, \dots, 
	which=c("\% Change", "var", "u", "var.change", "u.change"))

Arguments

object
An object of class uncert or uncertMC.
scope
character vector, expression or formula containing the list of variables to be dropped. If missing, all variables in object$budget are taken as scope.
simplify
logical. If simplify=TRUE, the return value is simplified to a named vector. If FALSE, all forms available (see which) are returned in a data frame.
which
logical; controls the form of information returned when simplify=TRUE. Possible values are: [object Object],[object Object],[object Object],[object Object],[object Object]
x
An object of class drop1.uncert returned by drop1.uncert.
...
Further objects passed to other functions.
digits
number of digits used to format the output. See the digits argument of format.

Value

  • If simplify=FALSE, an object of class drop1.uncert, consisting of a data frame with row names corresponding to row.names(object$budget), columns corresponding to all possible values of which in the order "var", "u", "var.change", "u.change", "% Change", and an attribute expr containing a copy of the expr value of the 'uncert' object to which drop1.uncert is applied. If simplify=TRUE, the column of the above data frame corresponding to which is returned as a vector with names row.names(object$budget).

Details

By analogy with drop1, drop1.uncert perfoms single variable deletions from the uncertainty budget in object, calculates the resulting uncertainty and returns the results in the form requested by simplify and which. Single variable deletion of a variable $x_i$ is equivalent to setting the uncertainty $u(x_i)$ to zero. Note that this also sets covariance terms involving $x_i$ to zero. drop1.uncert does not support the deletion of single terms such as $cov(i, j)$. In the case of uncertMC objects, drop1 currently requires object$MC$x to be present (i.e. uncertMC called with keep.x=TRUE). The uncertMC method does not support correlation. For which="var.change", which="u.change" and which="% Change" the change on dropping a variable is negative if the uncertainty reduces on removing the variable. The print method simply prints the output with a header formed from the expr attribute and with '%' appended to the "% Change" column. The plot method produces a barplot of the chosen data column. Arguments in ... are passed to barplot. If not already present in ... a default main title and ylab are used. The expr attribute is shown as marginal text if not NA.

References

None.

See Also

uncert, uncert-class, format for digits, barplot for available plot parameters.

Examples

Run this code
#An example with negative correlation
  x <- list(a=1, b=3, c=2, d=11)
  u <- lapply(x, function(x) x/10)
  u.cor<-diag(1,4)
  u.cor[3,4]<-u.cor[4,3]<- -0.5
  u.form.c<-uncert(~a+b*2+c*3+d/2, x, u, method="NUM", cor=u.cor)

  #Continuing the example from plot.uncert:
  require(graphics)
  
  d1<-drop1(u.form.c, simplify=FALSE)
  d1
  
  plot(d1)
  
  drop1(u.form.c)         #\% change only

Run the code above in your browser using DataLab