Dear R wizards, Though I hate to do it after weeks of my code not working I need some help since I cant find an example which seems to work. I am trying to create a graph which show the probability of predation of a nest on one side (either 1 to 0) or (0% to 100%) on one side and grass height at the bottom. I want to then add my predicted lines from my glmr onto the graph for three habitat types.
I would like to repeat this procedure 3 times for three different grass heights 25- 50- 100 to see the effect size. My data: landusenumb landuse sitename rat ground.cover_lo 1 plantation far.leftroad_LHS 0 60 1 plantation far.leftroad_LHS 1 70 1 plantation far.leftroad_LHS 1 10 1 plantation far.leftroad_LHS 1 30 1 plantation far.leftroad_LHS 1 50 1 plantation far.leftroad_LHS 0 20 1 plantation far.leftroad_LHS 0 70 1 plantation far.leftroad_LHS 0 100 1 plantation far.leftroad_LHS 0 90 #Graph #Fit model mod1 <- glmer(frat ~ flandusenumb + ground.cover_lo + (1|fsite) ,family = binomial, data= mao1) #Calculate predicted values newdata1 <- data.frame(ground.cover_lo = seq(0,10,length=100), flandusenumb = rep(1,2,3)) pred34 <- predict(mod1,newdata=newdata1,type="response") #Plot model predicted curves plot(c(0,100),c(0,1),type="n",xlab="grasscover",ylab="Probability of predation") lines(newdata1$frat,pred34,lwd=3,col="blue") -- www.samoanbirds.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.