Write and fit the normal linear model
The basic linear regression analysis assumes centered independent normal random variables of a common variance , conditional on the predictors. Independence between makes does not by itself establish independence between different models of the same make; that stronger assumption should be checked, or within-make dependence modelled. The requested R fit is
fit <- lm(log(price) ~ mpg + psngr + length + width + weight, data = cars)
The estimate column contains the ordinary least squares coefficients. The standard error estimates the standard deviation of each coefficient estimator. The t value is its estimate divided by its standard error. The last column gives the two-sided p-value for a zero coefficient, using a Student t-distribution with residual degrees of freedom under the stated normal linear model; the stars summarize significance thresholds.
Conditional on the other predictors, passenger capacity and width have negative fitted coefficients, while length and weight have positive ones. All four are significant at the conventional 5% level; length is borderline. There is little evidence for an additional mpg effect once the others are included. These are conditional associations, not causal claims. For example, increasing weight by 100 pounds multiplies the fitted price by approximately , about 1.087.
A reasonable candidate simplification removes mpg and compares the nested models by an F-test, rather than treating a nonsignificant coefficient as proof of no effect:
fit2 <- update(fit, . ~ . - mpg)
anova(fit2, fit)
Inspect regression residuals, normal quantiles, residual-versus-fitted plots, leverage and influential observations. The correlated size predictors may produce multicollinearity; missing make effects, nonlinear terms or unequal residual variances may also matter. A random make effect or a covariance adjustment addresses the possible dependence noted above.

Articles by others on the same topic (0)

There are currently no matching articles.