GOALS
• Develop basic concepts of linear regression
• Estimating parameters and hypothesis testing with
linear models
• Linear regression in Excel/SPSS/Stata/R
Forest Mensuration and Inventory Regression Analysis 1
INTRODUCTION
• Volume functions refers to statistical models that
describe the relationship between tree volume with dbh.
• Sometimes it is combined with other variables such as
tree height or upper stem diameter.
• The volume function is used to estimate the volume of
an individual tree
Forest Mensuration and Inventory Regression Analysis 2
INTRODUCTION
• Volume functions are often developed using statistical
methods, such as regression analysis.
• Researchers collect data from sample trees, measure
their characteristics, and fit regression models to predict
volume based on those measurements.
Forest Mensuration and Inventory Regression Analysis 3
REGRESSION ANALYSIS
• Regression analysis is a statistical tool used in
determining the causal effect of one or more variables
on other variables.
• The association variable are thought to be
systematically connected by a relationship.
• The variables that are assumed to be the cause are
called predictors and variables assumed to be the effect
are called responses or target variables
Forest Mensuration and Inventory Regression Analysis 4
REGRESSION ANALYSIS
• The identified relation between these variables, is called
the regression equation. Regression equation occurs
when the target is regressed by the predictor.
• Typically, regression analysis is used for
i. Prediction (forecasting) of the target variables
ii. Modeling the relationship between the variables
Forest Mensuration and Inventory Regression Analysis 5
REGRESSION ANALYSIS
• Regression is often used in forestry to predict variables
that are difficult to measure.
• Some examples include estimations of tree height from
dbh, amount of decay from tree size or age, tree height
from ages, dbh from stump diameter in stump cruising
and merchantable tree volume from tree size (usually
dbh)
Forest Mensuration and Inventory Regression Analysis 6
RELATIONSHIPS
Forest Mensuration and Inventory Regression Analysis 7
SIMPLE LINEAR REGRESSION
• Simple linear regression involves the straight-line
relationship between two variables: the dependent
variable (or the 𝒚 variable) and the independent
variable (or the 𝒙 variable).
• The independent variable is therefore frequently
referred to as the predictor variable and the dependent
variable is referred to as the response variable.
Forest Mensuration and Inventory Regression Analysis 8
SIMPLE LINEAR REGRESSION
• Simple linear regression is used to find estimates of the
slope and intercept from sample data, using the least
square procedure. Once these estimates are obtained, we
can
i. determine how well the regression line fits the sample data
(goodness-of-fit);
ii. test whether the regression is significant;
iii. calculate confidence intervals and test hypotheses for the
true slope and intercept;
iv. calculate confidence intervals for a mean predicted 𝑦
value.
Forest Mensuration and Inventory Regression Analysis 9
SIMPLE LINEAR REGRESSION
𝒚 = 𝜷𝟎 + 𝜷𝟏 𝒙 + 𝜺
Simple 𝛽0 = Intercept
Linear
Regression 𝛽1 = Slope
𝜀 = Random error term, or residual
Forest Mensuration and Inventory Regression Analysis 10
INTERPRETATION OF THE SLOPE AND
THE INTERCEPT
• 𝛽0 is the estimated average value of 𝑦 when the value
of 𝑥 is zero
• 𝛽1 is the estimated change in the average value of 𝑦 as
a result of a one-unit change in 𝑥
Forest Mensuration and Inventory Regression Analysis 11
FINDING THE LEAST SQUARE EQUATION
• The coefficients 𝛽0 and 𝛽1 will usually be found using
computer software, such as Excel, Minitab, etc
• Other regression measures will also be computed as
part of computer based regression analysis
Forest Mensuration and Inventory Regression Analysis 12
FINDING THE LEAST SQUARE EQUATION
𝑆𝑥𝑦
𝛽1 =
𝑆𝑥𝑥
Where
SLOPE σ𝑥 σ𝑦
𝑆𝑥𝑦 = σ 𝑥𝑦 −
𝑛
σ𝑥 2
𝑆𝑥𝑥 = σ 𝑥 2 −
𝑛
Forest Mensuration and Inventory Regression Analysis 13
FINDING THE LEAST SQUARE EQUATION
𝛽0 = 𝑦ത − 𝛽1 𝑥ҧ
Where
INTERCEPT σ𝑦
𝑦ത =
𝑛
σ𝑥
𝑥ҧ =
𝑛
Forest Mensuration and Inventory Regression Analysis 14
THE ANOVA DECOMPOSITION
When fitting the simple linear regression model
𝑦ො = 𝛽መ0 + 𝛽መ1 𝑥 to a data set 𝑥𝑖 , 𝑦𝑖 for 𝑖 = 1, … , 𝑛, we
may identify three sources of variability in the responses
• variability associated to the model 𝑆𝑆𝑟𝑒𝑔
• variability of the residuals 𝑆𝑆𝑟𝑒𝑠
• total variability 𝑆𝑆𝑇
• The ANOVA decomposition states that
𝑺𝑺𝑻 = 𝑺𝑺𝒓𝒆𝒈 + 𝑺𝑺𝒓𝒆𝒔
Forest Mensuration and Inventory Regression Analysis 15
THE ANOVA DECOMPOSITION
• 𝑆𝑆𝑟𝑒𝑔 measures the variation in the responses due to
the regression model (explained by the predicted values
𝑦)
ො
• Thus, the ratio 𝑆𝑆𝑟𝑒𝑔 /𝑆𝑆𝑇 is the proportion of the
variation in the responses that is explained by the
regression model
Forest Mensuration and Inventory Regression Analysis 16
THE ANOVA DECOMPOSITION
• The ratio
2
𝑆𝑆𝑟𝑒𝑔 𝑆𝑆𝑟𝑒𝑠
𝑅 = =1 −
𝑆𝑆𝑇 𝑆𝑆𝑇
is the proportion of the variation in the responses that is
explained by the regression model.
It is known as the coefficient of determination
For example, if 𝑹𝟐 = 𝟎. 𝟖𝟖 the variable 𝑥 explains 88%
of the variation in the response variable 𝑦.
Forest Mensuration and Inventory Regression Analysis 17
THE ANOVA DECOMPOSITION
ANOVA table
Source of SS Df MS 𝑭𝒄𝒂𝒍𝒄
variation
Regression 𝑆𝑆𝑟𝑒𝑔 1 𝑀𝑆𝑟𝑒𝑔 𝑀𝑆𝑟𝑒𝑔
𝐹𝑐𝑎𝑙𝑐 =
𝑀𝑆𝑟𝑒𝑠
Residual 𝑆𝑆𝑟𝑒𝑠 𝑛−2 𝑀𝑆𝑟𝑒𝑠
Total SST 𝑛−1
Forest Mensuration and Inventory Regression Analysis 18
THE ANOVA DECOMPOSITION
2
𝑆𝑥𝑦
𝑺𝑺𝒓𝒆𝒈 𝑆𝑆𝑟𝑒𝑔 =
𝑆𝑥𝑥
2
𝑆𝑥𝑦
𝑆𝑆𝑟𝑒𝑔 = 𝑆𝑦𝑦 −
𝑆𝑥𝑥
𝑺𝑺𝒓𝒆𝒔
Where
σ𝑦 2
𝑆𝑦𝑦 = σ 𝑦 2 −
𝑛
Forest Mensuration and Inventory Regression Analysis 19
THE ANOVA DECOMPOSITION
𝑺𝑺𝑻 𝑆𝑆𝑇 = 𝑆𝑦𝑦
𝑴𝑺𝒓𝒆𝒈 𝑆𝑆𝑟𝑒𝑔
𝑀𝑆𝑟𝑒𝑔 =
1
𝑴𝑺𝒓𝒆𝒔 𝑆𝑆𝑟𝑒𝑠
𝑀𝑆𝑟𝑒𝑠 =
𝑛−2
Forest Mensuration and Inventory Regression Analysis 20
THE ANOVA DECOMPOSITION
• Hypothesis test, 𝐻0 : 𝛽1 = 0 vs 𝐻1 : 𝛽1 ≠ 0
• Consider the ratio
𝑀𝑆𝑟𝑒𝑔
𝐹=
𝑀𝑆𝑟𝑒𝑠
• Under 𝐻0 , 𝐹 follows an 𝐹1,𝑛−2 distribution
• Test at a significance level 𝛼: reject 𝐻0 if 𝐹 > 𝐹1,𝑛−2
Forest Mensuration and Inventory Regression Analysis 21
Table below shows sample of trees, selected
by sampling with probability proportional to
EXAMPLE size (PPS sampling), from the population of
trees. determine the linear relationship
between the dbh and volume. Is the
relationship significant 𝛼 = 0.05 ?
Tree 5 11 20 24 26 30 37 41
dbh (cm) 67 31 30 12 17.5 24.5 22.3 25
Volume 1.312 0.958 0.717 0.675 0.662 0.565 0.520 0.495
𝑚3
Forest Mensuration and Inventory Regression Analysis 22
Solution
• Here the independent variable (𝑥) is dbh and the
dependent variable (𝑦) is volume
𝒙 𝒚 𝒙𝟐 𝒚𝟐 𝒙𝒚
67 1.312
31 0.958
30 0.717
12 0.675
17.5 0.662
24.5 0.565
22.3 0.52
25 0.495
Forest Mensuration and Inventory Regression Analysis 23
Solution
• Here the independent variable (𝑥) is dbh and the
dependent variable (𝑦) is volume
𝒙 𝒚 𝒙𝟐 𝒚𝟐 𝒙𝒚
67 1.312 4489
31 0.958 961
30 0.717 900
12 0.675 144
17.5 0.662 306.25
24.5 0.565 600.25
22.3 0.52 497.29
25 0.495 625
Forest Mensuration and Inventory Regression Analysis 23
Solution
• Here the independent variable (𝑥) is dbh and the
dependent variable (𝑦) is volume
𝒙 𝒚 𝒙𝟐 𝒚𝟐 𝒙𝒚
67 1.312 4489 1.721344
31 0.958 961 0.917764
30 0.717 900 0.514089
12 0.675 144 0.455625
17.5 0.662 306.25 0.438244
24.5 0.565 600.25 0.319225
22.3 0.52 497.29 0.2704
25 0.495 625 0.245025
Forest Mensuration and Inventory Regression Analysis 23
Solution
• Here the independent variable (𝑥) is dbh and the
dependent variable (𝑦) is volume
𝒙 𝒚 𝒙𝟐 𝒚𝟐 𝒙𝒚
67 1.312 4489 1.721344 87.904
31 0.958 961 0.917764 29.698
30 0.717 900 0.514089 21.51
12 0.675 144 0.455625 8.1
17.5 0.662 306.25 0.438244 11.585
24.5 0.565 600.25 0.319225 13.8425
22.3 0.52 497.29 0.2704 11.596
25 0.495 625 0.245025 12.375
Forest Mensuration and Inventory Regression Analysis 23
Solution
σ 𝑥 = 229.3
σ 𝑦 = 5.904
σ 𝑥 2 = 8522.79
σ 𝑦 2 = 4.8817
σ 𝑥𝑦 = 196.6105
Forest Mensuration and Inventory Regression Analysis 24
Solution
229.3 5.904
𝑆𝑥𝑦 = 196.6105 − = 27.3871
8
229.3 2
𝑆𝑥𝑥 = 8522.79 − = 1950.4788
8
Thus
27.3871
𝛽1 =
1950.4788
= 0.014
Forest Mensuration and Inventory Regression Analysis 25
Solution
𝛽0 = 0.738 − 0.014(28.663)
= 0.336
Thus
𝑦 = 0.336 + 0.014𝑥
But 𝑦 = 𝑉𝑜𝑙𝑢𝑚𝑒 and 𝑥 = 𝑑𝑏ℎ
∴ 𝑽𝒐𝒍𝒖𝒎𝒆 = 𝟎. 𝟑𝟑𝟔 + 𝟎. 𝟎𝟏𝟒𝒅𝒃𝒉
Forest Mensuration and Inventory Regression Analysis 26
Solution
• Testing of hypothesis concerning the slope of a line
STEP 1: State the null and alternative hypotheses
𝐻0 : 𝛽1 = 0
𝐻1 : 𝛽1 ≠ 0
Forest Mensuration and Inventory Regression Analysis 27
Solution
STEP 2: Select a level of significance
Here
𝛼 = 0.05
STEP 3: identify test statistic
𝑀𝑆𝑟𝑒𝑔
𝐹=
𝑀𝑆𝑟𝑒𝑠
Forest Mensuration and Inventory Regression Analysis 28
Solution
STEP 4: Calculate the value of the test statistic
Calculating sum of squares
27.3871 2
𝑆𝑆𝑟𝑒𝑔 = = 0.385
1950.4788
𝟓.𝟗𝟎𝟒 𝟐
𝑆𝑆𝑇 = 0.525 𝑺𝒚𝒚 = 𝟒. 𝟖𝟖𝟏𝟕 −
𝟖
𝑆𝑆𝑟𝑒𝑠 = 0.525 − 0.385 = 0.140
Forest Mensuration and Inventory Regression Analysis 29
Solution
Calculating degrees of freedom
𝑑𝑓𝑟𝑒𝑔 = 1
𝑑𝑓𝑟𝑒𝑠 = 6
𝑑𝑓𝑡𝑜𝑡𝑎𝑙 = 7
Forest Mensuration and Inventory Regression Analysis 30
Solution
Calculating Mean Square
0.385
𝑀𝑆𝑟𝑒𝑔 = = 0.385
1
0.14
𝑀𝑆𝑟𝑒𝑠 = = 0.023
6
Forest Mensuration and Inventory Regression Analysis 31
Solution
The calculated 𝑭 value is
0.385
𝐹𝑐𝑎𝑙𝑐 = = 16.74
0.023
Forest Mensuration and Inventory Regression Analysis 32
Solution
The ANOVA table
Source of SS Df MS 𝑭𝒄𝒂𝒍𝒄
variation
Regression 0.385 1 0.385 16.74
Residual 0.140 6 0.023
Total 0.525 7
Forest Mensuration and Inventory Regression Analysis 33
Solution
STEP 5: Make a decision
𝐹(1,6) = 5.99
Reject the null hypothesis, since
𝐹𝑐𝑎𝑙𝑐 (16.74) > 𝐹𝑡𝑎𝑏 (5.99)
There is enough evidence to support the claim that the
there is a relationship between the independent and
dependent variables.
Forest Mensuration and Inventory Regression Analysis 34
Solution
Calculating the coefficient of determination
2
0.385
𝑅 = = 0.733
0.525
This means that 73.3% of the variation in the in volume
that is explained by the variation in dbh.
Forest Mensuration and Inventory Regression Analysis 35
REGRESSION USING EXCEL
• Data => Data Analysis => Regression
Select the input 𝑦 and 𝑥 range
Forest Mensuration and Inventory Regression Analysis 36
REGRESSION USING EXCEL
• Excel Output
Forest Mensuration and Inventory Regression Analysis 37
REGRESSION USING EXCEL
• Excel Output
Reject 𝑯𝟎
𝑷 < 𝟎. 𝟎𝟓
𝑽𝒐𝒍𝒖𝒎𝒆 = 𝟎. 𝟑𝟑𝟔 + 𝟎. 𝟎𝟏𝟒𝒅𝒃𝒉
Forest Mensuration and Inventory Regression Analysis 38
REGRESSION USING SPSS
Click Analyze
Forest Mensuration and Inventory Regression Analysis 39
REGRESSION USING SPSS
Select regression then linear
Forest Mensuration and Inventory Regression Analysis 40
REGRESSION USING SPSS
Place volume on dependent and DBH on independent,
then click ok
Forest Mensuration and Inventory Regression Analysis 41
SPSS RESULTS
Reject 𝑯𝟎
𝑷 < 𝟎. 𝟎𝟓
𝑽𝒐𝒍𝒖𝒎𝒆 = 𝟎. 𝟑𝟑𝟔 + 𝟎. 𝟎𝟏𝟒𝒅𝒃𝒉
Forest Mensuration and Inventory Regression Analysis 42
SPSS RESULTS
Coefficient of determination
Forest Mensuration and Inventory Regression Analysis 43
REGRESSION USING STATA
Command::: regress Volume DBH
STATA OUTPUT
Forest Mensuration and Inventory Regression Analysis 44
REGRESSION USING STATA
This is the p-value of the model. It tests whether 𝛽1 is different
from 0. Usually we need a 𝑝-value lower than 0.05 to show a
statistically significant relationship between independent and
Dependent variable
Forest Mensuration and Inventory Regression Analysis 45
REGRESSION USING STATA
R-square shows the amount of variance of Y explained by X. In
this case dbh explains 73.3% of the variance in volume.
Forest Mensuration and Inventory Regression Analysis 46
REGRESSION USING STATA
Adj 𝑅2 shows the same as 𝑅2 but adjusted by the number of
cases and number of variables. When the number of variables is
small and the number of cases is very large then Adj 𝑅2 is
closer to 𝑅2 . This provides a more honest association between
𝑋 and 𝑌
Forest Mensuration and Inventory Regression Analysis 47
REGRESSION USING STATA
Root MSE: root mean squared error, is the standard deviation
of the regression. The closer to zero better the fit.
Forest Mensuration and Inventory Regression Analysis 48
REGRESSION USING STATA
Two-tail p-values test the hypothesis that each coefficient is
different from 0. To reject this, the p-value has to be lower than
0.05 (you could choose also an alpha of 0.10). In this case, dbh
is statistically significant in explaining volume.
Forest Mensuration and Inventory Regression Analysis 49
REGRESSION USING STATA
The t-values test the hypothesis that the coefficient is different
from 0. To reject this, you need a t-value greater than 1.96
(for 95% confidence). You can get the t-values by dividing the
coefficient by its standard error. The t values also show the
importance of a variable in the model.
Forest Mensuration and Inventory Regression Analysis 50
REGRESSION USING STATA
𝑽𝒐𝒍𝒖𝒎𝒆 = 𝟎. 𝟑𝟔𝟔 + 𝟎. 𝟎𝟏𝟒𝒅𝒃𝒉
For each one-unit increase in dbh, volume scores increase by
0.014 unit.
Forest Mensuration and Inventory Regression Analysis 51
REGRESSION USING R
GIVEN DATA
Forest Mensuration and Inventory Regression Analysis 52
REGRESSION USING R (Output)
Forest Mensuration and Inventory Regression Analysis 53
REGRESSION USING R (Output)
𝜷𝟏 = 𝟎. 𝟎𝟒𝟑𝟖 & 𝜷𝟎 = −𝟎. 𝟓𝟓𝟒
𝑽𝒐𝒍𝒖𝒎𝒆 = 𝟎. 𝟑𝟑𝟔 + 𝟎. 𝟎𝟏𝟒𝒅𝒃𝒉
Forest Mensuration and Inventory Regression Analysis 54
REGRESSION USING R (Output)
𝑹𝟐 = 𝟎. 𝟕𝟑𝟑
Forest Mensuration and Inventory Regression Analysis 55
REGRESSION USING R (Output)
ANOVA Table
Forest Mensuration and Inventory Regression Analysis 56
SOME IMPORTANT TERMS
Forest Mensuration and Inventory Regression Analysis 57
1) REGRESSION COEFFICIENT
• Regression coefficient is a measure of how strong each
predictor variables predicts the dependent variables.
i. Unstandardized coefficient is used in the equation as
coefficients of different independent variables along with
the constant term to predict the value of dependent
variable.
ii. Standardized coefficient is, however, measured in standard
deviations. If there is just one independent variable to
predict one dependent variable, the beta value obtained
would be the same as the correlation coefficient between
the dependent and independent variables.
Forest Mensuration and Inventory Regression Analysis 58
2) R VALUES
• Regression analysis would provide you with two
different R values. A simple R value represents the
correlation between the observed values and the
predicted values of the dependent variable.
• The other R values is referred to R square, and it gives
the proportion of variance in the dependent variable
accounted for by the set of independent variable(s)
chosen for the model.
Forest Mensuration and Inventory Regression Analysis 59
2) R VALUES
• R square is used to find out how well the independent
variables are able to predict the dependent variable.
However, the R square value tends to be a bit inflated
when the number of independent variables is more or
when the number of cases is large.
• The adjusted R square takes into account these things
and gives more accurate information about the fitness of
the model. For example, R square value of 0.89 would
mean that the independent variables in the model can
predict 89% of the variation in the dependent variable.
Forest Mensuration and Inventory Regression Analysis 60