*59*

When you perform regression analysis or ANOVA in R, the output tables will contain p-values for the variables used in the analysis along with corresponding **significance codes**.

These significance codes are displayed as a series of stars or a decimal point if the variables are statistically significant.

Here is how to interpret the various significance codes:

significance code p-value *** [0, 0.001] ** (0.001, 0.01] * (0.01, 0.05] . (0.05, 0.1] (0.1, 1]

The following examples show how to interpret these significance codes in practice.

**Example: Significance Codes in Regression**

The following code shows how to fit a multiple linear regression model with the built-in **mtcars** dataset using *hp*, *drat*, and *wt* as predictor variables and *mpg* as the response variable:

#fit regression model using hp, drat, and wt as predictors model #view model summary summary(model) Call: lm(formula = mpg ~ hp + drat + wt, data = mtcars) Residuals: Min 1Q Median 3Q Max -3.3598 -1.8374 -0.5099 0.9681 5.7078 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 29.394934 6.156303 4.775 5.13e-05 *** hp -0.032230 0.008925 -3.611 0.001178 ** drat 1.615049 1.226983 1.316 0.198755 wt -3.227954 0.796398 -4.053 0.000364 *** --- Signif. codes: 0 â€˜***â€™ 0.001 â€˜**â€™ 0.01 â€˜*â€™ 0.05 â€˜.â€™ 0.1 â€˜ â€™ 1 Residual standard error: 2.561 on 28 degrees of freedom Multiple R-squared: 0.8369, Adjusted R-squared: 0.8194 F-statistic: 47.88 on 3 and 28 DF, p-value: 3.768e-11

Here is how to interpret the significance codes for the three predictor variables:

*hp*has a p-value ofÂ**.001178**. Since this value is in the range**(0.001, 0.01]**, it has a significance code of*******drat*has a p-value ofÂ**.198755**. Since this value is in the range**(0.1, 1]**, it has no significance code.*wt*has a p-value ofÂ**.000364**. Since this value is in the range**[0, 0.001]**, it has a significance code of*******

If we used an alpha level of Î± = .05 to determine which predictors were significant in this regression model, weâ€™d say thatÂ *hp* andÂ *wt* are statistically significant predictors whileÂ *drat* is not.

**Example: Significance Codes in ANOVA**

The following code shows how to fit a one-way ANOVA model with the built-in **mtcars** dataset using *gear* as the factor variable and *mpg* as theÂ response variable:

#fit one-way ANOVA model #view the model output summary(model) Df Sum Sq Mean Sq F value Pr(>F) gear 1 259.7 259.75 8.995 0.0054 ** Residuals 30 866.3 28.88 --- Signif. codes: 0 â€˜***â€™ 0.001 â€˜**â€™ 0.01 â€˜*â€™ 0.05 â€˜.â€™ 0.1 â€˜ â€™ 1

Here is how to interpret the significance code in the output:

*gear*has a p-value ofÂ**.0054**. Since this value is in the range**(0.001, 0.01]**, it has a significance code of******

Using an alpha level of Î± = .05, we would say that *gear* is statistically significant. In other words, there is a statistically significant difference between the mean *mpg* of cars based on their value for *gear*.