# baisc question about fit of GLS in R

Wondered if anyone could help. I've fit the below model in R using GLS from the nlme package.

m2_p1q2 <- gls(log(ratio) ~ level + levellag +
trend + time,
method = "ML", correlation = corARMA(p = 1, q = 2, form = ~ time),
data = a1)


The plotted regression shows a curve and I wondered whether this might be viewed as a problem with fit?

Your data seem to exhibit heteroskedasticity (non-constant variance) and your model does not account for this through either explicitly modeling the variance or weighting of observations. That is a problem. I would consult your favorite statistics book on weighted least squares and variance-stabilizing transformations.

• Thanks. The non-constant variance is a key component of the effect I am trying to measure. Would that represent and issue to weighted least squares? Jul 24 '20 at 12:50
• No, that is one of the common uses of weighted least squares -- to adjust for non-constant variance. Jul 24 '20 at 16:32