Undertakes paired comparisons for ranking a set of coefficients, considering whether the differences between the coefficients are significant or not.
Source:R/rankr.R
rankr.Rd
The index numbers are based on the model coefficient table that comes straight out of the model, with no sorting.
The function will return a dataframe with the results for each pair of coeeficients tested.
Examples
songstobecompared <- summary %>% slice(seq(from=1, to=92, by=10))
mycomparisons <- rankr(coeftable = results_ml_Repeatr4, vcovmat = vcovmat_ml_Repeatr4, mysongidlist = songstobecompared)
#>
#>
#> First coefficient: 3.15285955038943
#>
#> Second coefficient: 0.555120665803103
#>
#> Difference to be tested: 2.59773888458633
#>
#> Variance of the first coefficient: 0.528235277021886
#>
#> Variance of the second coefficient: 0.0124891074988492
#>
#> Covariance of the two coefficients: 0.0016387992505919
#>
#> Z-statistic: 3.54346184000307
#>
#> P-statistic: 1.99960508954257
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: 1.16084794468424
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: 4.03462982448841
#>
#>
#>
#> First coefficient: 0.555120665803103
#>
#> Second coefficient: 3.01364584438071
#>
#> Difference to be tested: -2.45852517857761
#>
#> Variance of the first coefficient: 0.0124891074988492
#>
#> Variance of the second coefficient: 0.0046794363459201
#>
#> Covariance of the two coefficients: 0.00169180892121045
#>
#> Z-statistic: -20.9397957326797
#>
#> P-statistic: 2.32453677314718e-97
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: -2.68864725863648
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: -2.22840309851874
#>
#>
#>
#> First coefficient: 3.01364584438071
#>
#> Second coefficient: 1.57142606368516
#>
#> Difference to be tested: 1.44221978069556
#>
#> Variance of the first coefficient: 0.0046794363459201
#>
#> Variance of the second coefficient: 0.0494846260902958
#>
#> Covariance of the two coefficients: 0.00406706571721051
#>
#> Z-statistic: 6.72219777632961
#>
#> P-statistic: 1.9999999999821
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: 1.02170987244547
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: 1.86272968894564
#>
#>
#>
#> First coefficient: 1.57142606368516
#>
#> Second coefficient: 1.78113997761282
#>
#> Difference to be tested: -0.209713913927663
#>
#> Variance of the first coefficient: 0.0494846260902958
#>
#> Variance of the second coefficient: 0.0444326554597425
#>
#> Covariance of the two coefficients: 0.0206092237692128
#>
#> Z-statistic: -0.913538263500862
#>
#> P-statistic: 0.360959518980729
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: -0.659655955460804
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: 0.240228127605479
#>
#>
#>
#> First coefficient: 1.78113997761282
#>
#> Second coefficient: 3.43844353752172
#>
#> Difference to be tested: -1.6573035599089
#>
#> Variance of the first coefficient: 0.0444326554597425
#>
#> Variance of the second coefficient: 0.00569784656156396
#>
#> Covariance of the two coefficients: 0.00404870824434851
#>
#> Z-statistic: -8.08363000894842
#>
#> P-statistic: 6.28668689849565e-16
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: -2.05914221083993
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: -1.25546490897787
#>
#>
#>
#> First coefficient: 3.43844353752172
#>
#> Second coefficient: 2.20118808768675
#>
#> Difference to be tested: 1.23725544983497
#>
#> Variance of the first coefficient: 0.00569784656156396
#>
#> Variance of the second coefficient: 0.00389868718892827
#>
#> Covariance of the two coefficients: 0.0017020834387324
#>
#> Z-statistic: 15.7228414911654
#>
#> P-statistic: 2
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: 1.08301992675607
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: 1.39149097291387
#>
#>
#>
#> First coefficient: 2.20118808768675
#>
#> Second coefficient: 2.53503356536439
#>
#> Difference to be tested: -0.333845477677635
#>
#> Variance of the first coefficient: 0.00389868718892827
#>
#> Variance of the second coefficient: 0.0107625693703899
#>
#> Covariance of the two coefficients: 0.00171381562879152
#>
#> Z-statistic: -3.14981850887597
#>
#> P-statistic: 0.00163371918183443
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: -0.54158352175995
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: -0.126107433595321
#>
#>
#>
#> First coefficient: 2.53503356536439
#>
#> Second coefficient: 2.66480595212762
#>
#> Difference to be tested: -0.129772386763238
#>
#> Variance of the first coefficient: 0.0107625693703899
#>
#> Variance of the second coefficient: 0.057980060154878
#>
#> Covariance of the two coefficients: 0.00797617930683449
#>
#> Z-statistic: -0.564813861944394
#>
#> P-statistic: 0.572200377454558
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: -0.580104602726074
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: 0.320559829199598
#>
#>
#>
#> First coefficient: 2.66480595212762
#>
#> Second coefficient: -1.0811282484424
#>
#> Difference to be tested: 3.74593420057003
#>
#> Variance of the first coefficient: 0.057980060154878
#>
#> Variance of the second coefficient: 0.0804502488495918
#>
#> Covariance of the two coefficients: 0.0163387855450476
#>
#> Z-statistic: 11.5189882292715
#>
#> P-statistic: 2
#>
#> Lower boundary of 95% confidence interval of the difference between the two coefficients: 3.10854913801219
#>
#> Upper boundary of 95% confidence interval of the difference between the two coefficients: 4.38331926312787
#>
#>
#> Joining with `by = join_by(songid1)`
#> Joining with `by = join_by(songid2)`
mycomparisons
#> song1 song2 mycoef1 mycoef2 mycoefdiff
#> 1 waiting room provisional 3.1528596 0.5551207 2.5977389
#> 2 provisional blueprint 0.5551207 3.0136458 -2.4585252
#> 3 blueprint stacks 3.0136458 1.5714261 1.4422198
#> 4 stacks returning the screw 1.5714261 1.7811400 -0.2097139
#> 5 returning the screw do you like me 1.7811400 3.4384435 -1.6573036
#> 6 do you like me back to base 3.4384435 2.2011881 1.2372554
#> 7 back to base floating boy 2.2011881 2.5350336 -0.3338455
#> 8 floating boy the kill 2.5350336 2.6648060 -0.1297724
#> 9 the kill turn off your guns 2.6648060 -1.0811282 3.7459342
#> myz myp lower95ci upper95ci
#> 1 3.5434618 1.999605e+00 1.1608479 4.0346298
#> 2 -20.9397957 2.324537e-97 -2.6886473 -2.2284031
#> 3 6.7221978 2.000000e+00 1.0217099 1.8627297
#> 4 -0.9135383 3.609595e-01 -0.6596560 0.2402281
#> 5 -8.0836300 6.286687e-16 -2.0591422 -1.2554649
#> 6 15.7228415 2.000000e+00 1.0830199 1.3914910
#> 7 -3.1498185 1.633719e-03 -0.5415835 -0.1261074
#> 8 -0.5648139 5.722004e-01 -0.5801046 0.3205598
#> 9 11.5189882 2.000000e+00 3.1085491 4.3833193