Shift sinusoid information.

Share:

Description

This function is used to shift sinusoid parameters from ”, '1' or '2'.

Usage

1
shift_sinusoid(parameters = NULL, from = "", to = "1", help = FALSE)

Arguments

parameters

set of parameters

from

The number of series to change

to

The number of series to change

help

If TRUE, an help is displayed

Details

shift_sinusoid shift sinusoid information.

Value

Return a set of modified parameters

Author(s)

Marc Girondot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Read a file with data
library("phenology")
## Not run: 
Gratiot<-read.delim("http://max2.ese.u-psud.fr/epc/conservation/BI/Complete.txt", header=FALSE)

## End(Not run)
data(Gratiot)
# Generate a formatted list nammed data_Gratiot 
data_Gratiot<-add_phenology(Gratiot, name="Complete", 
		reference=as.Date("2001-01-01"), format="%d/%m/%Y")
# Fix parameter FLat to 0
pfixed=c(Flat=0)
# Generate initial points for the optimisation
parg<-par_init(data_Gratiot, parametersfixed=pfixed)
# Fit is done
## Not run: 
result_Gratiot_Flat<-fit_phenology(data=data_Gratiot, 
		parametersfit=parg, parametersfixed=pfixed, trace=1)

## End(Not run)
data(result_Gratiot_Flat)
parg<-extract_result(result_Gratiot_Flat)
# Add data for one sinusoid superimposed 
# [day d amplitude=(Alpha+Nd*Beta)^Tau with Nd being the number of counts for day d]
parg<-c(parg, Alpha=0.5, Beta=0.8, Delta=3, Phi=15)
# Tau is fixed to 1
pfixed=c(Flat=0, Tau=1)
# Run the optimisation
## Not run: 
result_Gratiot1<-fit_phenology(data=data_Gratiot, 
		parametersfit=parg, parametersfixed=pfixed, trace=1)
# Plot the phenology
output1<-plot(result_Gratiot1, moon=TRUE)
#' 
## End(Not run)
data(result_Gratiot1)
# Extract the fitted parameters
parg1<-extract_result(result_Gratiot1)
# Shift sunusoid information to the '1'
parg2<-shift_sinusoid(parameters=parg1, from="", to="1")
# Tau is fixed to 1
pfixed=c(Flat=0, Tau1=1, Tau=1)
# Add data for another sinusoid superimposed 
# [day d amplitude=(Alpha+Nd*Beta)^Tau with Nd being the number of counts for day d]
parg<-c(parg2, Alpha=0.5, Beta=0.8, Delta=3, Phi=10)
# Run the optimisation
## Not run: 
result_Gratiot2<-fit_phenology(data=data_Gratiot, 
		parametersfit=parg, parametersfixed=pfixed, trace=1)
# Plot the phenology
output2<-plot(result_Gratiot2, moon=TRUE)

## End(Not run)
data(result_Gratiot2)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.