I want to test the effect of Habitat (categorical), caterpillar SR, caterpillar abundance, plant SR and plant abundance on Z. filipendulae (count).

I have decided to use bootstrapped regression as the assumptions of ANCOVA have not been met.

R code below

bootReg<-function(formula=Z. filipendulae~Catepillar.SR+Caterpillar.Abundance+Plant.SR+Plant.Abundance+factor(Habitat), data=AncovaData, i)

{

d <- data[i,]

fit <- lm(formula, data = d)

return(coef(fit))

}

bootResults<-boot(statistic =bootReg,

formula=Z.filipendulae~Caterpillar.SR +

Caterpillar.Abundance+Plant.SR+Plant.Abundance+factor(Habitat),

data=Data,R=2000)

Error

Error in t.star[r, ] <- res[[r]] :

number of items to replace is not a multiple of replacement length

I think you have forgot to tell us what your problem is, you are just telling us what have you done so far but not what problems you are having.

Ideally, you should prepare a **repr**oducible **ex**ample (reprex) illustrating your issue.

Please have a look at this guide, to see how to create one:

2 Likes

system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.