Adding covariates to nlme model in R

1.4k views Asked by At

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

0

There are 0 answers