Sb13–Sb15 - Regression lines for two random variables

Sb13–Sb15 - Regression lines for two random variables

Calculate the two regression lines for random-on-random data and choose the line that estimates the required variable. Interpret the predicted conditional mean, the common mean point and the model's fit without treating either line as an exact inverse relationship.

Calculating the two regression lines

If a line estimates mean leaf area from stem length, can you reverse that same equation to estimate mean stem length from leaf area?

Usually not. Selecting plants of a given stem length and selecting plants of a given leaf area form different groups. Each group has its own conditional mean to estimate.

You already know

The regression of yy on xx has gradient Sxy/SxxS_{xy}/S_{xx} and passes through (xˉ,yˉ)(\bar x,\bar y). In a controlled-input experiment, the input is fixed; here both plant measurements vary randomly across the sample.

For two random variables, the yy-on-xx line estimates the mean of YY for a given value of XX, written E(Y∣X=x)\mathrm{E}(Y\mid X=x). The xx-on-yy line estimates E(X∣Y=y)\mathrm{E}(X\mid Y=y). These are modelled conditional means, not guaranteed measurements for particular individuals.

The two least squares lines

Provided both variables have nonzero sample variation:

y^−yˉ=SxySxx(x−xˉ)\widehat y-\bar y=\frac{S_{xy}}{S_{xx}}(x-\bar x) x^−xˉ=SxySyy(y−yˉ)\widehat x-\bar x=\frac{S_{xy}}{S_{yy}}(y-\bar y)

The first predicts yy from xx; the second predicts xx from yy. Use a paired-data calculator fit for raw observations, or substitute the supplied summary statistics.

In the formula booklet.

Keep each equation in the direction it predicts. Rewriting an equation algebraically does not change which least squares model produced it.

Worked example 1: leaf area from stem length

Question. Four sampled plants have stem lengths x=1,2,3,4 cmx=1,2,3,4\,\mathrm{cm} and corresponding leaf areas y=2,4,3,7 cm2y=2,4,3,7\,\mathrm{cm^2}. Calculate the regression line of leaf area on stem length.

Plan. Obtain the means and centred sums, then use the input sum SxxS_{xx} for this direction.

xˉ=2.5,yˉ=4paired-column meansSxx=30−1024=5stem-length variationSxy=47−10(16)4=7paired variationb=75=1.4predict area from lengthy^−4=1.4(x−2.5)pass through the mean pointy^=0.5+1.4xsimplify\begin{aligned} \bar x&=2.5,\quad \bar y=4&&\text{paired-column means}\\ S_{xx}&=30-\frac{10^2}4=5&&\text{stem-length variation}\\ S_{xy}&=47-\frac{10(16)}4=7&&\text{paired variation}\\ b&=\frac75=1.4&&\text{predict area from length}\\ \widehat y-4&=1.4(x-2.5)&&\text{pass through the mean point}\\ \widehat y&=0.5+1.4x&&\text{simplify} \end{aligned}

Why this step? The known quantity will be stem length, so this model estimates the mean leaf area of plants with that length.

Answer. The yy-on-xx line is y^=0.5+1.4x\widehat y=0.5+1.4x.

Check. At x=2.5x=2.5, it gives 4=yˉ4=\bar y.

Change only the variable to be estimated, retaining the same paired observations.

Worked example 2: stem length from leaf area

Question. For the same plants, calculate the regression line of stem length on leaf area.

Plan. Use the same means and cross-product sum but divide by SyyS_{yy}, because leaf area is now the given measurement.

Syy=78−1624=14leaf-area variationb′=714=0.5gradient of x on yx^−2.5=0.5(y−4)same mean pointx^=0.5+0.5ysimplify\begin{aligned} S_{yy}&=78-\frac{16^2}4=14&&\text{leaf-area variation}\\ b'&=\frac7{14}=0.5&&\text{gradient of }x\text{ on }y\\ \widehat x-2.5&=0.5(y-4)&&\text{same mean point}\\ \widehat x&=0.5+0.5y&&\text{simplify} \end{aligned}

Why this step? Interchanging the estimated and given variables changes the denominator. The new gradient is not generally the reciprocal of the old one.

Answer. The xx-on-yy line is x^=0.5+0.5y\widehat x=0.5+0.5y.

Check. At y=4y=4, it gives 2.5=xˉ2.5=\bar x. Its gradient 0.50.5 is different from 1/1.41/1.4.

You can ask a calculator for the second fit by swapping the two paired columns, then translating its output back into an equation for xx. State the direction explicitly.

Watch out

Wrong: label an equation “xx on yy” merely because you have rearranged it to put xx on the left. Right: identify the fitted model by which variable's variation it was chosen to predict.

Calculate both directions for fresh summaries.

Choosing the line for an estimate

Start an estimation question by writing “given …, estimate …”. Choose the line with the quantity being estimated on its prediction side.

A conditional-mean estimate

The yy-on-xx model estimates the mean YY among population members with the specified XX. The xx-on-yy model estimates the mean XX among those with the specified YY. A single member can differ from that estimated mean.

The plant measurements range from 11 to 4 cm4\,\mathrm{cm} for stem length and 22 to 7 cm27\,\mathrm{cm^2} for leaf area. Check the given variable against its own observed range.

Worked example 3: given length, estimate area

Question. For the plant models

y^=0.5+1.4x,x^=0.5+0.5y\widehat y=0.5+1.4x,\qquad \widehat x=0.5+0.5y

estimate the mean leaf area for plants of stem length 3 cm3\,\mathrm{cm}.

Plan. Use the yy-on-xx line because leaf area is the quantity to estimate.

x=3given stem lengthy^=0.5+1.4(3)appropriate direction=4.7 cm2estimated mean area\begin{aligned} x&=3&&\text{given stem length}\\ \widehat y&=0.5+1.4(3)&&\text{appropriate direction}\\ &=4.7\,\mathrm{cm^2}&&\text{estimated mean area} \end{aligned}

Why this step? Fixing a stem length selects the group whose mean leaf area the first line models.

Answer. The estimated mean leaf area is 4.7 cm24.7\,\mathrm{cm^2}.

Check. The given length 3 cm3\,\mathrm{cm} is inside the observed stem-length range, so this is interpolation.

Change only which variable is given and which is estimated.

Worked example 4: given area, estimate length

Question. Use the same models to estimate mean stem length for plants of leaf area 5 cm25\,\mathrm{cm^2}.

Plan. Choose the xx-on-yy line, rather than reversing the area-on-length model.

y=5given leaf areax^=0.5+0.5(5)appropriate direction=3 cmestimated mean length\begin{aligned} y&=5&&\text{given leaf area}\\ \widehat x&=0.5+0.5(5)&&\text{appropriate direction}\\ &=3\,\mathrm{cm}&&\text{estimated mean length} \end{aligned}

Why this step? Plants with a given leaf area are a different conditional group from plants with a given stem length.

Answer. The estimated mean stem length is 3 cm3\,\mathrm{cm}.

Check. Inverting the other line would give (5−0.5)/1.4=3.21…(5-0.5)/1.4=3.21\ldots, a different and inappropriate estimate for this question.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account