Dear list, 


I'm fairly new to AICs-based analysis and I'm trying to get averaged predictions based on a set of 15 candidate models. 


## I created my list of candidate models:

library(AICcmodavg)
Cand.mod
<- list()
 Cand.mod[[1]]
<- lm(LogitDeca2.sumBDEs ~ LandfWstwtr.outCol24, 
data =
Males)
 
Cand.mod[[2]]
<- lm(LogitDeca2.sumBDEs ~ LandfWstwtr.outCol24 + year.cat, data = Males)
 
Cand.mod[[3]]
<- lm(LogitDeca2.sumBDEs ~ Wst.SizeOrd, data = Males)
 
Cand.mod[[4]]
<- lm(LogitDeca2.sumBDEs ~ Wst.SizeOrd + year.cat, data = Males)
 
Cand.mod[[5]]
<- lm(LogitDeca2.sumBDEs ~ UrbanCov1.outCol24, data = Males)
 
Cand.mod[[6]]
<- lm(LogitDeca2.sumBDEs ~ UrbanCov1.outCol24 + year.cat, data = Males)
 
Cand.mod[[7]]
<- lm(LogitDeca2.sumBDEs ~ LandfWstwtr.outCol24 + UrbanCov1.outCol24, data =
Males)
 
Cand.mod[[8]]
<- lm(LogitDeca2.sumBDEs ~ LandfWstwtr.outCol24 + UrbanCov1.outCol24 + year.cat,
data = Males)
 
Cand.mod[[9]]
<- lm(LogitDeca2.sumBDEs ~ Wst.SizeOrd + UrbanCov1.outCol24, data = Males)
 
Cand.mod[[10]]
<- lm(Males$LogitDeca2.sumBDEs ~ Males$ Wst.SizeOrd + Males$UrbanCov1.outCol24
+ Males$year.cat, data = Males)
 
Cand.mod[[11]]
<- lm(LogitDeca2.sumBDEs ~ Agri.outCol24 + AllLawren.outCol24 +
UrbanCov1.outCol24 + LandfWstwtr.outCol24, data = Males)
 
Cand.mod[[12]]
<- lm(LogitDeca2.sumBDEs ~ Agri.outCol24 + AllLawren.outCol24 + UrbanCov1.outCol24
+ LandfWstwtr.outCol24 + year.cat, data = Males)
 
Cand.mod[[13]]
<- lm(LogitDeca2.sumBDEs ~ Agri.outCol24 + AllLawren.outCol24 +
UrbanCov1.outCol24 + Wst.SizeOrd, data = Males)
 
Cand.mod[[14]]
<- lm(LogitDeca2.sumBDEs ~ Agri.outCol24 + AllLawren.outCol24 +
UrbanCov1.outCol24 + Wst.SizeOrd + year.cat, data = Males)
 
Cand.mod[[15]]
<- lm(LogitDeca2.sumBDEs ~ 1, data = Males)
 
 
## Assign
name to each model
 
Modnames <- c("Deca2M~ %WMF",
"Deca2M~ %WMF + year",
"Deca2M~ sizeWMF",
"Deca2M~
sizeWMF +  year", "Deca2M~ %urban",
"Deca2M~
%urban + year", "Deca2M~ %urban +
%WMF", "Deca2M~ %urban + %WMF + year","Deca2M~ %urban +
sizeWMF", "Deca2M~ %urban +
sizeWMF + year", "Deca2M~ %4Habitats", "Deca2M~ %4Habitats + year", "Deca2M~ %3Habitats + sizeWMF", "Deca2M~ %3Habitats + sizeWMF + year", "Deca2M~ intercept")
 
 
##Create
model selection table based on AICc
 
aictab(cand.set = Cand.mod, modnames = Modnames)


## Then I created my new data used for prediction (I want all factors to be constant, expect "year"):

newdata2
<- data.frame(Agri.outCol24= mean(Males$Agri.outCol24),
AllLawren.outCol24 =mean(Males$AllLawren.outCol24),
UrbanCov1.outCol24=mean(Males$UrbanCov1.outCol24),
LandfWstwtr.outCol24 =mean(Males$LandfWstwtr.outCol24),year.cat =
factor(c("2010","2011","2012")))

## Then I tried to make my predictions


modavgpred(cand.set = Cand.mod, modnames = Modnames, newdata =
newdata2, type = "response", second.ord = TRUE, uncond.se =
"revised")

## And got the following error message

Error in `$<-.data.frame`(`*tmp*`,
"fit", value = c(-1.43174037092794,  :  
  replacement has 645 rows, data has 15
In addition: There were 28 warnings (use
warnings() to see them)


Any suggestions on where my mistake is ?

Thank you !!

Marie
	[[alternative HTML version deleted]]

