| trafo-methods {distrMod} | R Documentation |
Methods for function trafo in package distrMod;
there are accessor (trafo) and replacement (trafo<-)
versions.
trafo(object, param) ## S4 method for signature 'Estimate, missing': trafo(object,param) ## S4 method for signature 'ParamFamParameter, missing': trafo(object,param) ## S4 method for signature 'ParamFamily, missing': trafo(object,param) ## S4 method for signature 'ParamFamily, ## ParamFamParameter': trafo(object,param) ## S4 method for signature 'Estimate, ParamFamParameter': trafo(object,param) trafo.fct(object) trafo(object) <- value
object |
an object of either class Estimate,
ParamFamParameter, ParamFamily |
param |
an object of class ParamFamParameter; the parameter
value at which to evaluate the transformation |
value |
a matrix or a function; if it is a matrix, dimensions must
be consistent to the parametric setting; if it is function, it should
take one argument param of class ParamFamParameter and
return a list of length two with named components fval
(the function value, see below)
and mat (a matrix — with the same dimensions consistency
conditions as above). |
... |
additional argument(s) for methods. |
trafo is a slot of class ParamFamParameter, which
in turn is a slot of class ParamFamily. It also sort of
arises in class Estimate, i.e., all slots can be identified
by the information contained in an instance thereof.
trafo realizes partial influence curves; i.e.; we are only
interested is some possibly lower dimensional smooth (not necessarily
linear or even coordinate-wise) aspect/transformation tau
of the parameter theta.
To be coherent with the corresponding nuisance implementation, we make the following convention:
The full parameter theta is split up coordinate-wise in a main parameter theta' and a nuisance parameter theta'' (which is unknown, too, hence has to be estimated, but only is of secondary interest) and a fixed, known part theta'''.
Without loss of generality, we restrict ourselves to the case that transformation tau only acts on the main parameter theta' — if we want to transform the whole parameter, we only have to assume that both nuisance parameter theta'' and fixed, known part of the parameter theta''' have length 0.
To the implementation:
Slot trafo can either contain a (constant) matrix
D_theta or a function
tau: Theta' -> TTheta, theta |-> tau(theta)
mapping main parameter theta' to some range TTheta.
If slot value trafo is a function, besides tau(theta),
it will also return the corresponding derivative matrix
(d/d theta) (tau(theta)).
More specifically, the return value of this function theta is a
list with entries fval, the function value tau(theta),
and mat, the derivative matrix.
In case trafo is a matrix D, we interpret it as such a derivative
matrix (d/d theta) (tau(theta)),
and, correspondingly, tau(theta) as the linear mapping
tau(theta)=D * theta.
According to the signature, method trafo will return different
return value types. For signature
Estimate,missing:fct, the function tau, and mat, the matrix
(d/d theta) (tau(theta)).
function tau will then return the list list(fval, mat)
mentioned above.
Estimate,ParamFamParameter:Estimate,missing.ParamFamParameter,missing:ParamFamily,missing:ParamFamParameter,missing.ParamFamily,ParamFamParameter:Estimate,missing.
The return value depends on the signature.
For trafo.fct, we return the corresponding function
tau() (see below).
For trafo, we have:
signature |
a list of length two with components
fct and mat (see below) |
signature |
a list of length two with components
fct and mat (see below) |
signature |
a matrix (see below) |
signature |
a matrix (see below) |
signature |
a list of length two
with components fct and mat (see below) |
## Gaussian location and scale
NS <- NormLocationScaleFamily(mean=2, sd=3)
## generate data out of this situation
x <- r(distribution(NS))(30)
## want to estimate mu/sigma, sigma^2
## -> new trafo slot:
trafo(NS) <- function(param){
mu <- param["mean"]
sd <- param["sd"]
fval <- c(mu/sd, sd^2)
nfval <- c("mu/sig", "sig^2")
names(fval) <- nfval
mat <- matrix(c(1/sd,0,-mu/sd^2,2*sd),2,2)
dimnames(mat) <- list(nfval,c("mean","sd"))
return(list(fval=fval, mat=mat))
}
## Maximum likelihood estimator
(res <- MLEstimator(x = x, ParamFamily = NS))
## confidence interval
confint(res)