Learn R Programming

distrMod (version 2.0.7)

trafo-methods: Methods for function trafo in Package `distrMod'

Description

Methods for function trafo in package distrMod; there are accessor (trafo) and replacement (trafo<-) versions.

Usage

trafo(object, param)
## S3 method for class 'Estimate,missing':
trafo(object,param)
## S3 method for class 'ParamFamParameter,missing':
trafo(object,param)
## S3 method for class 'ParamFamily,missing':
trafo(object,param)
## S3 method for class 'ParamFamily,ParamFamParameter':
trafo(object,param)
## S3 method for class 'Estimate,ParamFamParameter':
trafo(object,param)
trafo(object) <- value

Arguments

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 nam
...
additional argument(s) for methods.

Value

  • The return value depends on the signature.
  • signature Estimate,missing:a list of length two with components fct and mat (see below)
  • signature Estimate,ParamFamParameter:a list of length two with components fct and mat (see below)
  • signature ParamFamParameter,missing:a matrix (see below)
  • signature ParamFamily,missing:a matrix (see below)
  • signature ParamFamily,ParamFamParameter:a list of length two with components fct and mat (see below)

Details

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\colon \Theta' \to \tilde \Theta,\qquad \theta \mapsto \tau(\theta)$$ mapping main parameter $\theta'$ to some range $\tilde \Theta$. If slot value trafo is a function, besides $\tau(\theta)$, it will also return the corresponding derivative matrix $\frac{\partial}{\partial \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 $\frac{\partial}{\partial \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:
{it will return a list with entries fct, the function $\tau$, and mat, the matrix $\frac{\partial}{\partial \theta}\tau(\theta)$. function $\tau$ will then return the list list(fval, mat) mentioned above. } Estimate,ParamFamParameter:{as signature Estimate,missing.} ParamFamParameter,missing:{it will just return the corresponding matrix.} ParamFamily,missing:{is just wrapper to signature ParamFamParameter,missing.} ParamFamily,ParamFamParameter:{as signature Estimate,missing.}

Examples

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

Run the code above in your browser using DataLab