| 1 |
# test_robustStatistics.praat |
| 2 |
#djmw 20181127 |
| 3 |
|
| 4 |
appendInfoLine: "test_robustStatistics.praat" |
| 5 |
|
| 6 |
|
| 7 |
@mad |
| 8 |
@location_scale |
| 9 |
|
| 10 |
procedure mad |
| 11 |
.answer# ={0,0,1.4826, 1.4826, 1.4826, 2.2239, 2.9652,2.9652,2.9652,3.7065} |
| 12 |
for .irow from 3 to 10 |
| 13 |
.tab = Create Table with column names: "tabel", .irow, "c1" |
| 14 |
Formula: "c1", "row" |
| 15 |
.mad = Get median absolute deviation: "c1" |
| 16 |
assert abs (.mad - .answer#[.irow]) < 0.0001 |
| 17 |
;appendInfoLine: .irow, " ", .mad |
| 18 |
removeObject: .tab |
| 19 |
endfor |
| 20 |
endproc |
| 21 |
|
| 22 |
procedure location_scale |
| 23 |
.tab = Create Table with column names: "tabel", 14, "data" |
| 24 |
Formula: "data", "row" |
| 25 |
Set numeric value: 14, "data", 20 |
| 26 |
.report$ = Report robust statistics: "data", 1.5, 1e-8, 30 |
| 27 |
.location = extractNumber (.report$, "Location:") |
| 28 |
.scale = extractNumber (.report$, "Scale:") |
| 29 |
;# compare with R: hubers(c(1:13, 20)) |
| 30 |
assert abs(.location - 7.56108) < 0.00001 |
| 31 |
assert abs(.scale - 4.86268) < 0.00001 |
| 32 |
removeObject: .tab |
| 33 |
endproc |
| 34 |
|
| 35 |
appendInfoLine: "test_robustStatistics.praat OK" |