title: R- represent glmm (Package MuMin and lme4) with categorical and numeric variable
body: <p>I have a table with Ancylostoma's infection, vs sex (2 factor), location (2 factor), year, management (2 factor), ancestry (4 factor) and  viremia like categorical variable, and the I have HL an age like numeric variable.**</p>
  
  <p>I made a glmm:</p>
  
  <pre><code>glm_toxo&lt;-glmer((Ancylostoma) ~ as.factor(Sexo)+(Edad)+as.factor(año)+as.factor(Manejo)+as.factor(Localizacion)+as.factor(Viremia.FeLV) +(Ancestria) +(HL)+as.factor(1|Nombre), family="binomial", data= data_silv)
  
  dd_toxo &lt;- dredge (glm_toxo)
  a&lt;- get.models(dd_toxo, subset = delta &lt; 2)
  b&lt;-(model.avg(a))
  </code></pre>
  
  <p>And I got this result</p>
  
  <pre><code>Model-averaged coefficients: 
                               Estimate Std. Error z value Pr(&gt;|z|)    
  (Intercept)                   -2.0222     0.8911   2.269   0.0233 *  
  as.factor(Localizacion)PORT  -15.2935  2163.9182   0.007   0.9944    
  as.factor(Localizacion)SMO    -3.0012     0.7606   3.946 7.95e-05 ***
  as.factor(Manejo)SILV          1.8125     0.7799   2.324   0.0201 *  
  Edad                          -0.1965     0.1032   1.904   0.0569 .  
  as.factor(Sexo)M               0.5015     0.4681   1.071   0.2840    
  HL                            -0.9381     1.4244   0.659   0.5102    
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
  </code></pre>
  
  <p>I would like represent the probability of infection (y) vs age (x), but using the estimate of my model.avg**</p>
  
  <p>I tried with this script:</p>
  
  <pre><code>nseq &lt;- function(x, len = length(x)) seq(min(x, na.rm = TRUE),max(x, na.rm=TRUE), length = len)
  
  ####
  newdata &lt;- as.data.frame(lapply(lapply(data_silv[2:4], mean), rep, 213))
  newdata$Edad &lt;- nseq(data_silv$Edad, nrow(newdata))
  (año &lt;- sample(as.factor(data_silv$año),size=213,rep=T))
  (Manejo &lt;- sample(as.factor(data_silv$Manejo),size=213,rep=T))
  (Sexo &lt;- sample(as.factor(data_silv$Sexo),size=213,rep=T))
  newdata &lt;- as.data.frame(cbind(mean(data_silv$HL), año,Manejo,Sexo,
                   data_silv$Localizacion, nseq(data_silv$Edad, nrow(newdata)),
                   data_silv$Ancylostoma))
  names(newdata) &lt;- c("HL","año","Manejo","Sexo","Localizacion","Edad",
  "Ancylostoma")
  
  
  newdata$pred &lt;- data.frame(
    model = sapply(a, predict, newdata = newdata),
    averaged.subset = predict(b, newdata, full = FALSE),
    averaged.full = predict(b, newdata, full = TRUE)
  )
  
  library(ggplot2)
  ggplot(newdata,aes(x="Edad",y="pred",color="Localizacion")) + geom_line()
  #####
  </code></pre>
  
  <p>But I haven't got graph...or I have error</p>
  
  <p>Someone know any form to represent my model.avg with categorical and variable numeric?, But taking into account that I only want represent  probability of infection vs age, with two line: localizacion1 and localizacion2...(localization had 2 factors).**</p>
  
  <p>my original date would be this table:</p>
  
  <h2>#</h2>
  
  <pre><code>año &lt;- sample(as.factor(2005:2009),size=213,rep=T)
  riqueza &lt;- sample((0:3),size=213,rep=T)
  HL &lt;- rnorm(213, mean=0.54, sd=0.13)
  
  Ancylostoma &lt;- sample(as.factor(0:1),size=213,rep=T)
  
  Edad &lt;- sample(as.factor(0:21),size=213,rep=T)
  Manejo&lt;- sample(c("CCC", "SILV"), 213, replace = TRUE)
  Sexo&lt;- sample(c("M", "H"), 213, replace = TRUE)
  Localizacion&lt;- sample(c("SMO", "DON", "PORT"), 213, replace = TRUE)
  Ancestria&lt;- sample(c("DON", "SMO", "F1", "F2"), 213, replace = TRUE)
  
  newdata &lt;- as.data.frame(cbind(HL,año,Manejo,Sexo,
                                 Localizacion, Edad,Ancylostoma))
  
  
  names(newdata) &lt;- c("HL","año","Manejo","Sexo","Localizacion","Edad",
                      "Ancylostoma")
  </code></pre>
  
  <h2>#</h2>
  
  <p>And with that date I make my model's estimates. Then I would like do prediction</p>
  
  <p>Thank you, I don't sure if I am explaining well</p>
  
  <p>I so sorry for my english</p>