Try guessing starting parameters for model_params and model_ndvi.
model_start(DT, id = "id", year = "yr")
The input DT data.table
appended with xmidS_start
and xmidA_start
columns. Note - we curently do not attempt to guess appropriate starting values for scalS
and scalA
.
The id argument is used to split between sampling units. This may be a point id, polygon id, pixel id, etc. depending on your analysis. This should match the id provided to filtering functions.
Other model:
model_ndvi()
,
model_params()
# Load data.table
library(data.table)
# Read in example data
ndvi <- fread(system.file("extdata", "sampled-ndvi-MODIS-MOD13Q1.csv", package = "irg"))
# Filter and scale NDVI time series
filter_ndvi(ndvi)
#> id NDVI SummaryQA DayOfYear yr filtered winter rolled
#> <int> <num> <num> <int> <num> <num> <num> <num>
#> 1: 0 0.1864 3 11 2015 0.3076500 0.3076500 0.3076500
#> 2: 1 0.0541 2 3 2015 0.3163400 0.3163400 0.3163400
#> 3: 2 0.1781 3 11 2015 0.2649875 0.2649875 0.2649875
#> 4: 3 0.1024 2 5 2015 0.2301750 0.2301750 0.2301750
#> 5: 4 0.0898 2 3 2015 0.2177150 0.2177150 0.2177150
#> ---
#> 801: 2 0.1179 2 364 2019 0.2649875 0.2649875 0.2649875
#> 802: 3 0.0789 2 364 2019 0.2301750 0.2301750 0.2301750
#> 803: 4 0.1572 2 364 2019 0.2177150 0.2177150 0.2177150
#> 804: 5 0.0763 2 364 2019 0.3163400 0.3163400 0.3163400
#> 805: 6 0.1197 2 362 2019 0.3149325 0.3149325 0.3149325
#> top
#> <num>
#> 1: 0.8735000
#> 2: 0.8632175
#> 3: 0.8707500
#> 4: 0.8635525
#> 5: 0.8476000
#> ---
#> 801: 0.8707500
#> 802: 0.8635525
#> 803: 0.8476000
#> 804: 0.8632175
#> 805: 0.8632000
scale_doy(ndvi)
#> id NDVI SummaryQA DayOfYear yr filtered winter rolled
#> <int> <num> <num> <int> <num> <num> <num> <num>
#> 1: 0 0.1864 3 11 2015 0.3076500 0.3076500 0.3076500
#> 2: 1 0.0541 2 3 2015 0.3163400 0.3163400 0.3163400
#> 3: 2 0.1781 3 11 2015 0.2649875 0.2649875 0.2649875
#> 4: 3 0.1024 2 5 2015 0.2301750 0.2301750 0.2301750
#> 5: 4 0.0898 2 3 2015 0.2177150 0.2177150 0.2177150
#> ---
#> 801: 2 0.1179 2 364 2019 0.2649875 0.2649875 0.2649875
#> 802: 3 0.0789 2 364 2019 0.2301750 0.2301750 0.2301750
#> 803: 4 0.1572 2 364 2019 0.2177150 0.2177150 0.2177150
#> 804: 5 0.0763 2 364 2019 0.3163400 0.3163400 0.3163400
#> 805: 6 0.1197 2 362 2019 0.3149325 0.3149325 0.3149325
#> top t
#> <num> <num>
#> 1: 0.8735000 0.027397260
#> 2: 0.8632175 0.005479452
#> 3: 0.8707500 0.027397260
#> 4: 0.8635525 0.010958904
#> 5: 0.8476000 0.005479452
#> ---
#> 801: 0.8707500 0.994520548
#> 802: 0.8635525 0.994520548
#> 803: 0.8476000 0.994520548
#> 804: 0.8632175 0.994520548
#> 805: 0.8632000 0.989041096
scale_ndvi(ndvi)
#> id NDVI SummaryQA DayOfYear yr filtered winter rolled
#> <int> <num> <num> <int> <num> <num> <num> <num>
#> 1: 0 0.1864 3 11 2015 0.3076500 0.3076500 0.3076500
#> 2: 1 0.0541 2 3 2015 0.3163400 0.3163400 0.3163400
#> 3: 2 0.1781 3 11 2015 0.2649875 0.2649875 0.2649875
#> 4: 3 0.1024 2 5 2015 0.2301750 0.2301750 0.2301750
#> 5: 4 0.0898 2 3 2015 0.2177150 0.2177150 0.2177150
#> ---
#> 801: 2 0.1179 2 364 2019 0.2649875 0.2649875 0.2649875
#> 802: 3 0.0789 2 364 2019 0.2301750 0.2301750 0.2301750
#> 803: 4 0.1572 2 364 2019 0.2177150 0.2177150 0.2177150
#> 804: 5 0.0763 2 364 2019 0.3163400 0.3163400 0.3163400
#> 805: 6 0.1197 2 362 2019 0.3149325 0.3149325 0.3149325
#> top t scaled
#> <num> <num> <num>
#> 1: 0.8735000 0.027397260 0
#> 2: 0.8632175 0.005479452 0
#> 3: 0.8707500 0.027397260 0
#> 4: 0.8635525 0.010958904 0
#> 5: 0.8476000 0.005479452 0
#> ---
#> 801: 0.8707500 0.994520548 0
#> 802: 0.8635525 0.994520548 0
#> 803: 0.8476000 0.994520548 0
#> 804: 0.8632175 0.994520548 0
#> 805: 0.8632000 0.989041096 0
# Guess starting parameters for xmidS and xmidA
model_start(ndvi)
#> Key: <scaled>
#> id NDVI SummaryQA DayOfYear yr filtered winter rolled top
#> <int> <num> <num> <int> <num> <num> <num> <num> <num>
#> 1: 4 0.1262 3 38 2015 0.217715 0.2177150 NA 0.8476000
#> 2: 1 0.0599 2 38 2016 0.316340 0.3163400 NA 0.8632175
#> 3: 3 0.0714 2 38 2016 0.230175 0.2301750 NA 0.8635525
#> 4: 4 0.0433 2 38 2016 0.217715 0.2177150 NA 0.8476000
#> 5: 5 0.0599 2 38 2016 0.316340 0.3163400 NA 0.8632175
#> ---
#> 801: 1 0.8755 1 225 2015 0.875500 0.3163400 0.8671 0.8632175
#> 802: 2 0.8740 1 225 2015 0.874000 0.2649875 0.8732 0.8707500
#> 803: 3 0.8643 1 225 2015 0.864300 0.2301750 0.8643 0.8635525
#> 804: 5 0.8755 1 225 2015 0.875500 0.3163400 0.8671 0.8632175
#> 805: 6 0.8729 1 225 2015 0.872900 0.3149325 0.8688 0.8632000
#> t scaled xmidS_start xmidA_start
#> <num> <num> <num> <num>
#> 1: 0.1013699 NA 0.3808219 0.7808219
#> 2: 0.1013699 NA 0.3643836 0.7095890
#> 3: 0.1013699 NA 0.3643836 0.7095890
#> 4: 0.1013699 NA 0.3643836 0.7095890
#> 5: 0.1013699 NA 0.3643836 0.7095890
#> ---
#> 801: 0.6136986 1 0.4000000 0.7123288
#> 802: 0.6136986 1 0.3808219 0.7123288
#> 803: 0.6136986 1 0.3808219 0.7808219
#> 804: 0.6136986 1 0.4000000 0.7123288
#> 805: 0.6136986 1 0.3808219 0.7808219