
Plot SSDtest Object
plot.SSDtest.RdPlot the object output by SSDtest.
Usage
# S3 method for class 'SSDtest'
plot(
x,
est = 1,
type = "est",
diffs = NULL,
nbins = 100,
plottitle = NULL,
groupcols = NULL,
leg = T,
legpos = NULL,
legsize = 1,
legtitle = "",
lty = "dashed",
titlesize = 2,
invert = NULL,
xlim = NULL,
ylim = NULL,
diffcol = "#CCB03D",
gridplot = TRUE,
useradvance = TRUE,
...
)Arguments
- x
An
SSDtestobject.- est
An integer specifiying the specific combination of methods (e.g., univariate method, centering algorithm) for the resampled estimates to be plotted. This integer corresponds to the row number in the table providing mean or median estimates by method combination when printing the
SSDtestobject.- type
A character string specifying the type of plot to produce.
"est"generates a plot of histograms of estimates for all of the samples inx."diff"gereates a plot of one or more histograms of all possible pairwise differences in estimates between pairs of samples, with the argumentdiffsspecifying which pairs to plot. Defaults to"est". Also, because the plotting function calculates histograms fortype="diff"by first calculating the difference between all possible pairs of one estimate taken from the two distributions of resampled values to be compared, plots usingtype="diff"can take a long time to be generated. The output ofplot.SSDtest()can be saved and plotted later without the need for recalculation.- diffs
Specifies which set of samples to plot pairwise differences for if
typeis"diff". If set to"all"it generates a single plot with all possible pairs. If given a vector of two or more integers, it plots all of the differences for that set of samples (e.g., settingdiffstoc(1,3,4)will plot three histograms: one for the differences in estimates between the first and third sample inx, one for the differences between the first and fourth sample, and one for the differences between the third and fourth sample). Any of the samples identified indiffsthat do not include data for the estimate specified inestwill not be included in pairwise comparisons (e.g., if"SSD"was included as a univariate method on a set of samples for which some had sex data and others didn't, the samples without sex data would be missing estimates for that method and thus would be excluded from pairwise comparisons of"SSD"estimates.) An error will be generated in cases where fewer then two samples with estimates are specified. Defaults to "all".- nbins
An integer specifiying the number of bins to sort data into for histograms.
- plottitle
A character string specifying a title to print at the top of the plot. If
NULL, no title is printed. Defaults toNULL.- groupcols
A vector of hexidecimal colors of length equal to the number of samples in
xfor use in plots whentypeis"est". Defaults to a palette generated byparula.- leg
A logical scalar indicating whether a legend should be provided. Defaults to
TRUE.- legpos
A character string specifying where to plot the legend. Acceptable values are
"left","top","right", and"bottom". Defaults to"right".- legsize
A numeric scalar specifying a multiplier for the legend font size relative to the default font size. Defaults to
1.- legtitle
A character string specifying a title to print at the top of the legend. If
NULL, no title is printed. Defaults toNULL.- lty
Line type for plotting observed fossil value in scenario where a single point estimate is calculated for a single fossil sample. Defaults to
"dashed".- titlesize
A numeric scalar specifying a multiplier for the title font size relative to the default font size. Defaults to
2.- invert
An integer vector specifying the group number of histograms to invert and project below the zero count line, where group number is determined by the order of datasets provided first in
fossil, then incomp. IfNULL, no histograms are inverted. Defaults toNULL.- xlim
A numeric vector with two elements specifying the minimum and maximum values of the x-axis. If
xlimisNULL, default values generated byggplotare used.- ylim
A numeric vector with two elements specifying the minimum and maximum values of the y-axis. If
ylimisNULL, default values generated byggplotare used.- diffcol
A color used to fill in histogram bars for differences in parameter values between two samples. defaults to
"#CCB03D".- gridplot
A logical scalar indicating whether the multiple plots generated by
type="diff"should be plotted as a single grid of plots or not. IfFALSEthen individual plots are printed sequentially. Defaults toTRUE.- useradvance
A logical scalar indicating whether to prompt the user between plots when multiple plots are generated by
type="diff"andgridplotisFALSE. IfFALSEthen the function waits two seconds between plots. Defaults toTRUE.- ...
Arguments to be passed to other functions. Not currently used.
Examples
SSDvars <- c("FHSI", "TPML", "TPMAP", "TPLAP", "HHMaj", "HHMin", "RHMaj", "RHMin", "RDAP", "RDML")
test_faux_multi1 <- SSDtest(
fossil=list("Fauxil sp. 1"=fauxil[fauxil$Species=="Fauxil sp. 1", SSDvars]),
comp=list("G. gorilla"=apelimbart[apelimbart$Species=="Gorilla gorilla", SSDvars],
"H. sapiens"=apelimbart[apelimbart$Species=="Homo sapiens", SSDvars],
"P. troglodytes"=apelimbart[apelimbart$Species=="Pan troglodytes", SSDvars],
"H. lar"=apelimbart[apelimbart$Species=="Hylobates lar", SSDvars]),
fossilsex=NULL,
compsex=list("G. gorilla"=apelimbart[apelimbart$Species=="Gorilla gorilla", "Sex"],
"H. sapiens"=apelimbart[apelimbart$Species=="Homo sapiens", "Sex"],
"P. troglodytes"=apelimbart[apelimbart$Species=="Pan troglodytes", "Sex"],
"H. lar"=apelimbart[apelimbart$Species=="Hylobates lar", "Sex"]),
methsUni=c("MMR", "BDI"),
methsMulti=c("GMM"),
datastruc="both",
nResamp=100,
templatevar="FHSI")
#> Warning: The number of possible combinations (9.60207663113656e+30) exceeds the user-specified limit. Monte Carlo sampling will be used.
#> Warning: The number of possible combinations (9.60207663113656e+30) exceeds the user-specified limit. Monte Carlo sampling will be used.
#> Warning: The number of possible combinations (9.60207663113656e+30) exceeds the user-specified limit. Monte Carlo sampling will be used.
#> Warning: The number of possible combinations (9.60207663113656e+30) exceeds the user-specified limit. Monte Carlo sampling will be used.
test_faux_multi1
#> SSDtest Object
#>
#> Comparative data set:
#> sample n female n male n unspecified
#> Fauxil sp. 1 0 0 16
#> G. gorilla 47 47 0
#> H. sapiens 47 47 0
#> P. troglodytes 47 47 0
#> H. lar 47 47 0
#> number of variables: 10
#> variable names: FHSI, TPML, TPMAP, TPLAP, HHMaj, HHMin, RHMaj, RHMin, RDAP, RDML
#> SSD estimate methods (univariate):
#> MMR, BDI
#> SSD estimate methods (multivariate):
#> GMM
#> Centering algorithms:
#> geometric mean
#> Multivariate sampling with complete or missing data:
#> complete and missing
#> Number of unique combinations of univariate method, multivariate method,
#> centering algorithm, and complete or missing data structure: 4
#>
#> Resampling data structure:
#> sample n resampled data sets resampling type sampling
#> Fauxil sp. 1 1 exact without replacement
#> G. gorilla 100 Monte Carlo without replacement
#> H. sapiens 100 Monte Carlo without replacement
#> P. troglodytes 100 Monte Carlo without replacement
#> H. lar 100 Monte Carlo without replacement
#> missing data resampling structure:
#> sampling individuals, then imposing missing data pattern
#> number of individuals in each resampled data set: 16
#> proportion of missing data in resampling structure: 0.775
#> other resampling parameters:
#> ratio variables (if present): natural log of ratio
#> matchvars = FALSE
#> na.rm = TRUE
#>
#> Median resampled estimates for each combination of methods:
#> methodUni methodMulti center datastructure Fauxil sp. 1 G. gorilla
#> 1 MMR GMM geomean complete NA 0.2232
#> 2 MMR GMM geomean missing 0.2251 0.1986
#> 3 BDI GMM geomean complete NA 0.2108
#> 4 BDI GMM geomean missing 0.2007 0.1771
#> H. sapiens P. troglodytes H. lar
#> 1 0.1596 0.1176 0.0836
#> 2 0.1381 0.1016 0.0725
#> 3 0.1549 0.1144 0.0816
#> 4 0.1282 0.0958 0.0656
#>
#> p-values (one-sided; null: first sample less or equally dimorphic as second sample):
#> MMR:GMM:geomean:complete MMR:GMM:geomean:missing
#> Fauxil sp. 1 - G. gorilla NA 0.1900
#> Fauxil sp. 1 - H. sapiens NA 0.0000
#> Fauxil sp. 1 - P. troglodytes NA 0.0000
#> Fauxil sp. 1 - H. lar NA 0.0000
#> G. gorilla - H. sapiens 0.0108 0.0831
#> G. gorilla - P. troglodytes 0.0000 0.0036
#> G. gorilla - H. lar 0.0000 0.0000
#> H. sapiens - P. troglodytes 0.0394 0.1156
#> H. sapiens - H. lar 0.0000 0.0039
#> P. troglodytes - H. lar 0.0183 0.0892
#> G. gorilla - Fauxil sp. 1 NA 0.8100
#> H. sapiens - Fauxil sp. 1 NA 1.0000
#> P. troglodytes - Fauxil sp. 1 NA 1.0000
#> H. lar - Fauxil sp. 1 NA 1.0000
#> H. sapiens - G. gorilla 0.9892 0.9169
#> P. troglodytes - G. gorilla 1.0000 0.9964
#> H. lar - G. gorilla 1.0000 1.0000
#> P. troglodytes - H. sapiens 0.9606 0.8844
#> H. lar - H. sapiens 1.0000 0.9961
#> H. lar - P. troglodytes 0.9817 0.9108
#> BDI:GMM:geomean:complete BDI:GMM:geomean:missing
#> Fauxil sp. 1 - G. gorilla NA 0.1800
#> Fauxil sp. 1 - H. sapiens NA 0.0000
#> Fauxil sp. 1 - P. troglodytes NA 0.0000
#> Fauxil sp. 1 - H. lar NA 0.0000
#> G. gorilla - H. sapiens 0.0185 0.0917
#> G. gorilla - P. troglodytes 0.0001 0.0052
#> G. gorilla - H. lar 0.0000 0.0000
#> H. sapiens - P. troglodytes 0.0428 0.1269
#> H. sapiens - H. lar 0.0000 0.0033
#> P. troglodytes - H. lar 0.0176 0.0906
#> G. gorilla - Fauxil sp. 1 NA 0.8200
#> H. sapiens - Fauxil sp. 1 NA 1.0000
#> P. troglodytes - Fauxil sp. 1 NA 1.0000
#> H. lar - Fauxil sp. 1 NA 1.0000
#> H. sapiens - G. gorilla 0.9815 0.9083
#> P. troglodytes - G. gorilla 0.9999 0.9948
#> H. lar - G. gorilla 1.0000 1.0000
#> P. troglodytes - H. sapiens 0.9572 0.8731
#> H. lar - H. sapiens 1.0000 0.9967
#> H. lar - P. troglodytes 0.9824 0.9094
#>
#> p-values (two-sided):
#> MMR:GMM:geomean:complete MMR:GMM:geomean:missing
#> Fauxil sp. 1 - G. gorilla NA 0.4100
#> Fauxil sp. 1 - H. sapiens NA 0.0000
#> Fauxil sp. 1 - P. troglodytes NA 0.0000
#> Fauxil sp. 1 - H. lar NA 0.0000
#> G. gorilla - H. sapiens 0.0295 0.1671
#> G. gorilla - P. troglodytes 0.0000 0.0137
#> G. gorilla - H. lar 0.0000 0.0000
#> H. sapiens - P. troglodytes 0.0768 0.2310
#> H. sapiens - H. lar 0.0000 0.0091
#> P. troglodytes - H. lar 0.0327 0.1886
#> BDI:GMM:geomean:complete BDI:GMM:geomean:missing
#> Fauxil sp. 1 - G. gorilla NA 0.3700
#> Fauxil sp. 1 - H. sapiens NA 0.0000
#> Fauxil sp. 1 - P. troglodytes NA 0.0000
#> Fauxil sp. 1 - H. lar NA 0.0000
#> G. gorilla - H. sapiens 0.0446 0.1786
#> G. gorilla - P. troglodytes 0.0001 0.0142
#> G. gorilla - H. lar 0.0000 0.0000
#> H. sapiens - P. troglodytes 0.0824 0.2557
#> H. sapiens - H. lar 0.0000 0.0137
#> P. troglodytes - H. lar 0.0320 0.1813
plot(test_faux_multi1)
speciescolors <- c("Fauxil sp. 1"="#352A87", "G. gorilla"="#EABA4B",
"H. sapiens"="#09A9C0", "P. troglodytes"="#78BE7C",
"H. lar"="#0D77DA")
# change colors of sample distributions
plot(test_faux_multi1, groupcols=speciescolors)
# plot estimates for the second methcombo (GMM and MMR)
plot(test_faux_multi1, est=2, groupcols=speciescolors)
# invert second and fourth sample distributions
plot(test_faux_multi1, est=2, groupcols=speciescolors, invert=c(2,4))
# plot distributions of differences among sample estimates for method combination 2
plot(test_faux_multi1, est=2, type="diff")
# plot differences between second and third samples
plot(test_faux_multi1, est=2, type="diff", diffs=c(2,3))