A sociologist wants to know whether the number of children in the family is linearly dependent on the
age of the mother at her wedding. He interviewed 9 housewives and the results are shown below.
Age at wedding (X)
20
16
22
23
21
25
30
18
24
No. of children (Y)
4
8
3
4
2
3
1
5
6
Find the following:
a. Plot the scatter diagram of the given data.
b. Find the sample coefficient of determination, 𝑟2
and interpret the result.
c. Obtain the regression line equation.
d. Estimate the number of children at age 28.
a.
The scatter plot for the given data can be drawn using the following commands in "R"
Age.at.wedding=c(20,16,22,23,21,25,30,18,24)
No.of.children=c(4,8,3,4,2,3,1,5,6)
plot(Age.at.wedding,No.of.children,main="Scatter plot of No.of children against age at wedding" )
These commands executes the scatter plot below.
b.
To find the coefficient of determination "(r^2)", we first determine the correlation coefficient"(r)" using the following commands in "R"
x=c(20,16,22,23,21,25,30,18,24)
y=c(4,8,3,4,2,3,1,5,6)
cor(x,y)
This commands gives the value -0.7031642
Therefore, the correlation coefficient "r=-0.7031642"
Now, the coefficient of determination "(r^2)"is,
"r^2=(-0.7031642)^2=0.4944399\\approx0.49"
This value in percentage form is, "0.49*100=49\\%"
The value of coefficient of determination "(r^2)" above shows that 49% of the variation in number of children "(y)" can be explained by the age at wedding"(x)".
c.
To obtain the regression line equation we shall key in the following commands in "R"
x=c(20,16,22,23,21,25,30,18,24)
y=c(4,8,3,4,2,3,1,5,6)
lm(y~x)
The output for these commands is,
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
12.0321 -0.3633
This shows that the "y-intercept=12.0321" and the "slope=-0.3633". The regression line is of the form "y=a*x+b" where "a" is the slope and "b" is the y-intercept. Therefore, the regression line equation is, "y=-0.3633x+12.0321"
d.
When the age at wedding is 28, the number of children is determined by substituting this value in the regression line equation as shown below,
"y=-0.3633(28)+12.0321= 1.8597\\approx2". Hence the number of children at age 28 is 2.
Comments
Leave a comment