Database Reference
In-Depth Information
Figure 6.3 Normal distribution about y for a given value of x
For , one would expect to observe a value of near 20, but a value of y
from 15 to 25 would appear possible based on the illustrated normal distribution.
Thus, the regression model estimates the expected value of for the given value
of . Additionally, the normality assumption on the error term provides some
useful properties that can be utilized in performing hypothesis testing on the linear
regression model and providing confidence intervals on the parameters and the
mean of given . The application of these statistical techniques is
demonstrated by applying R to the earlier linear regression model on income.
Example in R
Returning to the Income example, in addition to the variables age and education,
the person's gender, female or male, is considered an input variable. The following
code reads a comma-separated-value (CSV) file of 1,500 people's incomes, ages,
years of education, and gender. The first 10 rows are displayed:
income_input = as.data.frame( read.csv("c:/data/
income.csv") )
income_input[1:10,]
ID Income Age Education Gender
1 1 113 69 12 1
2 2 91 52 18 0
3 3 121 65 14 0
4 4 81 58 12 0
5 5 68 31 16 1
6 6 92 51 15 1
Search WWH ::




Custom Search