FBD_tests1 {EvoPhylo} | R Documentation |
Test assumptions of normality and homoscedasticity for FBD posterior parameters
Description
Produces tests of normality (within time bin, ignoring time bin, and pooling within-time bin values) and homoscedasticity (homogeneity of variances) for each fossilized birth–death process (FBD) parameter in the posterior parameter log file.
Usage
FBD_tests1(posterior, downsample = TRUE)
Arguments
posterior |
A data frame of posterior parameter estimates containing a single "Time_bin" column and one column for each FBD parameter value. Such data frame can be imported using |
downsample |
Whether to downsample the observations to ensure Shapiro-Wilk normality tests can be run. If |
Details
FBD_tests1()
performs several tests on the posterior distributions of parameter values within and across time bins. It produces the Shapiro-Wilk test for normality using shapiro.test
and the Bartlett and Fligner tests for homogeneity of variance using bartlett.test
and fligner.test
, respectively. Note that these tests are likely to be significant even if the observations are approximately normally distributed or have approximately equal variance; therefore, they should be supplemented with visual inspection using FBD_normality_plot
.
Value
A list containing the results of the three tests with the following elements:
shapiro |
A list with an element for each parameter. Each element is a data frame with a row for each time bin and the test statistic and p-value for the Shapiro-Wilk test for normality. In addition, there will be a row for an overall test, combining all observations ignoring time bin, and a test of the residuals, which combines the group-mean-centered observations (equivalent to the residuals in a regression of the parameter on time bin). |
bartlett |
A data frame of the Bartlett test for homogeneity of variance across time bins with a row for each parameter and the test statistic and p-value for the test. |
fligner |
A data frame of the Fligner test for homogeneity of variance across time bins with a row for each parameter and the test statistic and p-value for the test. |
See Also
vignette("fbd-params")
for the use of this function as part of an analysis pipeline.
combine_log
for producing a single data set of parameter posterior samples from individual parameter log files.
FBD_reshape
for converting posterior parameter table from wide to long format.
FBD_normality_plot
for visual assessments.
FBD_tests2
for tests of differences between parameter means.
shapiro.test
, bartlett.test
, and fligner.test
for the statistical tests used.
Examples
# See vignette("fbd-params") for how to use this
# function as part of an analysis pipeline
data("posterior3p")
posterior3p_long <- FBD_reshape(posterior3p)
FBD_tests1(posterior3p_long)