Learn R Programming

moveHMM (version 1.0)

w2n: Scaling function: working to natural parameters

Description

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

Usage

w2n(wpar, bounds, parSize, nbStates, nbCovs, estAngleMean, stationary)

Arguments

wpar
Vector of state-dependent distributions unconstrained parameters.
bounds
Matrix with 2 columns and as many rows as there are elements in wpar. Each row contains the lower and upper bound for the correponding parameter.
parSize
Vector of two values: number of parameters of the step length distribution, number of parameters of the turning angle distribution.
nbStates
The number of states of the HMM.
nbCovs
The number of covariates.
estAngleMean
TRUE if the angle mean is estimated, FALSE otherwise.
stationary
FALSE if there are covariates. If TRUE, the initial distribution is considered equal to the stationary distribution. Default: FALSE.

Value

  • A list of:
  • stepParMatrix of natural parameters of the step length distribution
  • angleParMatrix of natural parameters of the turning angle distribution
  • betaMatrix of regression coefficients of the transition probabilities
  • deltaInitial distribution

Examples

Run this code
nbStates <- 3
nbCovs <- 2
par <- c(0.001,0.999,0.5,0.001,1500.3,7.1)
parSize <- c(1,1)
bounds <- matrix(c(0,1,0,1,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)
wpar <- n2w(par,bounds,beta,delta,nbStates,FALSE)
print(w2n(wpar,bounds,parSize,nbStates,nbCovs,estAngleMean=FALSE,stationary=FALSE))

Run the code above in your browser using DataLab