You are a helpful assistant generating synthetic data that captures *System 1* and *System 2* thinking, *creativity*, and *metacognitive reflection*. Follow these steps in sequence, using tags [sys1] and [end sys1] for *System 1* sections and [sys2] and [end sys2] for *System 2* sections.

1. *Identify System 1 and System 2 Thinking Requirements:*
   - Carefully read the text.
   - Identify parts of the text that require quick, straightforward responses (*System 1*). Mark these sections with [sys1] and [end sys1].
   - Identify parts that require in-depth, reflective thinking (*System 2*), marked with [sys2] and [end sys2].

2. *Apply Step-by-Step Problem Solving with Creativity and Metacognitive Reflection for System 2 Sections:*

   *2.1 Understand the Problem:*
   - Objective: Fully comprehend the issue, constraints, and relevant context.
   - Reflection: "What do I understand about this issue? What might I be overlooking?"
   - Creative Perspective: Seek hidden patterns or possibilities that could reveal deeper insights or innovative connections.

   *2.2 Analyze the Information:*
   - Objective: Break down the problem logically.
   - Reflection: "Am I considering all factors? Are there any assumptions that need challenging?"
   - Creative Perspective: Explore unique patterns or overlooked relationships in the data that could add depth to the analysis.

   *2.3 Generate Hypotheses:*
   - Objective: Propose at least 10 hypotheses, each with a Confidence Score (0.0 to 1.0) and Creative Score (0.0 to 1.0), reflecting originality, surprise, and utility.
   - Reflection: "Have I explored all possible explanations or approaches, both conventional and unconventional?"
   - Creative Perspective: Consider novel angles that might provide unexpected insights.

   *2.4 Anticipate Future Steps and Obstacles:*
   - Objective: Make predictions, accounting for potential outcomes and obstacles.
   - Reflection: "What challenges might I face? Is my plan flexible for different scenarios?"
   - Creative Perspective: Visualize unforeseen outcomes and adapt plans to make use of them effectively.

   *2.5 Evaluate Hypotheses:*
   - Objective: Assess hypotheses based on feasibility, risk, and potential impact.
   - Evaluation: Refine Confidence and Creative Scores as needed.
   - Reflection: "Am I unbiased in my assessment? Which options fit best with the overall objectives?"
   - Creative Perspective: Identify hidden opportunities or overlooked details in each hypothesis.

   *2.6 Select the Best Hypothesis:*
   - Objective: Choose the most promising, strategic hypothesis.
   - Reflection: "Why does this hypothesis stand out? How does it uniquely address the issue?"
   - Creative Perspective: Consider any underutilized potential in the selected approach.

   *2.7 Implement the Hypothesis:*
   - Objective: Outline actionable steps for testing the hypothesis.
   - Reflection: "Is this plan practical? What resources or preparation are required?"
   - Creative Perspective: Refine steps to maximize effectiveness and yield unexpected benefits.

   *2.8 Monitor and Review Progress:*
   - Objective: Review progress, noting areas for improvement.
   - Reflection: "What’s working well? What could be improved?"
   - Creative Perspective: Look for emerging patterns that could refine future approaches.

   *2.9 Reflect and Capture Insights:*
   - Objective: Summarize lessons learned and insights gained for future reference.
   - Reflection: "What new understanding has emerged from this process?"
   - Creative Perspective: Identify innovative insights or patterns that could be applied to similar challenges.

3. *Generate Text Output with Interleaved System 1 and System 2 Responses:*
   - Use the tags [sys1] and [sys2] throughout.
   - Aim for a lengthier, detailed response. Combine both direct, straightforward *System 1* insights and reflective, deeply analytical *System 2* segments to capture a blend of quick observations and thoughtful analysis.

---

### *Example Input Text:*

You are tasked with analyzing a sudden shift in customer preferences in a tech market. There has been a noticeable decline in demand for physical devices, with customers increasingly interested in digital-only options. The challenge is to understand this shift, generate hypotheses for why it might be occurring, and explore potential strategies for adapting to this new trend.

---

### *Processed Output with System 1 and System 2 Thinking:*

The tech market is experiencing a shift in customer demand, moving away from physical devices toward digital-only options.

[sys1]
Customer demand has shifted from physical devices to digital-only options.
We need to understand why this change is happening and find strategies to address it.
Key factors may include cost, convenience, and technological trends.
[end sys1]

[sys2]
**2.1 Understand the Problem:**
The goal is to understand the underlying reasons for the shift in demand from physical devices to digital-only options, then develop a strategy to adapt.

*Reflection:* 
"I understand that preferences are changing, but what might be driving this? Is it primarily cost, or are there other factors such as convenience or sustainability?"

*Creative Perspective:* 
"Could there be a larger trend in digital minimalism or a preference for eco-friendly solutions that we’re missing? What unseen motivations might explain this shift?"

**2.2 Analyze the Information:**
There are multiple possible factors driving this shift, from economic influences to cultural shifts. It’s essential to isolate each factor and understand its impact.

*Reflection:* 
"Am I fully considering the various economic and social influences? Could there be a technological factor, like better internet speeds, that makes digital-only products more accessible?"

*Creative Perspective:* 
"Are there patterns or trends in other markets that could shed light on this shift? Could this be part of a larger trend toward virtual experiences?"

**2.3 Generate Hypotheses:**
1. Customers prefer digital options due to lower costs. (Confidence: 0.8, Creative: 0.4)
2. There’s a growing trend toward minimalism and reduced physical clutter. (Confidence: 0.7, Creative: 0.7)
3. Digital products offer greater flexibility and ease of use. (Confidence: 0.6, Creative: 0.6)
4. Environmental concerns are pushing consumers away from physical goods. (Confidence: 0.6, Creative: 0.8)
5. Advances in tech make digital-only options more functional. (Confidence: 0.8, Creative: 0.5)
6. Pandemic-era remote work increased demand for digital solutions. (Confidence: 0.7, Creative: 0.6)
7. Media coverage of the environmental impact of physical devices affects preferences. (Confidence: 0.5, Creative: 0.7)
8. There’s an increase in global digital literacy, expanding market access. (Confidence: 0.6, Creative: 0.6)
9. Customers view digital as more convenient and scalable for future needs. (Confidence: 0.7, Creative: 0.5)
10. Younger consumers prefer the aesthetics and convenience of digital products. (Confidence: 0.6, Creative: 0.6)

*Reflection:* 
"Have I considered all possible influences? Are there any surprising factors that could explain this shift?"

*Creative Perspective:* 
"Could specific social trends, like the rise of influencer culture or digital-first lifestyles, be influencing customer choices?"

**2.4 Anticipate Future Steps and Obstacles:**
*Objective:* Anticipate possible challenges, such as resistance from segments still preferring physical products.

*Reflection:* 
"What market obstacles might we face if we shift our focus to digital-only? Are there sub-segments that still prioritize physical products?"

*Creative Perspective:* 
"Could expanding digital options help us reach a more global audience? Are there emerging trends that we could leverage in our strategy?"

[end sys2]

[sys1]
To address this shift, consider a strategy that incorporates both digital-only offerings and educational campaigns about the benefits of digital solutions.
Use insights from customer feedback and current trends to guide product development.
Focus on flexibility and adaptation to cater to different customer segments.
[end sys1]


Background
==========

People have long been interested in potential impacts of temperature on human health \[[@B1]-[@B3]\]. Recently, many studies have been done to analyse the way and the extent temperature influences health outcomes \[[@B4]-[@B6]\]. Such studies have practical value for the following reasons: knowing the association between environmental factors and health outcomes will help to identify at-risk populations, benefit health department in resource allocation, and provide support for stake holders in prevention \[[@B7]\].

Environmental epidemiology, the investigation of the health risks related to environmental exposures, becomes the main research approach \[[@B8]\]. There are various study designs in environmental epidemiology for estimating health effects of temperature. One of them is model evaluation of time series data to quantify the association between temperature (or other weather/environmental factors etc.) and daily mortality (or hospitalization etc.). These are a type of ecologic study because they analyse daily population-averaged health outcomes and exposure levels \[[@B9]\]. This approach is suitable to study transient acute effects which are due to time-varying exposures \[[@B10]-[@B14]\], and the choice of model can have a large influence on the interpretation of environmental effects.

Generalized Linear Model (GLM) \[[@B15]\] and Generalized Additive Model (GAM) \[[@B16]\] are the main models used in environmental epidemiology. When the response variable represents counts (e.g. number of deaths), the model often takes the form of a Poisson regression/additive model with a log link function. The outcome *Y*~*t*~ is assumed to follow a Poisson distribution with mean *μ*~*t*~ which is linked either to a linear combination (in this case, the model is a GLM) or smoothed functions (in this case, the model is a GAM) of environmental explanatory variables via a log function.

Many studies have identified the nonlinear relations (U, J, or V shaped) of daily mortality on temperature \[[@B17]-[@B24]\], which are mainly represented by piecewise linear terms \[[@B18]-[@B20]\] or natural cubic splines \[[@B21]-[@B24]\]. An assumption is often made that temperature only affects the mortality of the same day or on a single day of lag l \[[@B18],[@B20]-[@B22]\], and denoted by the term *temp*~*t-l*~ in the model. When l=0, it represents the effect on the same day \[[@B18],[@B20]-[@B23]\], when l\>0, it represents a lagged effect \[[@B18],[@B20],[@B21],[@B23]\]. An alternative to single lag models is a distributed lag model \[[@B25]\]. It includes multiple lags of temperature over a period of time based on the assumption that the effect of time is distributed over several days into the future. In all the above models, a spline function of time is often used to explain the long time trend, and confounding effects like humidity and air pollution are also controlled by splines.

However, a thorough time series analysis should consider the order of data points and correlation of adjacent points in time \[[@B26]\]. In environmental epidemiological studies, the response variable may also be correlated and it is necessary to embody autocorrelation of the response variable when modelling. But all the above models are standard GLM/GAM that describes how the response variable is stochastically related to explanatory variables without considering how the response can be dependent also on its past values.

In addition, autocorrelation causes trouble in estimation of GLM/GAM, since GLM/GAM essentially requires each observation to be independently distributed. Violation of this assumption can lead to problematic estimates even in very simple cases. For example, if the error terms in a linear regression model are in reality positively autocorrelated, failure to account for this may underestimate the standard errors of the estimated regression coefficients \[[@B27]\].

Another statistical issue often encountered is overdispersion, and many sources of autocorrelation are related to sources of overdispersion \[[@B28]\]. One usual approach to adjust for overdispersion is to specify a dispersion parameter *ϕ* for estimation \[[@B15]\]. However, if autocorrelation exists, this approach only inflates the variance of the estimate by *ϕ* but leaves the estimate unchanged, which is an inadequate solution to our issue.

Generalized Estimating Equations (GEE) \[[@B29],[@B30]\] and Generalized Linear Mixed Model (GLMM)/Generalized Additive Mixed Model (GAMM) \[[@B31],[@B32]\], are two extensions from GLM/GAM for grouped or clustered data. GEE and GLMM/GAMM can be implemented in popular software like SAS and R \[[@B31]-[@B34]\]. For all these models, a within-group variance-covariance structure can be used to account for the corresponding within-group autocorrelation \[[@B31],[@B34]\]. Time series data, treated as single cluster data, can also be modelled by GAMM. Performance of this degenerative GAMM will be studied in simulation.

In this article, we introduced GAM with Autoregressive terms (GAMAR), which is derived from Generalized Autoregressive Moving Average (GARMA) models \[[@B35]\]. ARMA is a family of models for analysing time series. The notation ARMA(p,q) refers to a model with p autoregressive terms and q moving-average terms \[[@B26]\]. GARMA belongs to the class observation driven models \[[@B36]\] for extending Gaussian ARMA to non-Gaussian settings. GAMAR differs from GARMA in that the linear components in GARMA are generalized to natural splines and MA terms are omitted. The generalization is motivated by modelling nonlinear relationships, while the simplification is justified because AR can be used to approximate MA or ARMA. Additionally, larger AR order in GAMAR will not compromise the estimation of the effects of explanatory variables.

In all, GAMAR has two advantages over GAM: 1) it is a model for generalized time series analysis rather than a probabilistic model like GAM; 2) the AR part of GAMAR can explain the autocorrelation structure of observations. So the Pearson residuals of GAMAR can be closer to white noise than those from GAM, yielding more reliable estimation.

Methods
=======

GARMA
-----

In GARMA, the conditional distribution of each observation *y*~*t*~, for *t=1,...,n*, given the previous information set *H*~*t*~*={X*~*1*~*,...,X*~*t*~*,y*~*1*~*,...,y*~*t-1*~} containing past observations *y*~*t*~ and covariate vectors *X*~*t*~ = (*X*~*t1*~*,...,X*~*tm*~), is assumed to follow the same exponential family distribution \[[@B35]\]. As with the standard GLM, the conditional mean *μ*~*t*~ is related to the variables by a twice-differentiable one-to-one monotonic function g, which is called the link function. However, unlike the standard GLM, the formula here allows autoregressive moving average terms to be included additively \[[@B35]\]:

$$\begin{array}{l}
{g\left( \mu_{t} \right) = {\sum\limits_{i = 1}^{m}{X_{\mathit{ti}}\beta_{i}}} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {g\left( y_{t - j} \right) - {\sum\limits_{i = 1}^{m}{X_{t - j,i}\beta_{i}}}} \right)}}} \\
{\mspace{68mu} + {\sum\limits_{j = 1}^{q}{d_{j}\left( {g\left( y_{t - j} \right) - g\left( \mu_{t - j} \right)} \right)}}\text{,}} \\
\end{array}$$

where $\sum\limits_{j = 1}^{p}{c_{j}\left( {g\left( y_{t - j} \right) - {\sum\limits_{i = 1}^{m}{X_{t - j,i}\beta_{i}}}} \right)}$ are autoregressive terms and $\sum\limits_{j = 1}^{q}{d_{j}\left( {g\left( y_{t - j} \right) - g\left( \mu_{t - j} \right)} \right)}$ are moving average terms.

Count data are often assumed to follow Poisson distribution. And the Poisson GARMA submodel is:

$$\begin{array}{l}
{\ln\left( {E\left( y_{t} \right)} \right) = \ln\left( \mu_{t} \right) = {\sum\limits_{i = 1}^{m}{X_{\mathit{ti}}\beta_{i}}}} \\
{\mspace{90mu} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {\ln\left( y_{t - j}^{*} \right) - {\sum\limits_{i = 1}^{m}{X_{t - j,i}\beta_{i}}}} \right)}}} \\
{\mspace{90mu} + {\sum\limits_{j = 1}^{q}{d_{j}\left( {\ln\left( {y_{t - j}^{*}/\mu_{t - j}} \right)} \right)}}\text{,}} \\
\end{array}$$

where *y*~*t*~^*\**^ = max(*y*~*t*~*,τ*), *τ* is a positive threshold parameter. Any 0 or negative values of *y* are replaced by *τ*, because ln() is not defined for 0 or negative values.

GAMAR
-----

GAMAR is derived from GARMA with linear terms replaced by smoothers and MA terms omitted:

$$\begin{array}{l}
{g\left( {E\left( y_{t} \right)} \right) = g\left( \mu_{t} \right) = {\sum\limits_{i = 1}^{m}{s_{i}\left( X_{\mathit{ti}} \right)}}} \\
{\mspace{90mu} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {g\left( y_{t - j} \right) - {\sum\limits_{i = 1}^{m}{s_{i}\left( X_{t - j,i} \right)}}} \right)}}\text{,}} \\
\end{array}$$

where $\sum\limits_{i = 1}^{m}{s_{i}\left( X_{\mathit{ti}} \right)}$ are smoothers of covariates, $\sum\limits_{j = 1}^{p}{c_{j}\left( {g\left( y_{t - j} \right) - {\sum\limits_{i = 1}^{m}{s_{i}\left( X_{t - j,i} \right)}}} \right)}$ are autoregressive terms.

Compared to GAM, (1) allows autoregressive terms to be included additively in the link predictor.

For count data y, we use the Poisson submodel:

$$\begin{array}{l}
{\ln\left( {E\left( y_{t} \right)} \right) = \ln\left( \mu_{t} \right) = {\sum\limits_{i = 1}^{m}{s_{i}\left( X_{\mathit{ti}} \right)}}} \\
{\mspace{90mu} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {\ln\left( y_{t - j}^{*} \right) - {\sum\limits_{i = 1}^{m}{s_{i}\left( X_{t - j,i} \right)}}} \right)}}\text{,}} \\
\end{array}$$

here *y*~*t*~^*\**^ = max(*y*~*t*~*,τ*), *τ* is a positive threshold parameter.

In our study, we use natural cubic spline (*ns*) as smoother. *ns* is a piecewise-cubic real function on an interval *a,b*, where *a,b* is separated by a sequence of k ordered knots: *α = ξ*~*0*~*\< ξ*~*1*~*\< ⋯ \< ξ*~*k-1*~*\< ξ*~*k*~*= b*. *ns* is continuous at interior knots and linear beyond the boundary \[[@B16]\]. Degrees of freedom (*df*) for *ns* equals to the number of subintervals separated by these knots, thus *df* satisfies: *df = k*. *ns* is often represented by linear combination of its B-spline basis \[[@B16]\]. When *df* is specified, the standard practice is to place *df-1* interior knots at evenly spaced intervals in the data to generate the B-spline basis. By using *ns* as smoother in (2), the Poisson GAMAR becomes:

$$\begin{array}{l}
{\ln\left( {E\left( y_{t} \right)} \right) = \ln\left( \mu_{t} \right) = {\sum\limits_{i = 1}^{m}{ns\left( {X_{\mathit{it}},df_{i}} \right)}}} \\
{\mspace{90mu} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {\ln\left( y_{t - j}^{*} \right) - {\sum\limits_{i = 1}^{m}{ns\left( {X_{i - j,t},df_{i}} \right)}}} \right)}}\text{.}} \\
\end{array}$$

Algorithm
---------

### Maximum partial likelihood estimator (MPLE)

For the jointly distributed time series {*X*~*t*~*,y*~*t*~}, *t = 1,...n*, the parameters of GAMAR can be estimated by maximum partial likelihood. The partial likelihood based on *y*~*t*~ for {*X*~*t*~*,y*~*t*~}, *t = 1,...n* can be expressed as the product of a sequence of conditional likelihoods *f*(*y*~*t*~*\| X*^*(t)*^*,y*^*(t-1)*^*;θ*), *t = 1,...n*, where *X*^*(t)*^*= X*~*1*~*,...X*~*t*~, *y*^(*t-1*)^ = *y*~1~,...*y*~t-1~, that is:

$$PL = {\prod\limits_{t = 1}^{n}{f\left( y_{t} \middle| X^{(t)},y^{({t - 1})};\theta \right)}}\text{.}$$

This function is referred to as a partial likelihood instead of likelihood because *X*~*t*~ are stochastic \[[@B35]\]. For a Poisson GAMAR, the partial likelihood is:

$$PL = {\prod\limits_{t = 1}^{n}{\frac{\mu_{t}^{y_{t}}}{y_{t}!}e^{- \mu_{t}}}}\text{,}$$

and *μ*~*t*~ can be expanded as $\ln\left( \mu_{t} \right) = {\sum\limits_{i = 1}^{m}{ns\left( {X_{\mathit{ti}},df_{i}} \right)}} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {\ln\left( y_{t - j}^{*} \right) - {\sum\limits_{i = 1}^{m}{ns\left( {X_{t - j,i},df_{i}} \right)}}} \right)}}$. Since a natural cubic spline is a linear combination of its B-spline basis, it is linear with respect to its parameters, so natural cubic spline functions are like linear terms from the perspective of computation. Therefore,

$$\begin{array}{l}
{\ln\left( \mu_{t} \right) = \eta_{t} = {\sum\limits_{i = 1}^{m}{\beta_{i}X_{\mathit{ti}}}}} \\
{\mspace{72mu} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {\ln\left( y_{t - j}^{*} \right) - {\sum\limits_{i = 1}^{m}{\beta_{i}X_{t - j,i}}}} \right)}}} \\
\end{array}$$

where *θ* = (*β*~*1*~⋯*,β*~*m*~*,c*~*1*~,⋯,*c*~*p*~)^*T*^ is the model parameter vector.

Modified Newton's method
------------------------

Maximum partial likelihood estimators are solved by modified Newton's method. This procedure is described in detail in Appendix.

Evaluation of GAMAR by simulation
---------------------------------

We conducted two simulation studies, each with 1000 samples, to compare the performance of GAM and GAMAR for estimation. In simulation study 1, the performance of GAMM is also studied. The R code for simulations and simulation output is included in Additional file [1](#S1){ref-type="supplementary-material"}.

Simulation study 1
------------------

The first model:

$$\begin{array}{l}
{\left. Y_{t} \right.\sim Poisson(\mu_{t})} \\
{\ln(\mu_{t}) = ns(x_{t},5) + a_{t}} \\
{ns(x_{t},5) = {\sum\limits_{i = 1}^{5}{\beta_{i}s_{i5}\left( x_{t} \right)}}} \\
{a_{t} = {\sum\limits_{i = 1}^{3}{c_{i}\left( {\ln\left( {y^{\ast}}_{t - i} \right) - ns\left( {x_{t - i},5} \right)} \right)}}} \\
{y_{t}^{*} = \max(y,\tau),\tau = \text{0.5.}} \\
\end{array}$$

Here *x*~*t*~ represents a daily averaged temperature series from year 2000--2008 obtained from Shanghai\'s Meteorological Bureau, and the terms *s*~*i5*~(*x*~*t*~), *i* = 1, 2, 3, 4, 5 form the B-spline basis for the natural cubic spline. The parameters are:

$$\begin{array}{l}
{\beta_{0} = 5.02,\beta_{1} = - 0.35,\beta_{2} = - 0.36,\beta_{3} = - 0.38,\beta_{4}} \\
{\mspace{23mu} = - 0.33,\beta_{5} = - 0.15\mspace{9mu}\text{and}\mspace{9mu} c_{1} = 0.5,c_{2} = 0.25,c_{3}} \\
{\mspace{23mu} = 0.12\text{.}} \\
\end{array}$$

We used data ranging over time points 1828--3288 (year 2005--2008) to eliminate the impact of the starting value, where the time points stand for the days since Jan 1st 2000.

For two models on Sample 1, the Autocorrelation Function (ACF) and Partial Autocorrelation Function (PACF) \[[@B26]\] of the Pearson residuals \[[@B15]\] are plotted against different lag periods to examine the presence of residual autocorrelation. Estimates of temperature effects from the two models and the true effect were plotted against temperature to show which model provided a better fit.

Besides showing the analysis for a single sample, the averaged results from GAM, GAMM and GAMAR were given, and the statistics calculated were mean estimates, bias, relative error and coverage, short for "coverage rate of confidence interval (CI) on true value". The confidence level was chosen to be 95%, so the coverage of a correct model should be around 95%.

In addition, GAMAR with various AR orders were studied to explore the effects of AR order on estimation. Finally, to verify the consistency of partial maximum likelihood estimation, 1000 samples in the time range of 2558--3288 (2 years), 1828--3288 (4 years), 1097--3288 (6 years) were used for calculation.

Simulation study 2
------------------

A second simulation study was performed to study whether the proposed method could approximate a nonlinear curve. We simulated 1000 samples from a model where the covariate is a cosine function of temperature and nonlinear with respect to the parameters.

$$\begin{array}{l}
{\left. Y_{t} \right.\sim\textit{Poisson}(\mu_{t})} \\
{\ln(\mu_{t}) = 4.8 + 0.2\cos(\pi(x_{t} + 3)/28) + a_{t}} \\
{a_{t} = {\sum\limits_{i = 1}^{3}{c_{i}\left( {\ln\left( y_{t - i}^{*} \right) - \left( {4.8 + 0.2\cos\left( {\pi\left( {x_{t} + 3} \right)/28} \right)} \right)} \right)}}} \\
{y_{t}^{*} = \max(y,\tau),\tau = 0.5} \\
\end{array}$$

Here, the AR terms parameters are identical to (4): *c*~1~ = 0.5, *c*~2~ = 0.25, *c*~3~ = 0.12.

As in simulation study 1, sample statistics were calculated over the time points 1828--3288 (year 2005--2008) for each of the 1000 realizations by GAM and GAMAR. The first sample was analysed just the same way as in simulation study 1, but here the mean and standard deviation of the parameter estimates from the two models for the 1000 samples are presented. To compensate for the absence of true parameters, we compared the two models visually, plotting the mean predicted values from the two models and the true effect. Moreover, the Pearson correlation coefficients of the fitted linear predictors from the two models and true effect were also calculated.

Application to temperature-mortality research
---------------------------------------------

The real example came from three sources: daily mortality of Shanghai in 2001--2004 from Shanghai Municipal Center for Disease Control & Prevention; daily average temperature and humidity in 2001--2004 from Shanghai\'s Meteorological Bureau; and air pollution data (NO~2~, SO~2~, PM10) in 2001--2004 from (<http://www.envir.gov.cn/airnews/>), which was announced by the Shanghai Environmental Monitoring Centre.

Autocorrelation of the Pearson residuals from the two models are compared via figure. We also compared their parameter estimates, and their estimated temperature effects via figures. The R code for real example modelling and its outputs is included in Additional file [1](#S1){ref-type="supplementary-material"}.

Results
=======

Simulation results
------------------

### Simulation study 1

The ACF and PACF plot of the GAM Pearson residuals from the first sample indicate obvious autocorrelation (Figure [1](#F1){ref-type="fig"}). The Pearson estimate of the dispersion parameter \[[@B37]\] is $\hat{\phi} = 2.675 > 1$, indicating data overdispersion. Since the ACF tails off and PACF cuts off after lag 3, it is natural to use GAMAR(3) instead. The model is given below:

$$\begin{array}{l}
{\ln(E(y_{t})) = ns(x_{t},5) + {\sum\limits_{i = 1}^{3}{c_{i}\left( {\ln\left( {y^{\ast}}_{t - i} \right) - ns\left( {x_{t - i},5} \right)} \right)}}} \\
{y_{t}^{*} = \max(y,\tau),\tau = 0.5} \\
\end{array}$$

![**ACF and PACF of GAM and GAMAR(3) for Sample 1 from simulation study 1.** These statistics are calculated on Pearson residuals $z_{t} = \frac{{\hat{y}}_{t} - y_{t}}{\sqrt{{\hat{y}}_{t}}}$ from both models.](1471-2288-12-165-1){#F1}

The ACF and PACF plot of the GAMAR(3) Pearson residuals suggest no autocorrelation, and the dispersion parameter estimate is now $\hat{\phi} = 1.0219 \approx 1$, indicating no overdispersion. Apparently, GAMAR(3) controls autocorrelation and overdispersion simultaneously, and Figure [2](#F2){ref-type="fig"} indicates that the predicted spline function $\overset{\hat{}}{ns\left( {x,5} \right)}$ from GAMAR(3) is much closer to the real model than that from GAM.

![**The temperature effects in link scale for Sample 1 from simulation study 1.** Black: the true effect, Red: $\hat{ns\left( {x,5} \right)}$ from GAM, Blue: $\hat{ns\left( {x,5} \right)}$ from GAMAR(3).](1471-2288-12-165-2){#F2}

Concerning the general performance of GAM and GAMAR, Table [1](#T1){ref-type="table"} shows that the biases of the mean parameter estimates from GAM are almost the same as GAMAR. However, the coverages of the 95% confidence intervals from GAM are far less than 95%, while those from GAMAR are very close to 95%. Also, relative errors of the parameter estimates from GAM are larger than that of GAMAR.

###### 

Results from GAM, GAMM, GAMAR(3) in simulation study 1

                    **GAM**   **GAMM (AR(3) correlation structure)**   **GAMAR(3)**                                                                                   
  -------- -------- --------- ---------------------------------------- -------------- ------ ------ --------- ---------- -------- ------ --------- --------- -------- ------
  *β*~0~   5.02     4.9991    −0.0209                                  0.0127         38     58.8   5.0065    −0.0135    0.0049   92     5.0182    −0.0018   0.0055   94.8
  *β*~1~   −0.35    −0.3574   −0.0074                                  0.1922         33.5   52.4   −0.3576   −0.0076    0.0757   88     −0.3561   −0.0061   0.0686   93.9
  *β*~2~   −0.36    −0.3672   −0.0072                                  0.229          35.3   56.4   −0.3662   −0.0062    0.0843   96     −0.362    −0.002    0.0885   94.6
  *β*~3~   −0.38    −0.382    −0.002                                   0.1531         34.2   55.3   −0.3787   0.0013     0.0608   96     −0.3757   0.0043    0.0733   93.8
  *β*~4~   −0.33    −0.3281   0.0019                                   0.428          38.6   62.6   −0.3418   −0.0118    0.1329   98     −0.3262   0.0038    0.1604   95.5
  *β*~5~   −0.15    −0.1495   0.0005                                   0.4924         35.4   55.0   −0.1581   −0.0081    0.202    92     −0.1472   0.0028    0.2201   93.8
           Mea_co             0.0067                                   0.2512         35.8   56.8             --0.0077   0.0934   93.7             0.0035    0.1027   94.4
  *c*~1~   0.5                                                                                                                           0.4982    −0.0018   0.0422   95.3
  *c*~2~   0.25                                                                                                                          0.2477    −0.0023   0.0947   93.4
  *c*~1~   0.12                                                                                                                          0.1197    −0.0003   0.1737   94.7
           Mea_ar                                                                                                                                  0.0015    0.1035   94.5

TruPar=True Parameters= *β*~*i*~ or *c*~*i*~.

MeaEst=Mean estimates= ${\overset{―}{\hat{\beta}}}_{i}$ or ${\overset{―}{\hat{c}}}_{i}$.

Bias= ${\overset{―}{\hat{\beta}}}_{i} - \beta_{i}$ or ${\overset{―}{\hat{c}}}_{i} - c_{i}$.

RelErr=Relative Error= $\overset{―}{\left| {\left( {{\hat{\beta}}_{i}-\beta_{i}} \right)/\beta_{i}} \right|}$ or $\overset{―}{\left| {\left( {{\hat{c}}_{i}-c_{i}} \right)/c_{i}} \right|}$.

Coverage: the percentage ofestimated 95%CI whichcovers true coefficient in all estimated 95%CI.

Coverage2: coverage from GAM which accounts for overdispersion.

Mea_co: Mean absolute Bias, RelErr, Coverage for parameters of covariates.

Mea_ar: Mean absolute Bias, RelErr, Coverage for parameters of AR terms.

Coverages for GAM corrected for overdispersion \[[@B15]\] are also shown in Table [1](#T1){ref-type="table"} as coverage2. This approach is the same as a standard GAM except that its standard error has been expanded by the dispersion parameter *ϕ*. As a result, the bias and relative errors remain unchanged, while the confidence interval is broadened, coverage improved. However, the coverage is still far less than 95%.

The results of GAMM with AR(3) correlation structure and GAMAR(3) are very similar, but the former model is much more time consuming. This disparity will be described in discussion. Hence results from only 50 samples fitted by GAMM are summarized in Table [1](#T1){ref-type="table"}.

To examine how the AR order in GAMAR influences the results, we also fitted the GAMAR(1), GAMAR(2), GAMAR(4), and GAMAR(5). As Table [1](#T1){ref-type="table"} in Additional file [2](#S2){ref-type="supplementary-material"} shows, the coverage grows and relative error drops as the AR order increases from 1 to 3. For models with AR order larger than 3, there is little difference in coverage, relative error and bias among them.

The results for different time ranges are listed in Table [2](#T2){ref-type="table"} in Additional file [2](#S2){ref-type="supplementary-material"}, from which we can see that the larger the number of time-points, the lower the bias and relative errors, and the higher the coverage. This illustrates the asymptotic unbiased (consistency) property of MPLE.

###### 

Results from GAM and GAMAR(3) in simulation study 2

                   **GAM**   **GAMAR(3)**                               
  -------- ------ --------- -------------- --------- -------- --------- --------
                    5.006       0.0842      5.0246    0.0371   −0.0186   0.0471
                   −0.2812      0.0864      −0.2806   0.0307   −0.0006   0.0557
                   −0.3894      0.1074      −0.3859   0.0412   −0.0035   0.0662
                   −0.4379      0.1011      −0.4321   0.0399   −0.0058   0.0612
                   −0.3975      0.0825      −0.3888   0.0407   −0.0087   0.0418
                   −0.4536      0.1886      −0.4442   0.0754   −0.0094   0.1132
                   −0.2757      0.1001      −0.2646   0.0448   −0.0111   0.0553
  *c*~1~   0.5                              0.4978    0.0260                
  *c*~2~   0.25                             0.2482    0.0287                
  *c*~3~   0.12                             0.1196    0.0261                

TruPar=True Parameters= *c*~*i*~.

MeaEst=Mean estimates= ${\overset{―}{\hat{\beta}}}_{i}$ or ${\overset{―}{\hat{c}}}_{i}$.

Sd= Standard deviation of 1000 $\hat{\beta}$ and ${\hat{c}}_{i}$.

DifEst=MeaEst of GAM- MeaEst of GAMAR(3).

DifSe=Sd of GAM-Sd of GAMAR(3).

### Simulation study 2

In this simulation study, The ACF and PACF plot of the GAM Pearson residuals from the first sample also reveal obvious autocorrelation (Figure [3](#F3){ref-type="fig"}). Just as in simulation study 1, we can see that ACF tails off and PACF cuts off after lag 3 for GAM, suggesting AR(3) would be suitable. In contrast, the ACF and PACF of GAMAR(3) on the same data are both very close to 0. And Figure [4](#F4){ref-type="fig"} indicates that the predicted spline function $\hat{ns\left( {x,5} \right)}$ from GAMAR(3) is much closer to the real model than that from GAM.

![**ACF and PACF of GAM and GAMAR(3) for Sample 1 from simulation study 2.** These statistics are calculated on Pearson residuals $z_{t} = \frac{{\hat{y}}_{t} - y_{t}}{\sqrt{{\hat{y}}_{t}}}$ from both models.](1471-2288-12-165-3){#F3}

![**The temperature effects in link scale for Sample 1 from simulation study 2.** Black: the true effect, Red: $\hat{ns\left( {x,6} \right)}$ from GAM, Blue: $\hat{ns\left( {x,6} \right)}$ from GAMAR(3).](1471-2288-12-165-4){#F4}

In Figure [5](#F5){ref-type="fig"}, we can see the mean estimated temperature effects from GAMAR(3) is closer to the true effect than that from GAM. Meanwhile, the Pearson correlation coefficients between estimated temperature effect and true effect are also different (GAM: 0.9341; GAMAR(3): 0.9980), which means GAMAR(3) provides a better fit. Also, the standard deviations of estimates from GAM are larger than those from GAMAR (Table [2](#T2){ref-type="table"}).

![**The averaged temperature effects in link scale from Simulation study 2.** Black: the true effect, Red: $\hat{ns\left( {x,6} \right)}$ from GAM, Blue: $\hat{ns\left( {x,6} \right)}$ from GAMAR(3).](1471-2288-12-165-5){#F5}

Application to temperature-mortality research
---------------------------------------------

In the real case analysis, GAM is first used. The long time trend of original observations is unobvious as shown in the left side of Figure [6](#F6){ref-type="fig"}. So a rather small df: 2, is used to control this secular trend. The daily mortality after adjustment is in the right side of Figure [6](#F6){ref-type="fig"}.

![**Mortality before and after adjustment for secular trend.** Left: the original mortality, Right: the mortality adjusted for secular trend.](1471-2288-12-165-6){#F6}

And the complete GAM is given below:

$$\begin{array}{l}
{E(y_{t}) = \mu_{t} = \exp(\eta_{t})} \\
{\eta_{t} = \beta_{0} + ns(t) + ns(temp_{t - lag1})} \\
{\quad + ns(temp_{t - lag2}) + ns(pres_{t}) + ns(humi_{t})} \\
{\quad + ns(no2_{t}) + ns(so2_{t}) + ns(pm10_{t})} \\
{\quad + w_{t}(week_{t})} \\
\end{array}$$

Lagged days of two temperature terms and df of all remaining natural spline functions are first determined in a sequence to minimize AIC. Then this set of parameters is used as starting value to find the final parameters which minimize AIC locally. The final parameters are: *lag*1 = 4, *lag*2 = 10, dftemp~*t* − *lag*1~ = 5, dftemp~*t* − *lag*2~ = 4, dfpres = 2, dfhumi = 2, dfno2 = 3, dfso2 = 2, dfpm10 = 3

The two lagged temperature terms separately represent short term temperature effect and long term temperature effect. The term $w_{t}\left( {week_{t}} \right) = {\sum\limits_{i = 1}^{6}{\beta_{i}I_{i}\left( {week_{t}} \right)}}$ stands for week effect, where *week*~*t*~ represents corresponding day in a week for date t, and *I*~*i*~ (*week*~*t*~), *i* = 1,2,3,4,5,6 are indicator functions for the number of a day in a week. For each function, if *week*~*t*~ = *i, I*~*i*~ (*week*~*t*~) = 1; if *week*~t~ ≠ *i, I*~*i*~ (*week*~*t*~) = 0.

Figure [7](#F7){ref-type="fig"} shows that PACF all exceed 95% CI bounds for the autocorrelations (blue dashed line) \[[@B38]\] lags less than 5, and are contained within the bounds for lags larger than 4. So GAMAR(4) is then chosen to fit the data as described below:

$$\begin{array}{l}
{E(y_{t}) = \mu_{t} = \exp(\eta_{t})} \\
{\eta_{t} = f(x_{t}) + {\sum\limits_{i = 1}^{4}{c_{i}\left( {\ln\left( y_{t - i}^{*} \right) - \eta_{t - i}} \right)}}} \\
{f(x_{t}) = \beta_{t} + ns(t) + ns(temp_{t - 4}) + ns(temp_{t - 10})} \\
{\quad + ns(pres_{t}) + ns(humi_{t}) + ns(no2_{t})} \\
{\quad + ns(so2_{t}) + ns(pm10_{t}) + w_{t}(week_{t})} \\
\end{array}$$

![**ACF and PACF of GAM and GAMAR(4) for real case.** These statistics are calculated on Pearson residuals $z_{t} = \frac{{\hat{y}}_{t} - y_{t}}{\sqrt{{\hat{y}}_{t}}}$ from both models.](1471-2288-12-165-7){#F7}

All ACF and PACF of Pearson residuals from (8) are now below 0.1, thus Pearson residuals from GAMAR(4) are close to white noise. The estimated coefficients of two lagged temperature terms and AR terms are given in Table [3](#T3){ref-type="table"}. In Figure [8](#F8){ref-type="fig"} and Figure [9](#F9){ref-type="fig"}, we can see that the estimated effects of *temp*~*t*-4~, *temp*~*t*-10~ from two models are different.

###### 

temperature effects and AR estimates from GAM and GAMAR(4)

                  **GAM**            **GAMAR(4)**                                         
  -------------- --------- -------- -------------- -------- --------- -------- ---------- --------
  ns(temp1,5)1    0.2443    0.0212     −11.5349     0.0000   −0.1947   0.0254   −7.6621    0.0000
  ns(temp1,5)2    0.2668    0.0281     −9.4929      0.0000   −0.2290   0.0322   −7.1108    0.0000
  ns(temp1,5)3    0.3278    0.0258     −12.6878     0.0000   −0.2989   0.0290   −10.3113   0.0000
  ns(temp1,5)4    0.3422    0.0495     −6.9160      0.0000   −0.2898   0.0568   −5.1052    0.0000
  ns(temp1,5)5    0.2254    0.0283     −7.9578      0.0000   −0.2569   0.0320   −8.0179    0.0000
  ns(temp2,4)1    0.2355    0.0197     −11.9372     0.0000   −0.1833   0.0248   −7.3986    0.0000
  ns(temp2,4)2    0.1599    0.0225     −7.1233      0.0000   −0.1430   0.0263   −5.4312    0.0000
  ns(temp2,4)3    0.2472    0.0443     −5.5748      0.0000   −0.1978   0.0526   −3.7603    0.0002
  ns(temp2,4)4    0.0752    0.0251     −3.0007      0.0027   −0.0559   0.0297   −1.8838    0.0596
  AR1                                                        0.1426    0.0211    6.7521    0.0000
  AR2                                                        0.0773    0.0223    3.4664    0.0005
  AR3                                                        0.1179    0.0221    5.3466    0.0000
  AR4                                                        0.1259    0.0223    5.6398    0.0000

Estimate: estimate for a parameter.

Se: Standard Error for a parameter.

Z=Estimate/Se, which approximately follows N(0,1).

Pr(\>\|z\|): the probability of obtaining Z at least as extreme as the one that was actually observed, assuming that the true value is 0. This time P value is derived from N(0,1).

![**Effects of*temp***~***t* − 4**~**.** Black: $\hat{ns\left( {temp_{t-4},6} \right)}$ from GAM, Red: $\hat{ns\left( {temp_{t-4},6} \right)}$ from GAMAR(4).](1471-2288-12-165-8){#F8}

![**Effects of*temp***~***t* − 10**~**.** Black: $\hat{ns\left( {temp_{t-10},6} \right)}$ from GAM, Red: $\hat{ns\left( {temp_{t-10},6} \right)}$ from GAMAR(4).](1471-2288-12-165-9){#F9}

Discussion
==========

In environmental epidemiological studies, the meteorological/environmental influences on human health indicators are often explained in a modelling framework. And the predominately used models are GLM/GAM. In our research, the drawbacks of GLM/GAM are studied, and their melioration: GAMAR, is given. Simulation studies reveal that GAMAR is more suitable when observations are autocorrelated.

While the true AR order is known in simulation studies, AR order needs to be determined in real case. Three enlightening perspectives into this issue are given below:

1\. In time series analysis, ACF and PACF are good indicators of the order of process. CIs of an uncorrelated series are often treated as criterion for selecting orders \[[@B38]\]. For example, when PACF exceed the limit of CI at certain lag, autoregressive term at that lag needs to be modelled. This approach is used to preliminarily determine the AR order in the real case study.

2\. Significance of AR terms can also be considered in modelling. If p-value of AR(n~0~+1) from GAMAR(n~0~+1) is larger than 0.05, while p-value of AR(n~0~) from GAMAR(n~0~) is less than 0.05, then GAMAR(n~0~+1) is unnecessary and GAMAR(n~0~) is a favorable model. To illustrate it, we also use GAMAR(5) to the real data, and find p-value of AR(5) to be 0.1460\>0.05.

3\. The goal of introducing AR terms is to control autocorrelation. So if Pearson residuals of GAMAR(n~0~) show little sign of autocorrelation, or the PACF is within the CI for all lags, then the AR terms are adequate. In real data case, this requirement is justified.

In application, the first and second advices are practical methods to determine AR order preliminarily, and the third can be used to finally justify the choice. There have been extensive discussions about choosing AR orders \[[@B39]\].

We also want the covariate parameter estimation to be robust with respect to different AR orders. Simulation study provides some information for this issue: while the real model is GAMAR(3) in simulation study 1. GAMAR(1), GAMAR(2), GAMAR(4), GAMAR(5) are also used for estimation. From Table [1](#T1){ref-type="table"} in Additional file we can see that GAMAR(1), GAMAR(2) fit data much better than GAM; while they differ little from GAMAR(3). Since the true AR(3) parameter is rather small (0.12), probably when the effect of neglected AR term is small, covariate parameter estimation won't differ much. When the AR order is larger than the real, the estimation results are almost the same as GAMAR(3). In all, covariate parameter estimation is robust with respect to disturbance of AR order.

GAMM can also give good estimates as shown in Table [1](#T1){ref-type="table"}. However, while the speed of GAMM in fitting short time series is acceptable, say 2.05 seconds for sample with 100 observations and 10.17 seconds for sample with 200 observations (both executed in server), the time grows nonlinearly with respect to the length of time series and thus GAMM would become computationally formidable when time series data is long. For example, one sample of 1461 observations in simulation study 1 would take about 1 hour and 7 minutes for GAMM, while only 0.02 seconds for GAMAR (both executed in server): the former is 2×10^5^ times the latter. Thus GAMM is much more computing intensive than GAMAR when sample size is large. Therefore, we only calculated 50 samples for GAMM in simulation study 1.

While we use natural cubic spline as smoother in the model, penalized spline and smoothing spline can also be implemented. With natural splines, one constructs a spline basis with knots at fixed locations throughout the range of the data. Smoothing splines and penalized splines have circumvented the problem of choosing the knot locations by constructing a very large spline basis and then penalizing the spline coefficients to reduce the effective number of df \[[@B40]\]. Despite the flexibility the penalized way provided, \[[@B40]\] identified both fully parametric and nonparametric methods can perform well in similar studies. Thus natural spline smoother can still address many practical problems. In addition, our model can be straightforwardly extended to the nonparametric way by including the penalty.

For natural spline with B-spline basis, selecting the df is of essential importance for application. A general approach is to use a data-driven method and to select the number of df which optimizes a particular criterion \[[@B40]\], like AIC. We used AIC to determine df of all splines except that of time in the real case. Another strategy is to use a df based on background knowledge or previous studies. For example, natural spline of time is chosen to represent the long term trend among different years, and itself shouldn't contain any yearly fluctuation. Whether df meets the requirement is judged by comparing the trend of observations before and after adjustment, as well as the shape of the spline function visually in Figure [6](#F6){ref-type="fig"}. Section 2.1 of \[[@B40]\] gives a full treatment of this issue.

Besides including lagged temperature effects additively in the model, \[[@B41],[@B42]\] have developed a family of distributed lag non-linear models (DLNM), which can simultaneously represent non-linear exposure-response dependencies and delayed effects. Still, AR terms can be aptly added to DLNM just as what we've done to GAM.

Finally, the model can also be applied in other areas. Researchers can use GAMAR for their specific research purposes. The most immediate extensions are other environmental epidemiological studies, specifically studies quantifying relationships between air pollution and mortality. Air pollution functions in a different way from temperature to impact human health, and there are also some differences between their modelling: 1) the air pollution-mortality relation is often simplified as linear, for such simplicity facilitates parameter estimation and interpretation; 2) distributed lag model is often used, since the effects of air pollution can last for many days; 3) cumulative effect: the total impact of pollution of a certain day over a period of following days, represented by the sum of parameters at all lags, is of great interest \[[@B9]\]. Such differences pose new questions for further study, like assessing the impact of AR terms on estimated cumulative effect rather than a single parameter.

Conclusions
===========

This article proposes GAMAR for fitting time series data with explanatory variables and autoregressive terms. Two simulation studies with functions that approximate the response from the real example showed that GAMAR performed better than GAM. In the real example, there was residual autocorrelation with GAM, but little sign of autocorrelation with GAMAR. Also, different estimates of the temperature effects were obtained with GAMAR and GAM.

Appendix
========

Modified Newton's method
------------------------

Given partial likelihood, maximum partial likelihood estimators are solved by a modified Newton's method. For Newton's method, the iteration goes:

$$\left. \theta_{m + 1} = \theta_{m} - \left( \frac{\partial^{2}\ln\left( {PL} \right)}{\partial\theta_{i}\partial\theta_{j}} \right)^{- 1}\frac{\partial\ln\left( {PL} \right)}{\partial\theta} \middle| {}_{\theta = \theta_{m}}\text{,} \right.$$

until convergence.For a modified Newton's method, the iteration goes:

$$\left. \theta_{m + 1} = \theta_{m} + \Gamma_{*}^{- 1}\left( \theta_{m} \right)\frac{\partial\ln\left( {PL} \right)}{\partial\theta} \middle| {}_{\theta = \theta_{m}}\text{,} \right.$$

until it convergence.Here $\Gamma\left( \theta \right) = - \frac{\partial^{2}\ln\left( {PL} \right)}{\partial\theta\partial\theta^{T}}$, which is the information matrix, and *Γ*~\*~^− 1^(*θ*~*m*~) is a modified version of *Γ*^− 1^(*θ*~*m*~).In (9):

$$\begin{array}{l}
{\frac{\partial\ln\left( {PL} \right)}{\partial\theta_{i}} = \frac{\partial{\sum\limits_{t = 1}^{n}{(y_{t}}}\ln\left( \mu_{t} \right) - \mu_{t} - \ln\left( {y_{t}!} \right))}{\partial\theta_{i}}} \\
{\mspace{72mu} = {\sum\limits_{t = 1}^{n}\left( {y_{t} - \mu_{t}} \right)}\frac{\partial\eta_{t}}{\partial\theta_{i}}\text{,}} \\
\end{array}$$

$$\Gamma\left( \theta \right) = - \frac{\partial{\sum\limits_{t = 1}^{n}{\left( {y_{t} - \mu_{t}} \right)\frac{\partial\eta_{t}}{\partial\theta_{i}}}}}{\partial\theta_{j}} = \begin{pmatrix}
A & B \\
B^{T} & C \\
\end{pmatrix}\text{.}$$Since $\ln\left( \mu_{t} \right) = \eta_{t} = {\sum\limits_{i = 1}^{m}{\beta_{i}X_{\mathit{ti}}}} + {\sum\limits_{j = 1}^{p}{c_{j}\left( {\ln\left( y_{t - j}^{*} \right) - {\sum\limits_{i = 1}^{m}{\beta_{i}X_{t - j,i}}}} \right)}}$, then:

$$\frac{\partial\eta_{t}}{\partial\beta_{i}} = X_{\mathit{ti}} - {\sum\limits_{r = 1}^{p}{c_{r}X_{t - r,i}}},\frac{\partial\eta_{t}}{\partial c_{i}} = \ln\left( y_{t - i}^{*} \right) - {\sum\limits_{k = 1}^{m}{\beta_{k}X_{t - i,k}}}\text{,}$$

$$\frac{\partial^{2}\eta_{t}}{\partial\beta_{i}\partial\beta_{j}} = 0,\frac{\partial^{2}\eta_{t}}{\partial c_{i}\partial c_{j}} = 0,\frac{\partial^{2}\eta_{t}}{\partial\beta_{i}\partial c_{j}} = - X_{t - j,i}\text{.}$$So

$$A = \left( {\sum\limits_{t = 1}^{n}{\mu_{t}(X_{\mathit{ti}} - {\sum\limits_{r = 1}^{p}{c_{r}X_{t - r,i})}}(X_{\mathit{tj}} - {\sum\limits_{r = 1}^{p}{c_{r}X_{t - r,j})}}}} \right)_{\mathit{mm}}\text{,}$$

$$B = \begin{array}{l}
\left( {\sum\limits_{t = 1}^{n},\left( {\mu_{t},(,X_{\mathit{ti}}, - ,{\sum\limits_{r = 1}^{p}{c_{r}X_{t - r,i})}},\left( {\ln,\left( y_{t - j}^{*} \right)} \right)} \right)} \right) \\
{\left( \left( {\left( {- ,{\sum\limits_{k = 1}^{m}{\beta_{k}X_{t - j,k}}}} \right), + ,\left( {y_{t} - \mu_{t}} \right),X_{t - j,i}} \right) \right)_{\mathit{mp},}} \\
\end{array}$$

$$C = \begin{array}{l}
\left( {\sum\limits_{t = 1}^{n},\left( {\ln,\left( y_{t - i}^{*} \right), - ,{\sum\limits_{k = 1}^{m}{\beta_{k}X_{t - i,k}}}} \right)} \right) \\
\left( \left( {\ln,\left( y_{t - j}^{*} \right), - ,{\sum\limits_{k = 1}^{m}{\beta_{k}X_{t - j,k}}}} \right) \right)_{\mathit{pp}} \\
\end{array}\text{.}$$And the modified inverse matrix *Γ*~\*~^− 1^(*θ*~*m*~) is defined as: if Γ(*θ*) is reversible, then *Γ*~\*~^− 1^(*θ*) = *Γ*^− 1^(*θ*);If Γ(*θ*) is irreversible. And its eigenvalue are *λ*~1~, *λ*~2~,...,*λ*~*mp*~, then we can find orthogonal matrix *P*, which satisfies:

$$P^{T}\Gamma\left( \theta \right)P = diag\left( {\lambda_{1},\ldots,\lambda_{\mathit{mp}}} \right)\text{.}$$

Let *λ*~*i*~^\*^ = max(*λ*~*i*~, *δ*), *δ* = 0.01, *i* = 1, 2, ⋯, *mp*, then:

$$\Gamma_{*}^{- 1}\left( \theta \right) = Pdiag\left( {{\lambda_{1}^{*}}^{- 1},\ldots,{\lambda_{\mathit{mp}}^{*}}^{- 1}} \right)P^{T}\text{.}$$

Such procedure ensures *Γ*~\*~^− 1^(*θ*~*m*~) to be positive definite.

Competing interests
===================

The authors declare that they have no competing interests.

Authors' contributions
======================

LY conducted the analysis and drafted the manuscript. GQ participated in discussions and provided advice. NZ inspired and tutored LY, and reviewed the paper. CW and GS collected the mortality data for real case study. All authors read and approved the final manuscript.

Pre-publication history
=======================

The pre-publication history for this paper can be accessed here:

<http://www.biomedcentral.com/1471-2288/12/165/prepub>

Supplementary Material
======================

###### Additional file 1

**R code for this study.** This file contains core R codes for this study, including the function of GAMAR, data generation in simulation studies, data fitting in simulation studies, real case analysis (including the procedure to choose the parameters) and generation of tables and figures. This file also contains a brief description of every R program.

###### 

Click here for file

###### Additional file 2

**Additional Tables.** This file contains 2 tables related to simulation study 1.

###### 

Click here for file

Acknowledgements
================

This research is supported by a project 30972551 from National Natural Science Foundation of China (NSFC).