Height- diameter model in R (h-dbh)
sorry: |
This section is still under construction! This article was last modified on 04/21/2015. If you have comments please use the Discussion page or contribute to the article! |
Regression: h - dbh models
Height was only measured in 6 trees per plot, and therefore a model is needed to estimate the height of the trees whose height was not measured. Model building requires the application of regression techniques, which evaluates the relationship between two variables (h and dbh in this case) according to a given function. Only linear (or linearized) models are considered in this lab, but non-linear relationships can also be modelled by regression. In this section, we will consruct a h-dbh model by follow the following steps:
- Check the shape of the relationship between h (dependent variable) and dbh (independent
variable) for the two plot designs, in order to decide whether a unique model describes properly the data.
- Construct the database necessary for the regression analysis.
- Fit the candidate models.
- Make a decision on the best model.
3.1 Evaluating the relationships among the variables
First, we set the working directory to the folder where the files \fixed.csv" and \nested.csv" are.
setwd("c:/.../Labs Resource Asessment Ecosystems/")
Then, the two files are imported and assigned to two objects named fix and nest. The first six records of each one of the dataframes are shown by using the head() function.
fix <- read.csv("fixed.csv") head(fix) ## Tree.No. dbh h Az HD Species ## 1 1 16.5 NA 390 5.0 Picea abies ## 2 2 25.3 NA 30 2.9 Picea abies ## 3 3 22.1 NA 30 6.7 Picea abies ## 4 4 17.2 NA 45 5.2 Picea abies ## 5 5 16.1 NA 63 6.8 Picea abies ## 6 6 8.2 NA 80 4.1 Picea abies nest <- read.csv("nested.csv") head(nest) ## Tree.No. dbh h Az HD Species ## 1 1 52.0 21.0 1 5.5 maple ## 2 2 40.0 23.8 360 4.9 maple ## 3 3 28.8 NA 351 5.4 ## 4 4 20.8 NA 351 8.5 ## 5 5 66.5 NA 340 10.5 ## 6 6 60.4 26.0 329 12.1 beech
The h - dbh scatterplot is represented by using the following code, where the plot() function represents the dbh (x-coordinate) and h (y-coordinate) for the fixed area plot. The points() function represents the points of the nested plot over the last figure, and the legend() function includes the legend in the figure.
plot(fix$dbh, fix$h, ylim=c(0,34), xlim=c(0,65),xlab="dbh (cm)",ylab="Height (m)") points(nest$dbh, nest$h, col=2) legend(10,30, legend=c("Fixed", "Nested"), col=c(1,2), pch=c(1,1))
Figure 1: Height-dbh relationship in the �xed area plot and in the nested plot.