Growth of orange trees

Spezialisation in Data - Course 'Developing Data Products'

Alfred Neumann

Introduction.

The Orange data frame has 35 rows and 3 columns of records of the growth of orange trees. See more in slide 'Overwiew'.

Details

This dataset was originally part of package nlme.

The goal of this application was to create an interactive graph. In the shiny-application the user can look in the observations in the data set, plotting single trees and make a prediction on circumference with two linear models.

Overview of the data set

  • Tree - an ordered factor indicating the tree on which the measurement is made. The ordering is according to increasing maximum diameter.

  • age - a numeric vector giving the age of the tree (days since 1968/12/31)

  • circumference - a numeric vector of trunk circumferences (mm). This is probably “circumference at breast height”, a standard measurement in forestry.

##   Tree  age circumference
## 1    1  118            30
## 2    1  484            58
## 3    1  664            87
## 4    1 1004           115
## 5    1 1231           120
## 6    1 1372           142
## 7    1 1582           145
## 8    2  118            33

Run the different models

Coeffs: linear regression model

lm1 <- lm(circumference ~ age, data = Orange)
##               Estimate  Std. Error   t value     Pr(>|t|)
## (Intercept) 17.3996502 8.622659801  2.017898 5.179267e-02
## age          0.1067703 0.008276623 12.900228 1.930596e-14

Coeffs: nonlinear mixed-effects model

fm1 <- nls(circumference ~ SSlogis(age, Asym, xmid, scal), data = Orange)
##      Estimate Std. Error  t value     Pr(>|t|)
## Asym 192.6872   20.24389 9.518290 7.480352e-11
## xmid 728.7544  107.29723 6.791922 1.119989e-07
## scal 353.5320   81.47133 4.339342 1.338124e-04

Plot and Prediction

The plot shows the growth of the trees versus age. The blue and the red line show the predicted circumference provided by the different models.

plot of chunk unnamed-chunk-6

App and interaction

The screenshot shows the options for interaction. It allows to see how the single or all observation is predicted in different models.