v_curve: v_curve

Description Usage Arguments Examples

View source: R/smooth_wWHIT_lambda.R

Description

V-curve is used to optimize Whittaker parameter lambda. Update 20180605 add weights updating to whittaker lambda selecting

Usage

1
v_curve(INPUT, lg_lambdas, d = 2, IsPlot = FALSE, wFUN = wTSM, iters = 2)

Arguments

INPUT

A list object with the elements of t, y, w, Tn (optional) and ylu, returned by check_input().

lg_lambdas

lg lambda vectors of Whittaker parameter.

d

Difference order.

IsPlot

Boolean. Whether to plot figure?

wFUN

weights updating function, can be one of wTSM(), wChen(), wBisquare() and wSELF().

iters

How many times curve fitting is implemented.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(phenofit)
data("MOD13A1")

dt <- tidy_MOD13.gee(MOD13A1$dt)
st <- MOD13A1$st

sitename <- dt$site[1]
d     <- dt[site == sitename, ] # get the first site data
sp    <- st[site == sitename, ] # station point
# global parameter
IsPlot = TRUE
nptperyear = 23

dnew     <- add_HeadTail(d, nptperyear = nptperyear) # add one year in head and tail
INPUT    <- check_input(dnew$t, dnew$y, dnew$w, nptperyear, 
                        maxgap = nptperyear/4, alpha = 0.02, wmin = 0.2)
# INPUT$y0 <- dnew$y   # raw time-series, for visualization

lg_lambdas <- seq(0, 3, 0.1)
r <- v_curve(INPUT, lg_lambdas, d = 2, IsPlot = TRUE)

phenofit documentation built on April 2, 2020, 5:07 p.m.