| deltaMethod | R Documentation |
An expansion of the capabilities of deltaMethod from the
car package.
## S3 method for class 'data.frame' deltaMethod( object, g, uncertainties, estimates = measurements, func = g, constants = c(), measurements = NULL, vcov., ... )
object |
a data frame containing measured quantities |
g |
a quoted string that is describes the function of the parameter estimates to be
evaluated; see |
uncertainties |
a data frame with the same dimension as |
estimates |
a vector of column names or column numbers used to specify a subset of |
func |
a quoted string used to annotate output. The default of func = g is usually appropriate. |
constants |
This argument is a named vector whose elements are constants that are used in the f argument. This is needed only when the function is called from within another function to comply to R scoping rules. |
measurements |
an alternative name for |
vcov. |
a covariance matrix or a list of covariance matrices. Only one of
|
... |
additional arguments passed through to |
deltaMethod in the car package.
if (require(mosaicData)) {
C_p <- 4.182 / 60 # / 60 because measureing m in L/min
exprforQ <- "(T.cold.out - T.cold.in) * C_p * m.cold"
deltaMethod( HeatX[, c("T.cold.in","T.cold.out","m.cold")], exprforQ, c(1,1,.5) )
# This is just wordier in this example, but would allow the uncertainties to vary
# from row to row.
HeatX3 <-
transform(HeatX,
u.cold.in=1, u.cold.out=1, u.hot.in=1, u.hot.out=1,
u.m.cold=0.5, u.m.hot=0.5)
deltaMethod( HeatX3[, c("T.cold.in","T.cold.out","m.cold")], exprforQ,
HeatX3[, c("u.cold.in", "u.cold.out", "u.m.cold")])
# Rather than specifying two data frames, we can use subsetting instead
deltaMethod( HeatX3, exprforQ,
estimates=c("T.cold.in","T.cold.out","m.cold"),
uncertainties=c("u.cold.in", "u.cold.out", "u.m.cold"))
# Can also specify vcov. as a matrix or list of matrices:
deltaMethod(HeatX[, c("T.cold.in","T.cold.out","m.cold")], exprforQ,
vcov. = diag(c(1,1,.5)^2) )
deltaMethod(HeatX[, c("T.cold.in","T.cold.out","m.cold")], exprforQ,
vcov. = list( diag(c(1,1,.5)^2), diag(c(1,2,.8)^2) ) )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.