Hi again, dear Dennis,

i checked the spelling in Zuur et al. and they wrote it like i did.
I tried your suggestion but now i have another warning message:


 > D1<- data.frame(L.AREA= Loyn$L.AREA[Loyn$fGRAZE==1], fGraze = "1")

Error in data.frame(L.AREA = Loyn$L.AREA[Loyn$fGRAZE == 1], fGraze = "1") :
   arguments imply differing number of rows: 0, 1

My aim i to display the predicted/fitted values of the different slopes 
for a  factor in a plot.
I tried different ways for my own data and when i found this solution i 
was happy, but even the provided solution with the provided dataset do 
not work...
aaaahhhhh.

Any ideas?? First i thought i had a problem with missing values, but in 
the Zuur data are no missing values.

Heike



Am 3/3/2011 18:51, schrieb Dennis Murphy:
> Hi:
>
> You need the second variable in D1 to be named fGRAZE - the variable 
> names in the newdata data frame (D1) have to be the same as the 
> variable names on the RHS of the model formula, in this case L.AREA 
> and fGRAZE.
>
> HTH,
> Dennis
>
> On Thu, Mar 3, 2011 at 7:43 AM, Heike Schmitz <schmi...@uni-bremen.de 
> <mailto:schmi...@uni-bremen.de>> wrote:
>
>     Dear R- Community,
>
>     to learn i reanalysed some data provided and analysed by Zuur et.
>     al. in their book "Mixed effect models and Extensions in Ecology
>     with R". When i run the last command i get a warning message i
>     dont understand.
>
>
>     Loyn<- read.table(file = "loyn.txt",header = TRUE)
>     Loyn$L.AREA<- log10(Loyn$AREA)
>     fGRAZE <-factor(Loyn$GRAZE)
>
>     M0<- lm(ABUND~ L.AREA + fGRAZE, data = Loyn)
>     summary(M0)
>
>     plot(x = Loyn$L.AREA, y = Loyn$ABUND,
>        xlab = "Log transformed AREA",
>        ylab = "Bird Abundance")
>
>     D1<- data.frame(L.AREA= Loyn$L.AREA[Loyn$GRAZE==1], fGraze = "1")
>     P1<- predict(M0,newdata = D1)
>
>     Warning message:
>     Error in model.frame.default(Terms, newdata, na.action =
>     na.action, xlev = object$xlevels) :
>      variable lengths differ (found for 'fGRAZE')
>     In addition: Warning message:
>     'newdata' had 13 rows but variable(s) found have 56 rows
>
>     I hope anyone has an idea.
>     Thank you in advance.
>     Heike
>
>     -- 
>     Heike Schmitz- Diaspero
>     Population Ecology and Evolutionary Ecology Lab, FB2
>     University of Bremen
>     Leobener Strasse, Nw2, Room B4050
>     D-28359 Bremen
>     Germany
>     fon ++49-421-218-62937
>     email: heike.schm...@uni-bremen.de
>     <mailto:heike.schm...@uni-bremen.de>
>
>     http://www.popecol.uni-bremen.de
>
>     ______________________________________________
>     R-help@r-project.org <mailto: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.
>
>

-- 
Heike Schmitz- Diaspero
Population Ecology and Evolutionary Ecology Lab, FB2
University of Bremen
Leobener Strasse, Nw2, Room B4050
D-28359 Bremen
Germany
fon ++49-421-218-62937
email: heike.schm...@uni-bremen.de

http://www.popecol.uni-bremen.de


        [[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.

Reply via email to