par_init: Calculate initial set of parameters.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/par_init.R

Description

This function is used to generate an initial set of parameters for fitting that is expected to be not to far from the final.
The parameters can be:

And the name of level if a cofactor is used.
The parameters Max, Min, MinE, MinB, Length, LengthB, LengthE, and Peak can be followed with _ and part of the name of the rookery.
The model for scale effect of sinusoid is: Alpha + Beta * n(t) ^ Tau where n(t) is the expected number for the day t without the sinusoid effect.

Usage

1
2
3
4
5
par_init(
  data = stop("A dataset must be provided"),
  fixed.parameters = NULL,
  add.cofactors = NULL
)

Arguments

data

Dataset generated with add_phenology()

fixed.parameters

Set of fixed parameters

add.cofactors

Names of cofactors that will be used (see fit_phenology)

Details

par_init calculates initial set of parameters.

Value

The initial set of parameters

Author(s)

Marc Girondot

See Also

Other Phenology model: AutoFitPhenology(), BE_to_LBLE(), Gratiot, LBLE_to_BE(), LBLE_to_L(), L_to_LBLE(), MarineTurtles_2002, MinBMinE_to_Min(), adapt_parameters(), add_SE(), add_phenology(), extract_result(), fit_phenology(), likelihood_phenology(), logLik.phenology(), map_Gratiot, map_phenology(), phenology2fitRMU(), phenology_MHmcmc_p(), phenology_MHmcmc(), phenology(), plot.phenologymap(), plot.phenology(), plot_delta(), plot_phi(), print.phenologymap(), print.phenologyout(), print.phenology(), remove_site(), result_Gratiot1, result_Gratiot2, result_Gratiot_Flat, result_Gratiot_mcmc, result_Gratiot, summary.phenologymap(), summary.phenologyout(), summary.phenology()

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
## Not run: 
library(phenology)
# Read a file with data
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")
# Generate initial points for the optimisation
parg <- par_init(data_Gratiot, fixed.parameters=NULL)
# Run the optimisation
result_Gratiot <- fit_phenology(data=data_Gratiot, 
		fitted.parameters=parg, fixed.parameters=NULL)
data(result_Gratiot)
# Plot the phenology and get some stats
output<-plot(result_Gratiot)

## When a series has only 0, it should be used in two steps
## Let see an example

# Let create a times series with only 0
data0 <- data.frame(Date=c("11/3/2015", "12/3/2015", "13/3/2015-18/3/2015", "25/3/2015"), 
                    Number=c(0, 0, 0, 0), 
                    Beach=rep("Site0", 4), stringsAsFactors=FALSE)
data1 <- data.frame(Date=c("15/3/2015", "16/3/2015", "20/3/2015-22/3/2015", "25/3/2015"), 
                    Number=c(1, 0, 3, 0), 
                    Beach=rep("Site1", 4), stringsAsFactors=FALSE)
data <- rbind(data0, data1)

# Here I include timeseries with no observation
try1 <- add_phenology(data, format="%d/%m/%Y", month_ref=1, include0=TRUE)
pfixed <- c(Min=0, Flat=0)
parg <- par_init(try1, fixed.parameters=pfixed)
# The Max value for the series without observations should not be fitted. The ML is for Max being 0
pfixed <- c(pfixed, parg[(substr(names(parg), 1, 4)=="Max_") & (parg == 0)])
parg <- parg[!(names(parg) %in% names(pfixed))]


## End(Not run)

phenology documentation built on Oct. 23, 2020, 7:22 p.m.