+ Reply to Thread
Results 1 to 2 of 2

Thread: Linear mixed model subject level

  1. #1
    Points: 6, Level: 1
    Level completed: 11%, Points required for next Level: 44

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Linear mixed model subject level




    Dear All
    I am new to R and I am implementing a linear mixed model for a variance shift outlier model. I am wondering if someone in the group can help with getting subject level parameter estimates.
    my model is as follows
    mFit<- lmer (y ~time+trt+(1|subject), data=dataFrame)

    I would like to extract estimates at the subject level as opposed to the observation level, i.e. I need estimates grouped by the subject

    Thanks
    Isaac

  2. #2
    Points: 8,120, Level: 60
    Level completed: 85%, Points required for next Level: 30

    Posts
    169
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Re: Linear mixed model subject level


    Thats an easy one. You use
    Code: 
    predict(mFit)
    and assign the vector of predictions to a new variable in the dataset, eg.
    Code: 
    dataFrame$pred= predict(mFit) 
    # or maybe (coding blind here)
    dataFrame$pred= predict(mFit)$value
    and then you use
    Code: 
    aggregate()
    to compute the conditional predictions.

    Consuli
    Prediction is very difficult, especially about the future. (Niels Bohr)

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats