## 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
## -> without new trafo slot:
mtrafo <- 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 in the original problem
res0 <- MLEstimator(x = x, ParamFamily = NS)
## transformation
res <- trafoEst(mtrafo, res0)
## confidence interval
confint(res)
Run the code above in your browser using DataLab