if (FALSE) {
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 for 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.
}
Run the code above in your browser using DataLab