Hello,
to check my model for heteroskedasticity I want to plot the fitted values and the residuals (plot (fitted.values (model), residuals (model)).
But then I always get this error message: Error in match.arg(plot) :
'arg' must be NULL or a string vector
Does anyone know why this is happening and how to fix it?
Thanks a lot!
If you are using lm()
fit <- lm(mpg ~ drat, data = mtcars)
plot(fit,which = 1)
Created on 2023-03-06 with reprex v2.0.2
Other models may have different methods
1 Like
[quote="technocrat, post:2, topic:161429"]
Technocrat, what does
which = 1
do here?
The plot.lm
method called by plot()
produces six plots and by default four are displayed interactively with prompts. To choose the which
flag can be used. Often, a four pane window option is set to show the four defaults in one go.
fit <- lm(mpg ~ drat, data = mtcars)
op <- par(mfrow = c(2,2))
plot(fit)
dev.off()
#> null device
1 Like
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.