w2n {momentuHMM} | R Documentation |
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,
circularAngleMean,
consensus,
stationary,
fullDM,
DMind,
nbObs,
dist,
Bndind,
nc,
meanind,
covsDelta,
workBounds,
covsPi
)
Arguments
wpar |
Vector of working parameters. |
bounds |
Named list of 2-column matrices specifying bounds on the natural (i.e, real) scale of the probability distribution parameters for each data stream. |
parSize |
Named list indicating the number of natural parameters of the data stream probability distributions |
nbStates |
The number of states of the HMM. |
nbCovs |
The number of beta covariates. |
estAngleMean |
Named list indicating whether or not to estimate the angle mean for data streams with angular distributions ('vm' and 'wrpcauchy'). |
circularAngleMean |
Named list indicating whether to use circular-linear or circular-circular
regression on the mean of circular distributions ('vm' and 'wrpcauchy') for turning angles. See |
consensus |
Named list indicating whether to use the circular-circular regression consensus model |
stationary |
|
fullDM |
Named list containing the full (i.e. not shorthand) design matrix for each data stream. |
DMind |
Named list indicating whether |
nbObs |
Number of observations in the data. |
dist |
Named list indicating the probability distributions of the data streams. |
Bndind |
Named list indicating whether |
nc |
indicator for zeros in fullDM |
meanind |
index for circular-circular regression mean angles with at least one non-zero entry in fullDM |
covsDelta |
data frame containing the delta model covariates |
workBounds |
named list of 2-column matrices specifying bounds on the working scale of the probability distribution, transition probability, and initial distribution parameters |
covsPi |
data frame containing the pi model covariates |
Value
A list of:
... |
Matrices containing the natural parameters for each data stream (e.g., 'step', 'angle', etc.) |
beta |
Matrix of regression coefficients of the transition probabilities |
delta |
Initial distribution |
Examples
## Not run:
m<-example$m
nbStates <- 2
nbCovs <- 2
parSize <- list(step=2,angle=2)
par <- list(step=c(t(m$mle$step)),angle=c(t(m$mle$angle)))
bounds <- m$conditions$bounds
beta <- matrix(rnorm(6),ncol=2,nrow=3)
delta <- c(0.6,0.4)
#working parameters
wpar <- momentuHMM:::n2w(par,bounds,list(beta=beta),log(delta[-1]/delta[1]),nbStates,
m$conditions$estAngleMean,NULL,m$conditions$Bndind,
m$conditions$dist)
#natural parameter
p <- momentuHMM:::w2n(wpar,bounds,parSize,nbStates,nbCovs,m$conditions$estAngleMean,
m$conditions$circularAngleMean,lapply(m$conditions$dist,function(x) x=="vmConsensus"),
m$conditions$stationary,m$conditions$fullDM,
m$conditions$DMind,1,m$conditions$dist,m$conditions$Bndind,
matrix(1,nrow=length(unique(m$data$ID)),ncol=1),covsDelta=m$covsDelta,
workBounds=m$conditions$workBounds)
## End(Not run)