Skip to contents

This function combines two twosamples objects -- concatenating bootstraps, recalculating pvalues, etc. It only works if both objects were created with "keep.boots=T" This function is intended for one main purposes: combining parallized null calculations and then plotting those combined outputs.

Usage

combine.twosamples(x, y, check.sample = T)

Arguments

x

a twosamples object

y

a different twosamples object from the same *_test function run on the same data

check.sample

check that the samples saved in each object are the same? (can be slow)

Value

a twosamples object that correctly re-calculates the p-value and determines all the other attributes

Examples

vec1 = rnorm(10)
vec2 = rnorm(10,1)
out1 = dts_test(vec1,vec2)
out2 = dts_test(vec1,vec2)
combined = combine.twosamples(out1,out2)
summary(out1)
#> DTS Test 
#> =========================
#> Test Statistic: 15.5101 
#>        P-Value: 0.00025 *
#> - - - - - - - - - - - - -
#>      n1      n2 n.boots 
#>      10      10    2000 
#> =========================
#> Test stat rejection threshold for alpha = 0.05 is: 9.571914 
#> Null rejected: samples are from different distributions
#>  Max observed bootstrap value: 14.92013 
#> No bootstrap values were more extreme than the observed value. 
#>  p-value = 1/(2*bootstraps) is an imprecise placeholder
summary(out2)
#> DTS Test 
#> =========================
#> Test Statistic: 15.5101 
#>        P-Value: 0.00025 *
#> - - - - - - - - - - - - -
#>      n1      n2 n.boots 
#>      10      10    2000 
#> =========================
#> Test stat rejection threshold for alpha = 0.05 is: 9.679014 
#> Null rejected: samples are from different distributions
#>  Max observed bootstrap value: 14.66408 
#> No bootstrap values were more extreme than the observed value. 
#>  p-value = 1/(2*bootstraps) is an imprecise placeholder
summary(combined)
#> DTS Test 
#> =========================
#> Test Statistic: 15.5101 
#>        P-Value: 0.000125 *
#> - - - - - - - - - - - - -
#>      n1      n2 n.boots 
#>      10      10    4000 
#> =========================
#> Test stat rejection threshold for alpha = 0.05 is: 9.601398 
#> Null rejected: samples are from different distributions
#>  Max observed bootstrap value: 14.92013 
#> No bootstrap values were more extreme than the observed value. 
#>  p-value = 1/(2*bootstraps) is an imprecise placeholder
plot(combined)