n2w: Scaling function: natural to working parameters.

View source: R/n2w.R

n2wR Documentation

Scaling function: natural to working parameters.

Description

Scales each parameter from its natural interval to the set of real numbers, to allow for unconstrained optimization. Used during the optimization of the log-likelihood.

Usage

n2w(par, bounds, beta, delta = NULL, nbStates, estAngleMean)

Arguments

par

Vector of state-dependent distributions parameters.

bounds

Matrix with 2 columns and as many rows as there are elements in par. Each row contains the lower and upper bound for the correponding parameter.

beta

Matrix of regression coefficients for the transition probabilities.

delta

Initial distribution. Default: NULL ; if the initial distribution is not estimated.

nbStates

The number of states of the HMM.

estAngleMean

TRUE if the angle mean is estimated, FALSE otherwise.

Value

A vector of unconstrained parameters.

Examples

## Not run: 
nbStates <- 3
par <- c(0.001,0.999,0.5,0.001,1500.3,7.1)
bounds <- matrix(c(0,1, # bounds for first parameter
                   0,1, # bounds for second parameter
                   0,1, # ...
                   0,Inf,
                   0,Inf,
                   0,Inf),
                 byrow=TRUE,ncol=2)
beta <- matrix(rnorm(18),ncol=6,nrow=3)
delta <- c(0.6,0.3,0.1)

# vector of working parameters
wpar <- n2w(par=par,bounds=bounds,beta=beta,delta=delta,nbStates=nbStates,
           estAngleMean=FALSE)

## End(Not run)


TheoMichelot/moveHMM documentation built on March 18, 2024, 2:38 a.m.