| par_init | R Documentation |
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:
Min, MinE, MinB, PMin, PMinB, PMinE;
Max;
Begin, Peak, Flat, End;
Length, LengthB, LengthE;
Theta;
Alpha, Beta, Tau, Phi, Delta;
Alpha1, Beta1, Tau1, Phi1, Delta1;
Alpha2, Beta2, Tau2, Phi2, Delta2;
Alpha3, Beta3, Tau3, Phi3, Delta3;
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.
par_init(
data = stop("A dataset must be provided"),
fixed.parameters = NULL,
add.cofactors = NULL
)
data |
Dataset generated with add_phenology() |
fixed.parameters |
Set of fixed parameters |
add.cofactors |
Names of cofactors that will be used (see fit_phenology) |
par_init calculates initial set of parameters.
The initial set of parameters
Marc Girondot
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(),
phenology(),
phenology2fitRMU(),
phenology_MHmcmc(),
phenology_MHmcmc_p(),
plot.phenology(),
plot.phenologymap(),
plot_delta(),
plot_phi(),
print.phenology(),
print.phenologymap(),
print.phenologyout(),
remove_site(),
result_Gratiot,
result_Gratiot1,
result_Gratiot2,
result_Gratiot_Flat,
summary.phenology(),
summary.phenologymap(),
summary.phenologyout()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.