# logisLateDicr

## 1. Package loading

    library(phenolocrop)

## 2. Data

The data frame should include the columns of the objective trait and time point. In the example rice CH data, date column is for the measuring date, height is for CH (m), id is for the cultivar id, and x is for the days after sowing. The following CH time-series data was generated by the computer simulation.

    riceCH_eg
    #>          date    height        id   x
    #> 1  2019-06-05 0.1275410 cultivar1  49
    #> 2  2019-06-14 0.2143106 cultivar1  58
    #> 3  2019-06-21 0.3069144 cultivar1  65
    #> 4  2019-06-26 0.3874088 cultivar1  70
    #> 5  2019-07-03 0.4849813 cultivar1  77
    #> 6  2019-07-10 0.6100122 cultivar1  84
    #> 7  2019-07-17 0.7103914 cultivar1  91
    #> 8  2019-07-24 0.7856967 cultivar1  98
    #> 9  2019-08-02 0.8600938 cultivar1 107
    #> 10 2019-08-07 0.8780389 cultivar1 112
    #> 11 2019-08-14 0.9104030 cultivar1 119
    #> 12 2019-08-21 0.9289210 cultivar1 126
    #> 13 2019-08-27 0.9318912 cultivar1 132
    #> 14 2019-09-06 0.8451451 cultivar1 142
    #> 15 2019-09-12 0.7648677 cultivar1 148
    #> 16 2019-09-20 0.5972365 cultivar1 156

## 3. Estimate model parameters

    riceCH_eg |>
      logisLateDicr("x", "height")
    #>            K           d0            r            a           d1
    #> 9.318912e-01 7.492854e+01 7.387491e-02 3.319686e-04 1.250000e+02

## 4. Plot time-series model and measured CH data

    x_vec <- 1:max(riceCH_eg$x)
    y <- riceCH_eg |>
      logisLateDicr("x", "height") |>
      phenololine(x = x_vec, method = "logisLateDicr")
    plot(x_vec, y, type = "l", ylab = "rice CH", xlab = "Dayes after sowing")
    points(riceCH_eg$x, riceCH_eg$height)

## 5. Time-series model

Time-series model of `logisLateDicr` for the rice CH is as the following.

\[ \mathrm{CH}= \begin{cases} \frac{K}{1+\mathrm{exp}(r(d_0-x))} & (x\le d_1)\\ \frac{K}{1+\mathrm{exp}(r(d_0-x))}-a(x-d_1)^2 & (x>d_1) \end{cases} \]

## 6. Reference

S. Taniguchi et al., (2022) Prediction of heading date, culm length, and biomass from canopy-height-related parameters derived from time-series UAV observations of rice. Frontiers in Plant Science, 13:998803.