anova - R not plotting observations with leverage one - Cross Validated
i building simple linear model. want test if frass got on 3 days butterfly larvae depend upon food ate (diet), butterfly family (the mother line) , subsequent survival (called "survived", larvae may latter die show e.g. problems eat @ larval stage). i'm interested in 2 way interactions: diet:family , survived:family. interaction diet:survived not included because there 1 individual in 1 of 2 diet died.
model:
mod=lm(log(frass.weight)~diet*family+survived+family:survived,data=dat) anova(mod) # variables significant. summary(mod) #the r2adj of 0.81 shapiro.test(resid(mod)) # p-value = 0.2389
i have not looked @ variance have small sample size. 3 individuals of 7 family have been recorded frass on both 2 diets.
problem:
all looks nice, except when plot model plot(mod)
following warning:
"warning messages: 1: not plotting observations leverage one: 3, 20, 30, 35 "
is warning or have real issue these points influence variance?
when remove these points, final model simplier:
mod1=lm(log(frass.weight)~diet*family+survived,data=datout)
the residuals , plot works fine.
therefore, warning leverage not consider , first model should kept or not? points real outliers?
points leverage equal 1.0 indicates strange model, groups 1 member. error in model formulation, should in cases thoroughly checked out! leverages diagonal elements of hat matrix $h= x (x^t x)^{-1} x^t$ , diagonals satisfy $0 \le h_i \le 1$. fitted values can written $\hat{y} = hy$ explaining name "hat matrix": puts hat on $y$ (it named w tukey). writing out observation number $i$ get: $$ \hat{y}_i = \sum_{j=1}^n h_{ij} y_j = h_i y_i + \sum_{j\not = i} h_{ij} y_j. $$ when $h_i=1.0$ can show (*) other $h_{ij}=0, j\not= i$. when $h_i$=1, can se: $$ \hat{y_i} = y_i. $$ is, own observation influences prediction. other observations irrelevant observation $i$! quite strange, , caused error in model formulation. you should investigate model (and data!) , try understand why happens.
finally, let prove our claim (*): $h$ idempotent matrix, is, $hh=h$. using element $h_i$: $$ h_i =\sum_{j=1}^n h_{ij}^2 = h_i^2 + \sum_{j\not = i} h_{ij}^2 $$ simplifies $1=1+ \sum_{j\not = i} h_{ij}^2$ proving claim.
Comments
Post a Comment