[R-sig-ME] Assessing linearity

Jarrod Hadfield j.hadfield at ed.ac.uk
Sun Oct 24 11:41:26 CEST 2010


Hi Mike,

You would be better off trying out something like polynomials or  
splines, For example:

  fit1 = lmer(
      formula = response ~ (1|individual)+poly(grade_as_numeric,n),
      , data = my_data
      , family = gaussian
  )

where n is the order of the polynomial. n=1 would fit the same model  
as your original fit1, although the covariate (and the regression  
parameter) would be scaled by some number. When n=6 the model would be  
a reparameterised version of your model fit2. When 1<n<6 you would be  
working with a non-linear relationship in between these two extremes,  
although the model is still linear in the parameters.

Cheers,

Jarrod








Quoting Mike Lawrence <Mike.Lawrence at dal.ca>:

> Hi folks,
>
> I have developmental data collected across several grades (1-6). I
> would like to be able to assess whether there are any linear or
> non-linear trends across grade. Does it make sense to run a first lmer
> treating grade as continuous, obtain the residuals, then run a second
> lmer treating grade as a factor? That is:
>
> fit1 = lmer(
>     formula = response ~ (1|individual)+grade_as_numeric
>     , data = my_data
>     , family = gaussian
> )
> my_data$resid = residuals(fit1)
> fit2 = lmer(
>     formula = resid ~ (1|individual)+grade_as_factor
>     , data = my_data
>     , family = gaussian
> )
>
>
> As I understand it, fit1 will tell me if there are any linear trends
> in the data, while fit2 will tell me if there are any non-linear
> trends in the data in addition to the linear trends obtained in fit1.
>
> If this is sensible, how might I apply it to a second binomial
> response variable given that the residuals from a binomial model are
> not 0/1?
>
> Cheers,
>
> Mike
>
> --
> Mike Lawrence
> Graduate Student
> Department of Psychology
> Dalhousie University
>
> Looking to arrange a meeting? Check my public calendar:
> http://tr.im/mikes_public_calendar
>
> ~ Certainty is folly... I think. ~
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




More information about the R-sig-mixed-models mailing list