DBRVSTATDIFF(1)
π NAME π
dbrvstatdiff β ok so this lil icon literally evaluates statistical differences between two random variables π«Ά
(also hi, this is DBRVSTATDIFF(1), from the User Contributed Perl Documentation corner of the manual-verse, section 1, mwah β¨)
β¨ SYNOPSIS β¨
Bestie, you got two whole flavors:
dbrvstatdiff [-f format] [-c ConfRating]
[-h HypothesizedDifference] m1c sd1c n1c m2c sd2c n2c
OR
dbrvstatdiff [-f format] [-c ConfRating] m1c n1c m2c n2c
π DESCRIPTION π
It produces statistics on the difference of sets of random variables. And if you hand it a hypothesized difference (that's the -h moment π
), it goes and does a Student's t-test. Periodt.
Random variables get specified by these cuties:
m1c,m2cβ the column names of the means of the random variables.sd1c,sd2cβ the column names of the standard deviations of the random variables.n1c,n2cβ counts of the number of samples for each random variable.
These values can be computed with dbcolstats, iykyk π§
It creates up to ten new columns:
diffβ the difference of RV 2 - RV 1.diff_pctβ the percentage difference (RV2-RV1)/1diff_conf_{half,low,high}anddiff_conf_pct_{half,low,high}β the half half confidence intervals and the low and high values for absolute and relative confidence.t_testβ the T-test value for the given hypothesized difference.t_test_resultβ given the confidence rating, does the test pass? Will be eitherrejectedornot-rejected.t_test_breakβ the hypothesized value that is the break-even point for the T-test.t_test_break_pctβ the break-even point as a percent ofm1c.
Heads up bestie π«Ά confidence intervals are not printed if standard deviations are not provided, and confidence intervals assume normal distributions with common variances. No cap.
T-tests are only computed if a hypothesized difference is provided. Hypothesized differences should be proceeded by <=, >=, =. T-tests assume normal distributions with common variances. π (yes, assumptions, we love a conditional queen)
π OPTIONS π
-cFRACTION or--confidenceFRACTION β specify FRACTION for the confidence interval. Defaults to0.95for a 95% confidence factor (alpha = 0.05). π-fFORMAT or--formatFORMAT β specify aprintf(3)-style format for output statistics. Defaults to"%.5g". slay β¨-hDIFF or--hypothesisDIFF β specify the hypothesized difference as DIFF, where DIFF is something like<=0or>=0, etc. π
This module also supports the standard fsdb options, bestie:
-dβ enable debugging output.-ior--inputInputSource β read from InputSource, typically a file name, or"-"for standard input, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.-oor--outputOutputDestination β write to OutputDestination, typically a file name, or"-"for standard output, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.--autorunor--noautorunβ by default, programs process automatically, butFsdb::Filterobjects in Perl do not run until you invoke therun()method. The--(no)autorunoption controls that behavior within Perl. π--helpβ show help. π«Ά--manβ show full manual. π
πΈ SAMPLE USAGE πΈ
Input:
#fsdb title mean2 stddev2 n2 mean1 stddev1 n1
example6.12 0.17 0.0020 5 0.22 0.0010 4
Command:
cat data.fsdb | dbrvstatdiff mean2 stddev2 n2 mean1 stddev1 n1
Output:
#fsdb title mean2 stddev2 n2 mean1 stddev1 n1 diff:d diff_pct:d diff_conf_half:d diff_conf_low:d diff_conf_high:d diff_conf_pct_half:d diff_conf_pct_low:d diff_conf_pct_high:d
example6.12 0.17 0.0020 5 0.22 0.0010 4 0.05 29.412 0.0026138 0.047386 0.052614 1.5375 27.874 30.949
# | dbrvstatdiff mean2 stddev2 n2 mean1 stddev1 n1
Input 2:
(example 7.10 from Scheaffer and McClave, iconic source material π):
#fsdb title x2 sd2 n2 x1 sd1 n1
example7.10 9 35.22 24.44 9 31.56 20.03
Command 2:
dbrvstatdiff -h '<=0' x2 sd2 n2 x1 sd1 n1
Output 2:
#fsdb title n1 x1 sd1 n2 x2 sd2 diff diff_pct diff_conf_half diff_conf_low diff_conf_high diff_conf_pct_half diff_conf_pct_low diff_conf_pct_high t_test t_test_result
example7.10 9 35.22 24.44 9 31.56 20.03 3.66 0.11597 4.7125 -1.0525 8.3725 0.14932 -0.033348 0.26529 1.6465 not-rejected
# | /global/us/edu/ucla/cs/ficus/users/johnh/BIN/DB/dbrvstatdiff -h <=0 x2 sd2 n2 x1 sd1 n1
Case 3:
A common use case is to have one file with a set of trials from two experiments, and to use dbrvstatdiff to see if they are different. π¦
Input 3:
#fsdb case trial value
a 1 1
a 2 1.1
a 3 0.9
a 4 1
a 5 1.1
b 1 2
b 2 2.1
b 3 1.9
b 4 2
b 5 1.9
Command 3:
cat two_trial.fsdb |
dbmultistats -k case value |
dbcolcopylast mean stddev n |
dbrow '_case eq "b"' |
dbrvstatdiff -h '=0' mean stddev n copylast_mean copylast_stddev copylast_n |
dblistize
Output 3:
#fsdb -R C case mean stddev pct_rsd conf_range conf_low conf_high conf_pct sum sum_squared min max n copylast_mean copylast_stddev copylast_n diff diff_pct diff_conf_half diff_conf_low diff_conf_high diff_conf_pct_half diff_conf_pct_low diff_conf_pct_high t_test t_test_result t_test_break t_test_break_pct
case: b
mean: 1.98
stddev: 0.083666
pct_rsd: 4.2256
conf_range: 0.10387
conf_low: 1.8761
conf_high: 2.0839
conf_pct: 0.95
sum: 9.9
sum_squared: 19.63
min: 1.9
max: 2.1
n: 5
copylast_mean: 1.02
copylast_stddev: 0.083666
copylast_n: 5
diff: -0.96
diff_pct: -48.485
diff_conf_half: 0.12202
diff_conf_low: -1.082
diff_conf_high: -0.83798
diff_conf_pct_half: 6.1627
diff_conf_pct_low: -54.648
diff_conf_pct_high: -42.322
t_test: -18.142
t_test_result: rejected
t_test_break: -1.082
t_test_break_pct: -54.648
# | dbmultistats -k case value
# | dbcolcopylast mean stddev n
# | dbrow _case eq "b"
# | dbrvstatdiff -h =0 mean stddev n copylast_mean copylast_stddev copylast_n
# | dbfilealter -R C
(So one cannot say that they are statistically equal. π the math said no)
π¦ SEE ALSO π¦
Fsdb, dbcolstats, dbcolcopylast, dbcolscorrelate. go read those next bestie, they're the whole friend group π
π AUTHOR and COPYRIGHT π
Copyright (C) 1991-2021 by John Heidemann <johnh@isi.edu>
This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details. π
and that's the whole vibe check, bestie π this was perl v5.32.1, dated 2024-08-02, brought to you by the DBRVSTATDIFF(1) girly herself β mwah, go run some stats πβ¨
π¦ where this page comes from
- epel 9: perl-Fsdb 2:3.9-1.el9 Β· GPLv2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms