Open In App

How to Interpret Significance Codes in R?

Last Updated : 09 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will discuss how to interpret Significance Codes in the R programming Language. 

The significance codes indicate how certain we can be that the following coefficient will have an impact on the dependent variable. This helps us in determining the Principal components that affect the variation of our goal variable. To calculate Significance Codes for a regression model in the R Language, we use the summary() function. The summary() function summarizes Linear Model fits using statistical measures for each component. 

Syntax:

summary( Regression_model )

Parameter:

Regression_ model: determines the model whose summary we have to find.

Significance code in the summary of a regression model is a measure of its p-value variation. The following table shows the range of p-value for every significance code.

Significance Codes p-value
*** [0, 0.001]
** (0.001, 0.01]
* (0.01, 0.05]
. (0.05, 0.1]
  (0.1, 1] 

Here, the smaller the p-value for a variable, the more significant it will be for that model. For example, if var1 has Significance code ** and var2 has significance *, then it means that var1 is more significant than var2 for that regression model as it has smaller p-value.

Example: Significances codes for a linear model.

R




# load library tidyverse
library(tidyverse)
 
# fit regression model
linear_model <- lm(price ~ carat + depth + table,
                   data = diamonds)
 
# view model summary
summary(linear_model)


Output:

Call:

lm(formula = price ~ carat + depth + table, data = diamonds)

Residuals:

    Min       1Q   Median       3Q      Max  

-18288.0   -785.9    -33.2    527.2  12486.7  

Coefficients:

            Estimate Std. Error t value Pr(>|t|)    

(Intercept) 13003.441    390.918   33.26   <2e-16 ***

carat        7858.771     14.151  555.36   <2e-16 ***

depth        -151.236      4.820  -31.38   <2e-16 ***

table        -104.473      3.141  -33.26   <2e-16 ***

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1526 on 53936 degrees of freedom

Multiple R-squared:  0.8537,    Adjusted R-squared:  0.8537  

F-statistic: 1.049e+05 on 3 and 53936 DF,  p-value: < 2.2e-16

Example: Significances codes for a one-way ANOVA model. 

R




# load library tidyverse
library(tidyverse)
 
# fit anova model
anova_model <- aov(price~carat, data = diamonds)
 
# view model summary
summary(anova_model)


Output:

               Df    Sum Sq   Mean Sq F value Pr(>F)    

carat           1 7.291e+11 7.291e+11  304051 <2e-16 ***

Residuals   53938 1.293e+11 2.398e+06                    

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads