Generate data for a regular monitoring design. The counts follow a negative binomial distribution with given size parameters and the true mean mu depending on a year, period and site effect. All effects are independent from each other and have, on the log-scale, a normal distribution with zero mean and given standard deviation.
generate_data(
intercept = 2,
n_year = 24,
n_period = 6,
n_site = 20,
year_factor = FALSE,
period_factor = FALSE,
site_factor = FALSE,
trend = 0.01,
sd_rw_year = 0.1,
amplitude_period = 1,
mean_phase_period = 0,
sd_phase_period = 0.2,
sd_site = 1,
sd_rw_site = 0.02,
sd_noise = 0.01,
size = 2,
n_run = 10,
as_list = FALSE,
details = FALSE
)
The global mean on the log-scale.
The number of years.
The number of periods.
The number of sites.
Convert year to a factor.
Defaults to FALSE
.
Convert period to a factor.
Defaults to FALSE
.
Convert site to a factor.
Defaults to FALSE
.
The long-term linear trend on the log-scale.
The standard deviation of the year effects on the log-scale.
The amplitude of the periodic effect on the log-scale.
The mean of the phase of the periodic effect among
years.
Defaults to 0
.
The standard deviation of the phase of the periodic effect among years.
The standard deviation of the site effects on the log-scale.
The standard deviation of the random walk along year per site on the log-scale.
The standard deviation of the noise effects on the log-scale.
The size parameter of the negative binomial distribution.
The number of runs with the same mu.
Return the dataset as a list rather than a data.frame.
Defaults to FALSE
.
Add variables containing the year, period and site effects.
Defaults tot FALSE
.
A data.frame
with five variables.
Year
, Month
and Site
are factors identifying the location and time of
monitoring.
Mu
is the true mean of the negative binomial distribution in the original
scale.
Count
are the simulated counts.