I'll extend the comment of @Didzis (which is of course true), so you'll really learn what is going on. Units
is a variable in your data, not a particular name for somekind of variable like residuals
or fitted values
(although units as general does have that kind of meaning...), so there isn't any ready function which gives you those. You already have used Units in your first line of code when building the model: There you used argument data
with value A
, which told lme
function that your variables used in modelling lie inside of the data frame called A
.
You can access the variables in data frame by using dollar sign $
with the name of the variable you want to extract (you can check the names using function names(A)
). Therefore you get your Units variable by using command A$Units
, so you can plot your Units
variable versus the residuals by using the command
plot(A$Units,resid(model))