The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

VizTest: Using the sig_diffs Template

William Poirier

Western University
wpoirier@uwo.ca

David A. Armstrong

Western University
dave.armstrong@uwo.ca

2025-03-10

The viztest() function in the VizTest pacakge will calculate all pairwise tests using normal theory tests (potentially adjusted for multiplicity if the user elects to do so). We imagine there are use cases where users derive the significance of differences using some procedure that is not anticipated by the workflow in the package. We give users who do this the option to input a vector indicating which pairs are significantly different with the sig_diffs argument. This gets somewhat complex, though, so we walk through an example below. Consider the following regression model:

#> 
#> Call:
#> lm(formula = Petal.Width ~ Species, data = iris)
#> 
#> Residuals:
#>    Min     1Q Median     3Q    Max 
#> -0.626 -0.126 -0.026  0.154  0.474 
#> 
#> Coefficients:
#>                   Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)        0.24600    0.02894    8.50 1.96e-14 ***
#> Speciesversicolor  1.08000    0.04093   26.39  < 2e-16 ***
#> Speciesvirginica   1.78000    0.04093   43.49  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.2047 on 147 degrees of freedom
#> Multiple R-squared:  0.9289, Adjusted R-squared:  0.9279 
#> F-statistic:   960 on 2 and 147 DF,  p-value: < 2.2e-16
#> 
#>     Species Estimate Std. Error    z Pr(>|z|)    S 0.0 % 100.0 %
#>  setosa        0.246     0.0289  8.5   <0.001 55.5 0.133   0.359
#>  versicolor    1.326     0.0289 45.8   <0.001  Inf 1.213   1.439
#>  virginica     2.026     0.0289 70.0   <0.001  Inf 1.913   2.139
#> 
#> Type: response

Let’s imagine, for the sake of argument that we had a different way of identifying whether there are significant differences between the estimates presented above. We could use make_diff_template() to create a template for inputting these differences. Note that this also taked include_intercept and include_zero logical arguments that must be the same as the ones you will specify in viztest(). Let’see how it works. The first thing we need to do is make a vector of the estimates and apply the appropriate names:

Next, we give that vector to make_diff_template().

#>   Larger  Smaller
#> 1    30+    20-29
#> 2    30+    10-19
#> 3    30+ 0-9g/day
#> 4  20-29    10-19
#> 5  20-29 0-9g/day
#> 6  10-19 0-9g/day

At this point, we could make a vector of zeros and ones indicating whether there is a significant difference between the two stimuli.

You could add that to the template and print it to ensure you did it right.

#>   Larger  Smaller sig
#> 1    30+    20-29   1
#> 2    30+    10-19   1
#> 3    30+ 0-9g/day   1
#> 4  20-29    10-19   0
#> 5  20-29 0-9g/day   0
#> 6  10-19 0-9g/day   0

Alternatively, you could export tmpl to a CSV file or similar, input by hand the significant differences and read the completed file back in. You would then use the vector of zeros and ones from the imported CSV file as the sig_diffs argument to viztest().

If everything looks alright, you can use this in the viztest() function:

#> 
#> Correspondents of PW Tests with CI Tests
#>   level psame pdiff        easy  method
#> 1  0.78     1   0.5 -0.06401344  Lowest
#> 2  0.87     1   0.5 -0.02784027  Middle
#> 3  0.96     1   0.5 -0.03875646 Highest
#> 4  0.92     1   0.5 -0.00135610 Easiest
#> 
#> All  6  tests properly represented for by CI overlaps.

What we see is that any confidence level between \(78\%\) and \(96\%\) will have (non-)overlaps that correspond with the pairwise differences we specified. Just so you can see this is different, let’s do it without the sig_diffs argument:

#> 
#> Correspondents of PW Tests with CI Tests
#>   level psame pdiff        easy  method
#> 1  0.78     1   0.5 -0.06401344  Lowest
#> 2  0.87     1   0.5 -0.02784027  Middle
#> 3  0.96     1   0.5 -0.03875646 Highest
#> 4  0.92     1   0.5 -0.00135610 Easiest
#> 
#> All  6  tests properly represented for by CI overlaps.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.