R: fix model call in model using as.formula

Viewed 519

I have a gls model in which I assign a formula (from another object) to the model:

equation <- as.formula(aic.obj[row,'model'])
> equation
temp.avg ~ I(year - 1950)
mod1 <- gls(equation, data = dat)

> mod1
Generalized least squares fit by maximum likelihood
  Model: equation 
  Data: dat 
  Log-likelihood: -2109.276

However I do not want the "Model" to be "equation" but rather the quation itself! How do I do this??

2 Answers
Related