MulaiMulai sekarang secara gratis

Adjusting for non-constant errors

In this next example, it appears as though the variance of the response variable increases as the explanatory variable increases. Note that the fix in this exercise has the effect of changing both the variability as well as modifying the linearity of the relationship.

Latihan ini adalah bagian dari kursus

Inference for Linear Regression in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Run this to see how the model looks
ggplot(hypdata_nonequalvar, aes(x = explanatory, y = response)) + 
  geom_point() + 
  geom_smooth(method = "lm", se = FALSE)

# Model response vs. explanatory 
model <- ___

# Extract observation-level information
modeled_observations <- ___

# See the result
modeled_observations

# Using modeled_observations, plot residuals vs. fitted values
___
Edit dan Jalankan Kode