Description Usage Arguments Value Examples
A parameter vector is a named numeric vector (the parameter values) together with a "deriv" attribute (the Jacobian of a parameter transformation by which the parameter vector was generated).
1 2 3 4 5 6 7 8 9 10 11 12 |
... |
objects to be concatenated |
deriv |
matrix with rownames (according to names of |
x |
numeric or named numeric, the parameter values |
names |
optional character vector, the parameter names. Otherwise, names
are taken from |
drop |
logical, drop empty columns in Jacobian after subsetting. ATTENTION: Be careful with this option. The default behavior is to keep the columns in the Jacobian. This can lead to unintended results when subsetting the parvec and using it e.g. in another parameter transformation. |
An object of class parvec
, i.e. a named numeric vector with attribute "deriv".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Generate a parameter vector
v <- parvec(a = 2, b = 3)
print(v)
print(getDerivs(v))
# Parameter vector from a named numeric
M <- matrix(c(1, 1, 0, 1),
nrow = 2, ncol = 2,
dimnames = list(c("a", "b"), c("A", "B"))
)
v <- as.parvec(x = c(a = 2, b = 3), deriv = M)
print(v)
print(getDerivs(v))
# Subsetting of parameter vectors
# Case 1: Dependencies in the Jacobian are maintained
w <- v[1]
print(w)
print(getDerivs(w))
# Case 2: Dependencies are dropped
w <- v[1, drop = TRUE]
print(w)
print(getDerivs(w))
# Concatenating parameter vectors
w <- parvec(c = 4, d = 5)
print(c(v, w))
print(getDerivs(c(v, w)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.