occurrenceChange.Rd
Using the data returned from occDetModel this function models a linear trend between two years for each iteration of the models. The predicted values for the two years are then used to calculates a percentage change. The results is a percentage change estimate for each of the interations of the model. This distribution of the results is used to calculate the mean estimate and the 95
occurrenceChange(firstYear, lastYear, bayesOut, change = "growthrate", region = NULL)
firstYear | numeric, the first year over which the change is to be estimated |
---|---|
lastYear | numeric, the last year over which the change is to be estimated |
bayesOut | occDet object as returned from occDetModel |
change | A character string that specifies the type of change to be calculated, the default is annual growth rate. See details for options. |
region | A character string specifying the region name if change is to be determined regional estimates of occupancy. Region names must match those in the model output. |
A list giving the mean, median, credible intervals and raw data from the estimations.
change
is used to specify which change measure to be calculated.
There are four options to choose from: difference, percentdif, growthrate and
lineargrowth.
difference
calculates the simple difference between the first and last year.
percentdif
calculates the percentage difference between the first and last year.
growthrate
calculates the annual growth rate across years.
lineargrowth
calculates the linear growth rate from a linear model.
# NOT RUN { #' # Create data n <- 15000 #size of dataset nyr <- 20 # number of years in data nSamples <- 100 # set number of dates nSites <- 50 # set number of sites # Create somes dates first <- as.Date(strptime("1980/01/01", "%Y/%m/%d")) last <- as.Date(strptime(paste(1980+(nyr-1),"/12/31", sep=''), "%Y/%m/%d")) dt <- last-first rDates <- first + (runif(nSamples)*dt) # taxa are set as random letters taxa <- sample(letters, size = n, TRUE) # three sites are visited randomly site <- sample(paste('A', 1:nSites, sep=''), size = n, TRUE) # the date of visit is selected at random from those created earlier survey <- sample(rDates, size = n, TRUE) # run the model with these data for one species results <- occDetModel(taxa = taxa, site = site, survey = survey, species_list = c('a','m','g'), write_results = FALSE, n_iterations = 1000, burnin = 10, thinning = 2) # estimate the change for one species change <- occurrenceChange(firstYear = 1990, lastYear = 1999, bayesOut = results$a) # }