[R] Help required graphing factors with predicted model settings

Jim Lemon jim at bitwrit.com.au
Thu Oct 10 07:17:58 CEST 2013


On 10/10/2013 03:52 PM, Rebecca Stirnemann wrote:
> Thanks Jim for helping,
>
> Your sample data actually looks like my dataset. The one I put up looks
> strange for some reason so please ignore that.
> I have three landusenumb variables 1 2 and 3. is rep (1,2,3) correct?
>
> When I run the following code I am getting:
>
>  > mod1 <- glmer(frat ~ flandusenumb + ground.cover_lo + (1|fsite)
> ,family = binomial, data= mao1)
>  >
>  > #Calculate predicted values
>  > newdata1 <- data.frame(ground.cover_lo = c(25,50,100), flandusenumb =
> rep(1,2,3))
>  > pred34 <- predict(mod1,newdata=newdata1,type="response")
>
> Error in UseMethod("predict") :
>    no applicable method for 'predict' applied to an object of class "mer"
>
> Can you see what I am doing wrong?
> What I am aiming for is a graph which looks like this.
>
> Thanks
> Rebecca
>
Okay, so you aren't getting anything to plot. You will have to send your 
plot image directly to me, as R-help scrubs most images from emails.

I assume that "landusenumb" is the occasion of measurement (i.e. you 
have three repeated measurements). Perhaps you could calculate the three 
values from the initial model, remembering that the logarithm of the 
odds of predation is your response.

Jim



More information about the R-help mailing list