Several parameters (notably the dispersion parameters: the variance of random effects and the residual variance parameter, if any) can be estimated either by iterative algorithms, or by generic optimization methods. The development of the
fitme function aims to provide full control of the selection of algorithms. For example, if two random effects are fitted, then
init=list(lambda=c(NA,NaN)) enforces generic optimization for the first variance and iterative algorithms for the second.
init=list(lambda=c(0.1,NaN)) has the same effect and additionnally provides control of the initial value for optimization (whereas
init.HLfit=list(lambda=c(NA,0.1)) will provide control of the initial value for iterations).
How to know which algorithm has been selected for each parameter?
fitme(., verbose=c(verbose=TRUE)) shows sucessive values of the variables estimated by optimization (See Examples; if no value appears, then all are estimated by iterative methods). The first lines of the summary of a fit object should tell which variances are estimated by the “outer” method.
corrHLfit, which uses inner optimization by default, can be forced to perform outer optimization. Its control is more limited, as
NaNs are not allowed. Instead, only numeric values as in
init=list(lambda=0.1) are allowed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
## Not run: air <- data.frame(passengers = as.numeric(AirPassengers), year_z = scale(rep(1949:1960, each = 12)), month = factor(rep(1:12, 12))) air$time <- 1:nrow(air) # Use verbose to find that lambda is estimated by optimization fitme(passengers ~ month * year_z + AR1(1|time), data = air, verbose=c(TRACE=TRUE)) # Use init to enforce iterative algorithm for lambda estimation: fitme(passengers ~ month * year_z + AR1(1|time), data = air, verbose=c(TRACE=TRUE), init=list(lambda=NaN)) # (but then it may be better to enforce it also fro phi: init=list(lambda=NaN, phi=NaN)) # # Use init to enforce generic optimization for lambda estimation, # and control initial value: fitme(passengers ~ month * year_z + AR1(1|time), data = air, verbose=c(TRACE=TRUE), init=list(lambda=0.1)) # See help("multinomial") for more examples of control by initial values. ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.