Description Usage Arguments Value Examples
Uses the cline parameters from your stanfit object to predict the
allele frequency (for genetic clines) or the mean phenotype value
(for phenotypic clines) at the distance(s) along the transect specified by the user.
Returns best-fit cline values estimated using both the mean of the
posterior distribution of each parameter and the median of the posterior
distribution of each parametet. Optionally, can also calculate credible
intervals around these best-fit estimates. To save computation time, this function use the
memoise
package to save past results and avoid recalculations. To clear the cache
of saved results, use clear.cache = F or clear_bahz_cache
.
1 2 | predict_cline(stanfit, distance, confidence = F, prob = 0.95,
method = "HPDI", progress = T, clear.cache = F)
|
stanfit |
A |
distance |
The x value(s) (distance along the transect) at which to predict allele frequencies or mean phenotypes for the fitted cline. Must be a numeric vector. |
confidence |
Calculate credible intervals around the cline? TRUE or FALSE, default FALSE. |
prob |
The probability interval to calculate for the cline. Default is .95. Numeric, between 0 and 1. |
method |
The method for calculating credible intervals. Either "ET" for equal-tail probability intervals, or "HPDI" for highest posterior density intervals. Default is "HPDI". |
progress |
Show progress bar when calculating credible intervals? TRUE or FALSE, default TRUE. |
clear.cache |
Clear the cache of saved results to ensure recalculation of predicted cline? TRUE or FALSE, default FALSE. |
A data frame with either 2 (confidence = F) or 4 (confidence = T) columns:
transectDist: the distances along the transect at which the cline equation was evaluated. Will be the same values as were supplied in the distance argument. Numeric.
p_mean: the predicted allele frequency or mean phenotype at each distance, using the posterior mean for each parameter of the cline equation. Numeric.
p_median: the predicted allele frequency or mean phenotype at each distance, using the posterior median for each parameter of the cline equation. Numeric.
lower: Only if confidence = T. The lower limit of the credible interval. The column name will include the probability value used for calculating the CI.
upper: Only if confidence = T. The upper limit of the credible interval. The column name will include the probability value used for calculating the CI.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
# Predict at one distance
predict_cline(yourStanfit, distance = 50)
# Predict at a range of distances
predict_cline(yourStanfit, distance = 0:100)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.