1

I've recently started learning to fit data using the nlme model. I was wondering if there was a more logical way of generating all possible combinations of covariates (for the variables asy and int) in the nlme model below:

fmzeta.nlme <- nlme(
               z ~ asy - (asy - int)*exp(-c*t), 
               fixed = list(asy ~ age + wfa + vl,
                            int ~ age + wfa + vl, c ~ 1),
               random = int + asy ~ 1,
               start = c(-1, 0, -2, 0, 0, 0, 0, 0, 0.03),
               data = DATA)

As you can see there are three covariates for the two variables asy and int. I would like to generate all possible combinations of covariates and then look for the model that has the best fit. I haven't found any topic related to this so far so I would appreciate any helpful ideas. Could someone also tell me how to make the r code appear properly in a post?

Thanks

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
John_dydx
  • 951
  • 1
  • 14
  • 27
  • 1
    just to clarify: do you mean that `asy`, `int`, and `c` can each depend on any combination of `age`, `wfa`, and `vl`, e.g. `fixed = list(asy ~ 1, int ~ age + wfa, c ~ wfa)` would be one possibility? (This translates to a *lot* of models -- 8 possibilities per response variable, so a total of 8^3=512 ...) – Ben Bolker Dec 11 '13 at 21:41
  • @ Ben Bolker, thanks for your reply. You're quite right, asy, int and c can each depend on any combination of the covariates. 512 is quite scary which is why I was wondering if there was a quicker way of doing this. If not, I'll just have to try all 512 manually I guess. Thanks for your answer. – John_dydx Dec 12 '13 at 10:41
  • 1
    I think it is doable, it will just take a bit of hacking. I'm just concerned about the potential for data-dredging in this way (unless this is a purely exploratory analysis ...) – Ben Bolker Dec 12 '13 at 13:43
  • @ Ben Bolker, by "data-dredging", do you mean overfitting? – John_dydx Dec 12 '13 at 16:31
  • 1
    Technically overfitting refers to fitting a single model with too many parameters. By data-dredging I mean fitting lots of models and seeing which fits best, which can lead to a false sense of confidence in the selected model if the model selection process is not explicitly taken into account. – Ben Bolker Dec 12 '13 at 16:41
  • 1
    @ Ben Bolker, I see your point, I'll bear that in mind. – John_dydx Dec 12 '13 at 17:04

0 Answers0