NITPicker

Daphne Ezer

2019-01-10

Often, researchers will conduct a few high-resolution time course experiments (or densely sample points along a spatial axis), but then they must select a subset of points to sample in follow-up experiments due to financial constraints. NITPicker is a tool to select the best points to subsample. We present three different definitions of what constitutes a `good’ set of time points:

Please note that this is not a very fast value to compute– it may take a few hours to complete on a large dataset. The precise definition and motivation for these three criteria can be found at: https://doi.org/10.1101/301796

Please note that this package relies heavily on the fdasrvf package, which is used to generate probability distributions of curves, based on a set of example functions.

References

Please cite the following if you use this R package:

Ezer, D. and Keir J.C. Selection of time points for costly experiments: a comparison between human intuition and computer-aided experimental design. bioarxiv, :10.1101/301796 (2018).


It might also be advisable to cite this paper, which presents the fdasrvf package which is an important part of this project:

Tucker, J. D., Wu, W., Srivastava, A., Generative Models for Function Data using Phase and Amplitude Separation, Computational Statistics and Data Analysis (2012), 10.1016/j.csda.2012.12.001.

For more background on why it might be useful to minimise the L2-error for finding optimal time points to sample, please see:

Michael Kleyman, Emre Sefer, Teodora Nicola, Celia Espinoza, Divya Chhabra, James S Hagood, Naftali Kaminski, Namasivayam Ambalavanan, Ziv Bar-Joseph. Selecting the most appropriate time points to profile in high-throughput studies. eLife 2017;6:e18541 (2017).

Demo of F1

In this example, we try to find 4 months to subsample that will let us estimate the shape of the curves as accurately as possible (minimise L2-error). In this case, we sample only 3 example curves from the distribution of curves when estimating the integral– this should be much higher (100 curves is usually suitable), but we make it 3 here to speed up loading the vignette.

Note that the tables that are printed as the evaluation are the optimisation tables that are used as part of the NITPicker algorithm’s dynamic programming algorithm.

library(fda)
#> Loading required package: splines
#> Loading required package: Matrix
#> 
#> Attaching package: 'fda'
#> The following object is masked from 'package:graphics':
#> 
#>     matplot
library(NITPicker)
#> Loading required package: fdasrvf
#> Loading required package: fda.usc
#> Loading required package: MASS
#> Loading required package: mgcv
#> Loading required package: nlme
#> This is mgcv 1.8-26. For overview type 'help("mgcv-package")'.
#> Loading required package: rpart
 mat=CanadianWeather$monthlyTemp #load data - a matrix with 12 rows, representing months (time); and 35 columns, representing cities (experiments)
 a=findPathF1(c(1:12), mat, 4, numPerts=500) #find a set of points that help predict the shape of the curve
#> lambda =   0.0 
#> 
#> Initializing...
#> Computing Karcher mean of 35 functions in SRSF space...
#> updating step: r=1
#> updating step: r=2
#> updating step: r=3
#> updating step: r=4
#> updating step: r=5
#> updating step: r=6
#> updating step: r=7
#> updating step: r=8
#> updating step: r=9
#> updating step: r=10
#> updating step: r=11
#> updating step: r=12
#> updating step: r=13
#> updating step: r=14
#> updating step: r=15
#> updating step: r=16
#> updating step: r=17
#> updating step: r=18
#> [1] 12  1
#>      [,1]
#> [1,]    0
#> [2,]  Inf
#> [3,]  Inf
#> [4,]  Inf
#> [5,]  Inf
#>          [,1] [,2]
#> [1,] 98161.66  Inf
#> [2,]      Inf    0
#> [3,]      Inf  Inf
#> [4,]      Inf  Inf
#> [5,]      Inf  Inf
#>         [,1]     [,2]     [,3]
#> [1,] 7263666      Inf      Inf
#> [2,]     Inf 385151.6 98161.66
#> [3,]     Inf      Inf     0.00
#> [4,]     Inf      Inf      Inf
#> [5,]     Inf      Inf      Inf
#>          [,1]    [,2]     [,3]       [,4]
#> [1,] 54351958     Inf      Inf        Inf
#> [2,]      Inf 2707799 273577.4 7263665.59
#> [3,]      Inf     Inf 175415.8   98161.66
#> [4,]      Inf     Inf      Inf       0.00
#> [5,]      Inf     Inf      Inf        Inf
#>           [,1]    [,2]     [,3]        [,4]        [,5]
#> [1,] 162170011     Inf      Inf         Inf         Inf
#> [2,]       Inf 5371544 438565.6 7268892.746 54351958.17
#> [3,]       Inf     Inf 340403.9  103388.811   273577.44
#> [4,]       Inf     Inf      Inf    5227.154    98161.66
#> [5,]       Inf     Inf      Inf         Inf        0.00
#>           [,1]    [,2]     [,3]      [,4]        [,5]         [,6]
#> [1,] 309452876     Inf      Inf       Inf         Inf          Inf
#> [2,]       Inf 5584152 351380.0 7583666.7 54431132.86 1.621700e+08
#> [3,]       Inf     Inf 253218.3  418162.8   352752.13 4.385656e+05
#> [4,]       Inf     Inf      Inf  320001.1   177336.34 1.033888e+05
#> [5,]       Inf     Inf      Inf       Inf    79174.69 5.227154e+03
#>           [,1]    [,2]    [,3]     [,4]     [,5]        [,6]        [,7]
#> [1,] 425464491     Inf     Inf      Inf      Inf         Inf         Inf
#> [2,]       Inf 4445679 3159110 10899951 55802960 162399221.5 309452876.3
#> [3,]       Inf     Inf 3060948  3734447  1724580    667775.7    351380.0
#> [4,]       Inf     Inf     Inf  3636286  1549164    332599.0    253218.3
#> [5,]       Inf     Inf     Inf      Inf  1451002    234437.3    103388.8
#>           [,1]     [,2]     [,3]     [,4]     [,5]      [,6]        [,7]
#> [1,] 390046785      Inf      Inf      Inf      Inf       Inf         Inf
#> [2,]       Inf 21744173 28455413 32213724 67192090 166500909 310148826.8
#> [3,]       Inf      Inf 28357252 25048220 13113709   4769463   1047330.5
#> [4,]       Inf      Inf      Inf 24950059 12938293   4434286    949168.8
#> [5,]       Inf      Inf      Inf      Inf 12840131   4336125    799339.3
#>             [,8]
#> [1,]         Inf
#> [2,] 425464491.3
#> [3,]   3159109.7
#> [4,]    351380.0
#> [5,]    253218.3
#>           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,] 243566824       Inf       Inf       Inf       Inf       Inf       Inf
#> [2,]       Inf 112491891 121562459 105710594 110949392 186870171 316464226
#> [3,]       Inf       Inf 121464298  98545090  56871011  25138726   7362730
#> [4,]       Inf       Inf       Inf  98446928  56695595  24803549   7264568
#> [5,]       Inf       Inf       Inf       Inf  56597434  24705387   7114738
#>             [,8]      [,9]
#> [1,]         Inf       Inf
#> [2,] 426170851.1 390046785
#> [3,]   3865469.5  21744173
#> [4,]   1057739.8   1047330
#> [5,]    959578.1    351380
#>           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,] 196615350       Inf       Inf       Inf       Inf       Inf       Inf
#> [2,]       Inf 295502110 292027891 236646724 191448114 227008558 330899104
#> [3,]       Inf       Inf 291929729 229481220 137369734  65277112  21797608
#> [4,]       Inf       Inf       Inf 229383058 137194318  64941935  21699446
#> [5,]       Inf       Inf       Inf       Inf 137096156  64843774  21549616
#>           [,8]        [,9]     [,10]
#> [1,]       Inf         Inf       Inf
#> [2,] 428771140 390137484.6 243566824
#> [3,]   6465759  21834871.8 105710594
#> [4,]   3658029   1138029.6   3865470
#> [5,]   3559867    442079.2   1047330
#>           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,] 375170922       Inf       Inf       Inf       Inf       Inf       Inf
#> [2,]       Inf 580373075 546078174 429784580 312304736 289868341 355679445
#> [3,]       Inf       Inf 545980013 422619076 258226355 128136895  46577949
#> [4,]       Inf       Inf       Inf 422520914 258050939 127801718  46479787
#> [5,]       Inf       Inf       Inf       Inf 257952778 127703556  46329957
#>           [,8]      [,9]     [,10]     [,11]
#> [1,]       Inf       Inf       Inf       Inf
#> [2,] 434641059 390784722 243625352 196615350
#> [3,]  12335677  22482109 105769122 191448114
#> [4,]   9527948   1785267   3923997   6465759
#> [5,]   9429786   1089317   1105858   1138030
#>           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,] 790524900       Inf       Inf       Inf       Inf       Inf       Inf
#> [2,]       Inf 901052882 824818315 636915236 439588817 354516849 380219824
#> [3,]       Inf       Inf 824720153 629749732 385510437 192785404  71118327
#> [4,]       Inf       Inf       Inf 629651571 385335021 192450227  71020166
#> [5,]       Inf       Inf       Inf       Inf 385236859 192352065  70870336
#>           [,8]      [,9]     [,10]     [,11]     [,12]
#> [1,]       Inf       Inf       Inf       Inf       Inf
#> [2,] 439958264 391209980 243624885 196630217 375170922
#> [3,]  17652882  22907367 105768655 191462981 196615350
#> [4,]  14845152   2210525   3923531   6480626  12335677
#> [5,]  14746991   1514575   1105391   1152897   1785267
#>      [,1]       [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,]    0        Inf       Inf       Inf       Inf       Inf       Inf
#> [2,]  Inf 1050901116 862698400 509151920 246398756 245298621 419238421
#> [3,]  Inf        Inf 862600238 501986416 192320375  83567175 110136924
#> [4,]  Inf        Inf       Inf 501888255 192144960  83231999 110038763
#> [5,]  Inf        Inf       Inf       Inf 192046798  83133837 109888933
#>           [,8]      [,9]     [,10]     [,11]     [,12]     [,13]
#> [1,]       Inf       Inf       Inf       Inf       Inf       Inf
#> [2,] 589966923 536377763 313728277 215710765 376216045 790524900
#> [3,] 167661541 168075150 175872047 210543530 197660472 196630217
#> [4,] 164853812 147378308  74026922  25561174  13380800  17652882
#> [5,] 164755650 146682357  71208783  20233445   2830390   2210525
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    1    0    0    0
#>  [3,]    0    2    2    0    0
#>  [4,]    0    2    3    3    0
#>  [5,]    0    2    3    3    4
#>  [6,]    0    2    2    5    5
#>  [7,]    0    2    6    6    6
#>  [8,]    0    1    6    7    7
#>  [9,]    0    3    7    8    8
#> [10,]    0    4    7    8    8
#> [11,]    0   10    7    8    8
#> [12,]    0   10    7    8    9
#> [13,]    0   10    5   11   12
#>               [,1]         [,2]        [,3]         [,4]        [,5]
#>  [1,]         0.00          Inf         Inf          Inf         Inf
#>  [2,]     98161.66         0.00         Inf          Inf         Inf
#>  [3,]   7263665.59     98161.66        0.00          Inf         Inf
#>  [4,]  54351958.17    273577.44    98161.66        0.000         Inf
#>  [5,] 162170011.40    438565.59   103388.81     5227.154       0.000
#>  [6,] 309452876.33    351380.00   253218.35   103388.811    5227.154
#>  [7,] 425464491.34   3159109.74   351380.00   253218.348  103388.811
#>  [8,] 390046785.46  21744172.64  1047330.48   351380.004  253218.348
#>  [9,] 243566824.14 105710594.04  3865469.51  1047330.476  351380.004
#> [10,] 196615349.50 191448114.40  6465758.55  1138029.635  442079.164
#> [11,] 375170921.93 196615349.50 12335677.33  1785267.099 1089316.628
#> [12,] 790524899.57 196630216.52 17652881.94  2210525.201 1105391.498
#> [13,]         0.00 215710764.86 83567175.34 13380800.258 2210525.201
 print(a) #indices of months to select for follow-up experiments
#> [1]  2  6  8 12
 print(rownames(CanadianWeather$monthlyTemp)[a]) #month names selected
#> [1] "Feb" "Jun" "Aug" "Dec"

Demo of F2

In this example, we consider Canadian cities to be different experimental conditions, and we consider Resolute, Canada to be the control condition. We want to find a set of points that will enable us to estimate the profile of the difference in temperature between Resolute and other cities in Canada. In this case, we sample only 3 example curves from the distribution of curves when estimating the integral– this should be much higher (100 curves is usually suitable), but we make it 3 here to speed up loading the vignette.

Note that the tables that are printed as the evaluation are the optimisation tables that are used as part of the NITPicker algorithm’s dynamic programming algorithm.

library(fda)
library(NITPicker)
mat=CanadianWeather$monthlyTemp #load data - a matrix with 12 rows, representing months (time); and 35 columns, representing cities (experiments)
 y=CanadianWeather$monthlyTemp[,"Resolute"]
a=findPathF2(c(1:12), y, mat, 4, numPerts=500) #find a set of points that help predict the shape of the curve
#> lambda =   0.0 
#> 
#> Initializing...
#> Computing Karcher mean of 35 functions in SRSF space...
#> updating step: r=1
#> updating step: r=2
#> updating step: r=3
#> updating step: r=4
#> updating step: r=5
#> updating step: r=6
#> updating step: r=7
#> updating step: r=8
#> updating step: r=9
#> updating step: r=10
#> updating step: r=11
#> updating step: r=12
#> updating step: r=13
#> updating step: r=14
#> updating step: r=15
#> updating step: r=16
#> updating step: r=17
#> updating step: r=18
#> [1] 12  1
#>      [,1]
#> [1,]    0
#> [2,]  Inf
#> [3,]  Inf
#> [4,]  Inf
#> [5,]  Inf
#>          [,1] [,2]
#> [1,] 165439.2  Inf
#> [2,]      Inf    0
#> [3,]      Inf  Inf
#> [4,]      Inf  Inf
#> [5,]      Inf  Inf
#>         [,1]    [,2]     [,3]
#> [1,] 3796698     Inf      Inf
#> [2,]     Inf 19444.1 165439.2
#> [3,]     Inf     Inf      0.0
#> [4,]     Inf     Inf      Inf
#> [5,]     Inf     Inf      Inf
#>         [,1]    [,2]     [,3]      [,4]
#> [1,] 3014801     Inf      Inf       Inf
#> [2,]     Inf 1227157 800669.5 3796698.2
#> [3,]     Inf     Inf 635230.4   19444.1
#> [4,]     Inf     Inf      Inf       0.0
#> [5,]     Inf     Inf      Inf       Inf
#>          [,1]     [,2]    [,3]    [,4]      [,5]
#> [1,] 16931803      Inf     Inf     Inf       Inf
#> [2,]      Inf 17618936 8991464 4964204 3014801.2
#> [3,]      Inf      Inf 8826025 1186950  800669.5
#> [4,]      Inf      Inf     Inf 1167506   19444.1
#> [5,]      Inf      Inf     Inf     Inf       0.0
#>          [,1]     [,2]     [,3]    [,4]       [,5]       [,6]
#> [1,] 74946333      Inf      Inf     Inf        Inf        Inf
#> [2,]      Inf 40185406 19087104 6153057 3041835.81 16931803.0
#> [3,]      Inf      Inf 18921665 2375803  827704.16  3014801.2
#> [4,]      Inf      Inf      Inf 2356359   46478.71   800669.5
#> [5,]      Inf      Inf      Inf     Inf   27034.61    19444.1
#>           [,1]     [,2]     [,3]    [,4]    [,5]       [,6]        [,7]
#> [1,] 104369013      Inf      Inf     Inf     Inf        Inf         Inf
#> [2,]       Inf 43511206 18210985 5480594 4849486 17396617.1 74946332.70
#> [3,]       Inf      Inf 18045546 1703340 2635354  3479615.3  3041835.81
#> [4,]       Inf      Inf      Inf 1683896 1854129  1265483.6   827704.16
#> [5,]       Inf      Inf      Inf     Inf 1834685   484258.2    46478.71
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]       [,7]
#> [1,] 77610703      Inf      Inf      Inf      Inf      Inf        Inf
#> [2,]      Inf 34213227 14784205 11767585 14977261 21076080 75313093.7
#> [3,]      Inf      Inf 14618766  7990331 12763130  7159078  3408596.8
#> [4,]      Inf      Inf      Inf  7970887 11981904  4944946  1194465.2
#> [5,]      Inf      Inf      Inf      Inf 11962460  4163721   413239.7
#>             [,8]
#> [1,]         Inf
#> [2,] 104369013.0
#> [3,]   4849486.1
#> [4,]   1703340.0
#> [5,]    827704.2
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
#> [1,] 53100196      Inf      Inf      Inf      Inf      Inf      Inf
#> [2,]      Inf 31796602 19581006 27145890 31899955 27438858 76166185
#> [3,]      Inf      Inf 19415567 23368636 29685823 13521856  4261688
#> [4,]      Inf      Inf      Inf 23349192 28904597 11307725  2047557
#> [5,]      Inf      Inf      Inf      Inf 28885153 10526499  1266331
#>             [,8]     [,9]
#> [1,]         Inf      Inf
#> [2,] 104375348.2 77610703
#> [3,]   4855821.4 11767585
#> [4,]   1709675.3  3408597
#> [5,]    834039.4  1194465
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
#> [1,] 41697533      Inf      Inf      Inf      Inf      Inf      Inf
#> [2,]      Inf 42913463 41639910 62879569 65661291 42144573 79655333
#> [3,]      Inf      Inf 41474471 59102315 63447160 28227571  7750836
#> [4,]      Inf      Inf      Inf 59082871 62665934 26013440  5536705
#> [5,]      Inf      Inf      Inf      Inf 62646490 25232214  4755479
#>           [,8]     [,9]    [,10]
#> [1,]       Inf      Inf      Inf
#> [2,] 104883615 77746094 53100196
#> [3,]   5364088 11902977 19581006
#> [4,]   2217942  3543989  4261688
#> [5,]   1342307  1329857  1709675
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
#> [1,] 55572869      Inf      Inf      Inf      Inf      Inf      Inf
#> [2,]      Inf 52806959 57404754 87178887 87509618 49639726 80312414
#> [3,]      Inf      Inf 57239315 83401633 85295487 35722724  8407917
#> [4,]      Inf      Inf      Inf 83382189 84514261 33508592  6193785
#> [5,]      Inf      Inf      Inf      Inf 84494817 32727367  5412560
#>           [,8]     [,9]    [,10]    [,11]
#> [1,]       Inf      Inf      Inf      Inf
#> [2,] 104695038 77706517 53249777 41697533
#> [3,]   5175511 11863399 19730587 41639910
#> [4,]   2029365  3504411  4411269  5364088
#> [5,]   1153729  1290279  1859256  2217942
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
#> [1,] 40901786      Inf      Inf      Inf      Inf      Inf      Inf
#> [2,]      Inf 40512624 41231535 70006672 72803118 40329745 79828813
#> [3,]      Inf      Inf 41066096 66229418 70588986 26412743  7924316
#> [4,]      Inf      Inf      Inf 66209974 69807761 24198612  5710184
#> [5,]      Inf      Inf      Inf      Inf 69788316 23417386  4928959
#>           [,8]     [,9]    [,10]    [,11]    [,12]
#> [1,]       Inf      Inf      Inf      Inf      Inf
#> [2,] 109655375 82582137 56995725 42429667 55572869
#> [3,]  10135848 16739019 23476535 42372045 41697533
#> [4,]   6989702  8380031  8157217  6096223  5175511
#> [5,]   6114066  6165899  5605204  2950077  2029365
#>      [,1]     [,2]     [,3]      [,4]      [,5]     [,6]     [,7]
#> [1,]    0      Inf      Inf       Inf       Inf      Inf      Inf
#> [2,]  Inf 40914229 62437637 145466337 132727172 41148513 94148655
#> [3,]  Inf      Inf 62272198 141689083 130513040 27231511 22244158
#> [4,]  Inf      Inf      Inf 141669639 129731815 25017380 20030027
#> [5,]  Inf      Inf      Inf       Inf 129712371 24236154 19248801
#>           [,8]     [,9]    [,10]    [,11]    [,12]    [,13]
#> [1,]       Inf      Inf      Inf      Inf      Inf      Inf
#> [2,] 136364068 97363603 62387919 42144360 55700845 40901786
#> [3,]  36844541 31520485 28868729 42086737 41825508 40329745
#> [4,]  33698395 23161497 13549411  5810915  5303486  7924316
#> [5,]  32822759 20947365 10997398  2664769  2157340  5175511
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    1    0    0    0
#>  [3,]    0    1    2    0    0
#>  [4,]    0    2    3    3    0
#>  [5,]    0    4    4    4    4
#>  [6,]    0    4    4    4    5
#>  [7,]    0    4    3    6    6
#>  [8,]    0    3    6    6    6
#>  [9,]    0    2    6    7    7
#> [10,]    0    2    7    7    8
#> [11,]    0   10    7    7    7
#> [12,]    0    5    6   11   11
#> [13,]    0   12    6   11   11
#>              [,1]       [,2]       [,3]       [,4]       [,5]
#>  [1,]         0.0        Inf        Inf        Inf        Inf
#>  [2,]    165439.2        0.0        Inf        Inf        Inf
#>  [3,]   3796698.2    19444.1        0.0        Inf        Inf
#>  [4,]   3014801.2   800669.5    19444.1       0.00        Inf
#>  [5,]  16931803.0  3014801.2   800669.5   19444.10       0.00
#>  [6,]  74946332.7  3041835.8   827704.2   46478.71   19444.10
#>  [7,] 104369013.0  4849486.1  1703340.0  827704.16   46478.71
#>  [8,]  77610702.6 11767585.1  3408596.8 1194465.15  413239.71
#>  [9,]  53100196.0 19581006.0  4261688.3 1709675.27  834039.41
#> [10,]  41697532.6 41639910.2  5364088.5 2217942.37 1329856.88
#> [11,]  55572869.5 41697532.6  5175510.8 2029364.73 1153728.86
#> [12,]  40901786.3 40329745.0  7924315.8 5175510.83 2029364.73
#> [13,]         0.0 40901786.3 22244158.5 5303486.22 2157340.12
print(a) #indices of months to select for follow-up experiments
#> [1]  1  3  7 11
print(rownames(CanadianWeather$monthlyTemp)[a])
#> [1] "Jan" "Mar" "Jul" "Nov"

Demo of F3

In this example, we try to identify points that can predict the shape of the curve of the difference between the temperatures of Canadian cities that are along the Atlantic with those that are Continental– however, we don’t care too much about sampling time points where there is lots of noise, so we normalise this by the variance at each point.

In this case, we sample only 3 example curves from the distribution of curves when estimating the integral– this should be much higher (100 curves is usually suitable), but we make it 3 here to speed up loading the vignette.

Note that the tables that are printed as the evaluation are the optimisation tables that are used as part of the NITPicker algorithm’s dynamic programming algorithm.

library(fda)
library(NITPicker)
#Set up data:
atlanticCities=which(CanadianWeather$region[as.character(colnames(CanadianWeather$monthlyTemp))]=="Atlantic")
 matAtlantic=CanadianWeather$monthlyTemp[, names(atlanticCities)]
 
 continentalCities=which(CanadianWeather$region[as.character(colnames(CanadianWeather$monthlyTemp))]=="Continental")
 matContinental=CanadianWeather$monthlyTemp[, names(continentalCities)]
 
 #find a set of points that helps capture the difference between Atlantic and Continental cities, normalised by the variance
 a=findPathF3(c(1:12),  matAtlantic,  matContinental, 4, numPerts=500) #find a set of points that help predict the shape of the curve
#> lambda =   0.0 
#> 
#> Initializing...
#> Computing Karcher mean of 15 functions in SRSF space...
#> updating step: r=1
#> updating step: r=2
#> updating step: r=3
#> updating step: r=4
#> updating step: r=5
#> updating step: r=6
#> updating step: r=7
#> updating step: r=8
#> updating step: r=9
#> updating step: r=10
#> updating step: r=11
#> lambda =   0.0 
#> 
#> Initializing...
#> Computing Karcher mean of 12 functions in SRSF space...
#> updating step: r=1
#> updating step: r=2
#> updating step: r=3
#> updating step: r=4
#> updating step: r=5
#> updating step: r=6
#> [1] 12  1
#>      [,1]
#> [1,]    0
#> [2,]  Inf
#> [3,]  Inf
#> [4,]  Inf
#> [5,]  Inf
#>          [,1] [,2]
#> [1,] 1885.478  Inf
#> [2,]      Inf    0
#> [3,]      Inf  Inf
#> [4,]      Inf  Inf
#> [5,]      Inf  Inf
#>          [,1]     [,2]     [,3]
#> [1,] 7385.792      Inf      Inf
#> [2,]      Inf 1523.843 1885.478
#> [3,]      Inf      Inf    0.000
#> [4,]      Inf      Inf      Inf
#> [5,]      Inf      Inf      Inf
#>          [,1]     [,2]     [,3]     [,4]
#> [1,] 109127.6      Inf      Inf      Inf
#> [2,]      Inf 2156.638 4955.513 7385.792
#> [3,]      Inf      Inf 3070.035 1523.843
#> [4,]      Inf      Inf      Inf    0.000
#> [5,]      Inf      Inf      Inf      Inf
#>          [,1]     [,2]     [,3]     [,4]       [,5]
#> [1,] 227923.4      Inf      Inf      Inf        Inf
#> [2,]      Inf 1353.102 4058.134 8885.316 109127.639
#> [3,]      Inf      Inf 2172.655 3023.366   2156.638
#> [4,]      Inf      Inf      Inf 1499.523   1523.843
#> [5,]      Inf      Inf      Inf      Inf      0.000
#>          [,1]     [,2]     [,3]     [,4]       [,5]       [,6]
#> [1,] 189005.6      Inf      Inf      Inf        Inf        Inf
#> [2,]      Inf 26954.02 17266.13 27100.75 111630.840 227923.384
#> [3,]      Inf      Inf 15380.65 21238.80   4659.839   1353.102
#> [4,]      Inf      Inf      Inf 19714.95   4027.043   2156.638
#> [5,]      Inf      Inf      Inf      Inf   2503.201   1499.523
#>          [,1]     [,2]     [,3]     [,4]      [,5]       [,6]       [,7]
#> [1,] 105129.1      Inf      Inf      Inf       Inf        Inf        Inf
#> [2,]      Inf 137594.8 84331.00 83667.08 125028.38 228796.254 189005.604
#> [3,]      Inf      Inf 82445.52 77805.13  18057.38   2225.972  17266.130
#> [4,]      Inf      Inf      Inf 76281.29  17424.59   3029.508   1353.102
#> [5,]      Inf      Inf      Inf      Inf  15900.75   2372.393   2156.638
#>          [,1]     [,2]     [,3]     [,4]      [,5]       [,6]       [,7]
#> [1,] 142963.6      Inf      Inf      Inf       Inf        Inf        Inf
#> [2,]      Inf 321454.9 196918.9 167862.7 147243.03 231033.580 189032.240
#> [3,]      Inf      Inf 195033.4 162000.8  40272.03   4463.298  17292.766
#> [4,]      Inf      Inf      Inf 160476.9  39639.24   5266.834   1379.738
#> [5,]      Inf      Inf      Inf      Inf  38115.39   4609.719   2183.274
#>            [,8]
#> [1,]        Inf
#> [2,] 105129.137
#> [3,]  83667.084
#> [4,]   2225.972
#> [5,]   1353.102
#>          [,1]     [,2]     [,3]     [,4]      [,5]      [,6]       [,7]
#> [1,] 488317.5      Inf      Inf      Inf       Inf       Inf        Inf
#> [2,]      Inf 643423.1 401429.0 315635.2 195987.97 240788.52 190617.664
#> [3,]      Inf      Inf 399543.5 309773.2  89016.97  14218.24  18878.190
#> [4,]      Inf      Inf      Inf 308249.4  88384.17  15021.77   2965.162
#> [5,]      Inf      Inf      Inf      Inf  86860.33  14364.66   3768.698
#>            [,8]       [,9]
#> [1,]        Inf        Inf
#> [2,] 105526.905 142963.581
#> [3,]  84064.852 105129.137
#> [4,]   2623.740   4463.298
#> [5,]   1750.871   1379.738
#>          [,1]     [,2]     [,3]     [,4]      [,5]       [,6]       [,7]
#> [1,] 510510.8      Inf      Inf      Inf       Inf        Inf        Inf
#> [2,]      Inf 678121.5 399166.9 303863.9 174978.73 235047.171 195188.223
#> [3,]      Inf      Inf 397281.4 298002.0  68007.73   8476.889  23448.750
#> [4,]      Inf      Inf      Inf 296478.1  67374.93   9280.425   7535.722
#> [5,]      Inf      Inf      Inf      Inf  65851.09   8623.310   8339.258
#>            [,8]       [,9]     [,10]
#> [1,]        Inf        Inf       Inf
#> [2,] 110898.862 146926.661 488317.48
#> [3,]  89436.809 109092.217 105526.91
#> [4,]   7995.697   8426.378  14218.24
#> [5,]   7122.828   5342.818   2623.74
#>         [,1]    [,2]     [,3]     [,4]     [,5]      [,6]      [,7]
#> [1,] 1859442     Inf      Inf      Inf      Inf       Inf       Inf
#> [2,]     Inf 1290872 800934.6 592293.9 285719.8 262578.55 199901.14
#> [3,]     Inf     Inf 799049.1 586432.0 178748.8  36008.27  28161.66
#> [4,]     Inf     Inf      Inf 584908.1 178116.0  36811.80  12248.64
#> [5,]     Inf     Inf      Inf      Inf 176592.2  36154.69  13052.17
#>            [,8]       [,9]     [,10]      [,11]
#> [1,]        Inf        Inf       Inf        Inf
#> [2,] 113234.903 149920.566 497547.48 510510.757
#> [3,]  91772.850 112086.122 114756.91 110898.862
#> [4,]  10331.738  11420.284  23448.24   8476.889
#> [5,]   9458.868   8336.724  11853.74   7535.722
#>         [,1]    [,2]     [,3]     [,4]      [,5]      [,6]      [,7]
#> [1,] 1327679     Inf      Inf      Inf       Inf       Inf       Inf
#> [2,]     Inf 1052485 602806.8 433297.8 204431.95 251122.11 217139.43
#> [3,]     Inf     Inf 600921.3 427435.9  97460.95  24551.83  45399.96
#> [4,]     Inf     Inf      Inf 425912.0  96828.15  25355.37  29486.93
#> [5,]     Inf     Inf      Inf      Inf  95304.31  24698.25  30290.47
#>           [,8]      [,9]     [,10]     [,11]       [,12]
#> [1,]       Inf       Inf       Inf       Inf         Inf
#> [2,] 131232.98 163761.91 499580.60 527269.75 1859442.272
#> [3,] 109770.93 125927.46 116790.02 127657.85  113234.903
#> [4,]  28329.81  25261.63  25481.36  25235.88   28161.663
#> [5,]  27456.94  22178.07  13886.86  24294.71    8476.889
#>      [,1]     [,2]     [,3]     [,4]     [,5]      [,6]     [,7]     [,8]
#> [1,]    0      Inf      Inf      Inf      Inf       Inf      Inf      Inf
#> [2,]  Inf 885238.6 412609.9 354759.7 628742.9 1044676.8 908972.4 535324.7
#> [3,]  Inf      Inf 410724.4 348897.8 521771.9  818106.5 737233.0 513862.6
#> [4,]  Inf      Inf      Inf 347373.9 521139.1  818910.1 721319.9 432421.5
#> [5,]  Inf      Inf      Inf      Inf 519615.2  818252.9 722123.5 431548.6
#>          [,9]     [,10]     [,11]       [,12]      [,13]
#> [1,]      Inf       Inf       Inf         Inf        Inf
#> [2,] 354312.1 539702.45 558545.90 1859913.855 1327679.45
#> [3,] 316477.6 156911.87 158934.00  113706.486  131232.98
#> [4,] 215811.8  65603.20  56512.03   28633.247   24551.83
#> [5,] 212728.2  54008.71  55570.86    8948.472   25235.88
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    1    0    0    0
#>  [3,]    0    1    2    0    0
#>  [4,]    0    1    3    3    0
#>  [5,]    0    1    4    3    4
#>  [6,]    0    2    5    5    5
#>  [7,]    0    3    5    6    6
#>  [8,]    0    7    5    6    7
#>  [9,]    0    7    5    7    8
#> [10,]    0    7    5    6    9
#> [11,]    0    7    6   10   10
#> [12,]    0    7    5   10   11
#> [13,]    0    8   11   12   11
#>              [,1]       [,2]       [,3]      [,4]     [,5]
#>  [1,]       0.000        Inf        Inf       Inf      Inf
#>  [2,]    1885.478      0.000        Inf       Inf      Inf
#>  [3,]    7385.792   1523.843      0.000       Inf      Inf
#>  [4,]  109127.639   2156.638   1523.843     0.000      Inf
#>  [5,]  227923.384   1353.102   2156.638  1499.523    0.000
#>  [6,]  189005.604  17266.130   1353.102  2156.638 1499.523
#>  [7,]  105129.137  83667.084   2225.972  1353.102 2156.638
#>  [8,]  142963.581 105129.137   4463.298  1379.738 1353.102
#>  [9,]  488317.480 105526.905  14218.238  2623.740 1379.738
#> [10,]  510510.757 110898.862   8476.889  7535.722 2623.740
#> [11,] 1859442.272 113234.903  28161.663  8476.889 7535.722
#> [12,] 1327679.453 131232.979  24551.829 25235.880 8476.889
#> [13,]       0.000 354312.066 113706.486 24551.829 8948.472
 print(a) #indices of months to select for follow-up experiments
#> [1]  1  5 10 11
 print(rownames(CanadianWeather$monthlyTemp)[a]) #month names selected
#> [1] "Jan" "May" "Oct" "Nov"