Constructing a curve for the user-specified lognormal prior using Beast2 parameters
Source:R/lognormalBeast.R
lognormalBeast.Rd
Constructing a curve for the user-specified lognormal prior using Beast2 parameters
Arguments
- M
Mean of the lognormal density in Beast2.
- S
Standard deviation of the lognormal density in Beast2.
- meanInRealSpace
Whether to plot the mean on the real- or log-space (i.e., apply log(M) before plotting). Please see under details.
- offset
Hard lower bound.
- from, to, by
Starting and ending point to calculate considering the offset as zero. That is, from will affect produce a starting point of (offset + from) and an ending point of (offset + to). By sets the step size of the sequence from `from` to `to` each `by` steps.
Details
This function creates a matrix of x,y values given parameters of a lognormal density as specified in the program Beast2. It's main purpose is for plotting but other uses such as similarity quantification are available. Please note that the value of mean depends on whether we expect it to be in real or log space. Please refer to Heath (2015) for more info: Heath, T. A. (2015). Divergence Time Estimation using BEAST v2.
Examples
# Generate a matrix for the lognormal density with mean 1 and standard deviation 1, with mean
# in real space, and spanning values in x from 0 to 10
lognormalBeast(M = 1, S = 1, meanInRealSpace = TRUE, from = 0, to = 10)
#> x y
#> [1,] 0.00 0.000000000
#> [2,] 0.05 0.089778281
#> [3,] 0.10 0.281590189
#> [4,] 0.15 0.439837180
#> [5,] 0.20 0.546267871
#> [6,] 0.25 0.610455304
#> [7,] 0.30 0.644203257
#> [8,] 0.35 0.656928789
#> [9,] 0.40 0.655444168
#> [10,] 0.45 0.644527295
#> [11,] 0.50 0.627496077
#> [12,] 0.55 0.606648294
#> [13,] 0.60 0.583573823
#> [14,] 0.65 0.559370868
#> [15,] 0.70 0.534794832
#> [16,] 0.75 0.510361006
#> [17,] 0.80 0.486415781
#> [18,] 0.85 0.463186358
#> [19,] 0.90 0.440815686
#> [20,] 0.95 0.419387175
#> [21,] 1.00 0.398942280
#> [22,] 1.05 0.379493072
#> [23,] 1.10 0.361031261
#> [24,] 1.15 0.343534692
#> [25,] 1.20 0.326972024
#> [26,] 1.25 0.311306100
#> [27,] 1.30 0.296496371
#> [28,] 1.35 0.282500627
#> [29,] 1.40 0.269276229
#> [30,] 1.45 0.256780967
#> [31,] 1.50 0.244973652
#> [32,] 1.55 0.233814513
#> [33,] 1.60 0.223265447
#> [34,] 1.65 0.213290165
#> [35,] 1.70 0.203854259
#> [36,] 1.75 0.194925229
#> [37,] 1.80 0.186472449
#> [38,] 1.85 0.178467127
#> [39,] 1.90 0.170882238
#> [40,] 1.95 0.163692446
#> [41,] 2.00 0.156874019
#> [42,] 2.05 0.150404746
#> [43,] 2.10 0.144263846
#> [44,] 2.15 0.138431884
#> [45,] 2.20 0.132890686
#> [46,] 2.25 0.127623257
#> [47,] 2.30 0.122613707
#> [48,] 2.35 0.117847173
#> [49,] 2.40 0.113309754
#> [50,] 2.45 0.108988443
#> [51,] 2.50 0.104871067
#> [52,] 2.55 0.100946230
#> [53,] 2.60 0.097203259
#> [54,] 2.65 0.093632155
#> [55,] 2.70 0.090223546
#> [56,] 2.75 0.086968643
#> [57,] 2.80 0.083859205
#> [58,] 2.85 0.080887493
#> [59,] 2.90 0.078046245
#> [60,] 2.95 0.075328637
#> [61,] 3.00 0.072728256
#> [62,] 3.05 0.070239074
#> [63,] 3.10 0.067855420
#> [64,] 3.15 0.065571956
#> [65,] 3.20 0.063383656
#> [66,] 3.25 0.061285787
#> [67,] 3.30 0.059273887
#> [68,] 3.35 0.057343749
#> [69,] 3.40 0.055491406
#> [70,] 3.45 0.053713112
#> [71,] 3.50 0.052005332
#> [72,] 3.55 0.050364725
#> [73,] 3.60 0.048788135
#> [74,] 3.65 0.047272577
#> [75,] 3.70 0.045815229
#> [76,] 3.75 0.044413419
#> [77,] 3.80 0.043064619
#> [78,] 3.85 0.041766434
#> [79,] 3.90 0.040516593
#> [80,] 3.95 0.039312948
#> [81,] 4.00 0.038153457
#> [82,] 4.05 0.037036185
#> [83,] 4.10 0.035959297
#> [84,] 4.15 0.034921048
#> [85,] 4.20 0.033919783
#> [86,] 4.25 0.032953929
#> [87,] 4.30 0.032021989
#> [88,] 4.35 0.031122542
#> [89,] 4.40 0.030254236
#> [90,] 4.45 0.029415782
#> [91,] 4.50 0.028605956
#> [92,] 4.55 0.027823591
#> [93,] 4.60 0.027067575
#> [94,] 4.65 0.026336850
#> [95,] 4.70 0.025630406
#> [96,] 4.75 0.024947280
#> [97,] 4.80 0.024286554
#> [98,] 4.85 0.023647353
#> [99,] 4.90 0.023028838
#> [100,] 4.95 0.022430213
#> [101,] 5.00 0.021850715
#> [102,] 5.05 0.021289614
#> [103,] 5.10 0.020746215
#> [104,] 5.15 0.020219852
#> [105,] 5.20 0.019709889
#> [106,] 5.25 0.019215716
#> [107,] 5.30 0.018736751
#> [108,] 5.35 0.018272437
#> [109,] 5.40 0.017822239
#> [110,] 5.45 0.017385647
#> [111,] 5.50 0.016962171
#> [112,] 5.55 0.016551341
#> [113,] 5.60 0.016152709
#> [114,] 5.65 0.015765843
#> [115,] 5.70 0.015390329
#> [116,] 5.75 0.015025771
#> [117,] 5.80 0.014671790
#> [118,] 5.85 0.014328019
#> [119,] 5.90 0.013994109
#> [120,] 5.95 0.013669723
#> [121,] 6.00 0.013354538
#> [122,] 6.05 0.013048244
#> [123,] 6.10 0.012750543
#> [124,] 6.15 0.012461147
#> [125,] 6.20 0.012179782
#> [126,] 6.25 0.011906183
#> [127,] 6.30 0.011640095
#> [128,] 6.35 0.011381274
#> [129,] 6.40 0.011129482
#> [130,] 6.45 0.010884494
#> [131,] 6.50 0.010646092
#> [132,] 6.55 0.010414065
#> [133,] 6.60 0.010188210
#> [134,] 6.65 0.009968333
#> [135,] 6.70 0.009754246
#> [136,] 6.75 0.009545768
#> [137,] 6.80 0.009342725
#> [138,] 6.85 0.009144949
#> [139,] 6.90 0.008952276
#> [140,] 6.95 0.008764553
#> [141,] 7.00 0.008581626
#> [142,] 7.05 0.008403352
#> [143,] 7.10 0.008229590
#> [144,] 7.15 0.008060204
#> [145,] 7.20 0.007895064
#> [146,] 7.25 0.007734044
#> [147,] 7.30 0.007577022
#> [148,] 7.35 0.007423879
#> [149,] 7.40 0.007274504
#> [150,] 7.45 0.007128786
#> [151,] 7.50 0.006986618
#> [152,] 7.55 0.006847899
#> [153,] 7.60 0.006712529
#> [154,] 7.65 0.006580413
#> [155,] 7.70 0.006451458
#> [156,] 7.75 0.006325575
#> [157,] 7.80 0.006202676
#> [158,] 7.85 0.006082679
#> [159,] 7.90 0.005965502
#> [160,] 7.95 0.005851066
#> [161,] 8.00 0.005739296
#> [162,] 8.05 0.005630119
#> [163,] 8.10 0.005523463
#> [164,] 8.15 0.005419260
#> [165,] 8.20 0.005317442
#> [166,] 8.25 0.005217945
#> [167,] 8.30 0.005120707
#> [168,] 8.35 0.005025667
#> [169,] 8.40 0.004932766
#> [170,] 8.45 0.004841948
#> [171,] 8.50 0.004753157
#> [172,] 8.55 0.004666339
#> [173,] 8.60 0.004581444
#> [174,] 8.65 0.004498420
#> [175,] 8.70 0.004417220
#> [176,] 8.75 0.004337795
#> [177,] 8.80 0.004260099
#> [178,] 8.85 0.004184090
#> [179,] 8.90 0.004109722
#> [180,] 8.95 0.004036955
#> [181,] 9.00 0.003965747
#> [182,] 9.05 0.003896060
#> [183,] 9.10 0.003827854
#> [184,] 9.15 0.003761094
#> [185,] 9.20 0.003695741
#> [186,] 9.25 0.003631763
#> [187,] 9.30 0.003569124
#> [188,] 9.35 0.003507792
#> [189,] 9.40 0.003447734
#> [190,] 9.45 0.003388919
#> [191,] 9.50 0.003331316
#> [192,] 9.55 0.003274898
#> [193,] 9.60 0.003219633
#> [194,] 9.65 0.003165496
#> [195,] 9.70 0.003112458
#> [196,] 9.75 0.003060494
#> [197,] 9.80 0.003009577
#> [198,] 9.85 0.002959684
#> [199,] 9.90 0.002910789
#> [200,] 9.95 0.002862869
#> [201,] 10.00 0.002815902
# The same as above but with an offset of 10, that is, the curve starts at 10 as if it was 0
# to values will start in (offset + from) and finish in (offset + to)
lognormalBeast(M = 1, S = 1, meanInRealSpace = TRUE, offset = 10, from = 0, to = 10)
#> x y
#> [1,] 10.00 0.000000000
#> [2,] 10.05 0.089778281
#> [3,] 10.10 0.281590189
#> [4,] 10.15 0.439837180
#> [5,] 10.20 0.546267871
#> [6,] 10.25 0.610455304
#> [7,] 10.30 0.644203257
#> [8,] 10.35 0.656928789
#> [9,] 10.40 0.655444168
#> [10,] 10.45 0.644527295
#> [11,] 10.50 0.627496077
#> [12,] 10.55 0.606648294
#> [13,] 10.60 0.583573823
#> [14,] 10.65 0.559370868
#> [15,] 10.70 0.534794832
#> [16,] 10.75 0.510361006
#> [17,] 10.80 0.486415781
#> [18,] 10.85 0.463186358
#> [19,] 10.90 0.440815686
#> [20,] 10.95 0.419387175
#> [21,] 11.00 0.398942280
#> [22,] 11.05 0.379493072
#> [23,] 11.10 0.361031261
#> [24,] 11.15 0.343534692
#> [25,] 11.20 0.326972024
#> [26,] 11.25 0.311306100
#> [27,] 11.30 0.296496371
#> [28,] 11.35 0.282500627
#> [29,] 11.40 0.269276229
#> [30,] 11.45 0.256780967
#> [31,] 11.50 0.244973652
#> [32,] 11.55 0.233814513
#> [33,] 11.60 0.223265447
#> [34,] 11.65 0.213290165
#> [35,] 11.70 0.203854259
#> [36,] 11.75 0.194925229
#> [37,] 11.80 0.186472449
#> [38,] 11.85 0.178467127
#> [39,] 11.90 0.170882238
#> [40,] 11.95 0.163692446
#> [41,] 12.00 0.156874019
#> [42,] 12.05 0.150404746
#> [43,] 12.10 0.144263846
#> [44,] 12.15 0.138431884
#> [45,] 12.20 0.132890686
#> [46,] 12.25 0.127623257
#> [47,] 12.30 0.122613707
#> [48,] 12.35 0.117847173
#> [49,] 12.40 0.113309754
#> [50,] 12.45 0.108988443
#> [51,] 12.50 0.104871067
#> [52,] 12.55 0.100946230
#> [53,] 12.60 0.097203259
#> [54,] 12.65 0.093632155
#> [55,] 12.70 0.090223546
#> [56,] 12.75 0.086968643
#> [57,] 12.80 0.083859205
#> [58,] 12.85 0.080887493
#> [59,] 12.90 0.078046245
#> [60,] 12.95 0.075328637
#> [61,] 13.00 0.072728256
#> [62,] 13.05 0.070239074
#> [63,] 13.10 0.067855420
#> [64,] 13.15 0.065571956
#> [65,] 13.20 0.063383656
#> [66,] 13.25 0.061285787
#> [67,] 13.30 0.059273887
#> [68,] 13.35 0.057343749
#> [69,] 13.40 0.055491406
#> [70,] 13.45 0.053713112
#> [71,] 13.50 0.052005332
#> [72,] 13.55 0.050364725
#> [73,] 13.60 0.048788135
#> [74,] 13.65 0.047272577
#> [75,] 13.70 0.045815229
#> [76,] 13.75 0.044413419
#> [77,] 13.80 0.043064619
#> [78,] 13.85 0.041766434
#> [79,] 13.90 0.040516593
#> [80,] 13.95 0.039312948
#> [81,] 14.00 0.038153457
#> [82,] 14.05 0.037036185
#> [83,] 14.10 0.035959297
#> [84,] 14.15 0.034921048
#> [85,] 14.20 0.033919783
#> [86,] 14.25 0.032953929
#> [87,] 14.30 0.032021989
#> [88,] 14.35 0.031122542
#> [89,] 14.40 0.030254236
#> [90,] 14.45 0.029415782
#> [91,] 14.50 0.028605956
#> [92,] 14.55 0.027823591
#> [93,] 14.60 0.027067575
#> [94,] 14.65 0.026336850
#> [95,] 14.70 0.025630406
#> [96,] 14.75 0.024947280
#> [97,] 14.80 0.024286554
#> [98,] 14.85 0.023647353
#> [99,] 14.90 0.023028838
#> [100,] 14.95 0.022430213
#> [101,] 15.00 0.021850715
#> [102,] 15.05 0.021289614
#> [103,] 15.10 0.020746215
#> [104,] 15.15 0.020219852
#> [105,] 15.20 0.019709889
#> [106,] 15.25 0.019215716
#> [107,] 15.30 0.018736751
#> [108,] 15.35 0.018272437
#> [109,] 15.40 0.017822239
#> [110,] 15.45 0.017385647
#> [111,] 15.50 0.016962171
#> [112,] 15.55 0.016551341
#> [113,] 15.60 0.016152709
#> [114,] 15.65 0.015765843
#> [115,] 15.70 0.015390329
#> [116,] 15.75 0.015025771
#> [117,] 15.80 0.014671790
#> [118,] 15.85 0.014328019
#> [119,] 15.90 0.013994109
#> [120,] 15.95 0.013669723
#> [121,] 16.00 0.013354538
#> [122,] 16.05 0.013048244
#> [123,] 16.10 0.012750543
#> [124,] 16.15 0.012461147
#> [125,] 16.20 0.012179782
#> [126,] 16.25 0.011906183
#> [127,] 16.30 0.011640095
#> [128,] 16.35 0.011381274
#> [129,] 16.40 0.011129482
#> [130,] 16.45 0.010884494
#> [131,] 16.50 0.010646092
#> [132,] 16.55 0.010414065
#> [133,] 16.60 0.010188210
#> [134,] 16.65 0.009968333
#> [135,] 16.70 0.009754246
#> [136,] 16.75 0.009545768
#> [137,] 16.80 0.009342725
#> [138,] 16.85 0.009144949
#> [139,] 16.90 0.008952276
#> [140,] 16.95 0.008764553
#> [141,] 17.00 0.008581626
#> [142,] 17.05 0.008403352
#> [143,] 17.10 0.008229590
#> [144,] 17.15 0.008060204
#> [145,] 17.20 0.007895064
#> [146,] 17.25 0.007734044
#> [147,] 17.30 0.007577022
#> [148,] 17.35 0.007423879
#> [149,] 17.40 0.007274504
#> [150,] 17.45 0.007128786
#> [151,] 17.50 0.006986618
#> [152,] 17.55 0.006847899
#> [153,] 17.60 0.006712529
#> [154,] 17.65 0.006580413
#> [155,] 17.70 0.006451458
#> [156,] 17.75 0.006325575
#> [157,] 17.80 0.006202676
#> [158,] 17.85 0.006082679
#> [159,] 17.90 0.005965502
#> [160,] 17.95 0.005851066
#> [161,] 18.00 0.005739296
#> [162,] 18.05 0.005630119
#> [163,] 18.10 0.005523463
#> [164,] 18.15 0.005419260
#> [165,] 18.20 0.005317442
#> [166,] 18.25 0.005217945
#> [167,] 18.30 0.005120707
#> [168,] 18.35 0.005025667
#> [169,] 18.40 0.004932766
#> [170,] 18.45 0.004841948
#> [171,] 18.50 0.004753157
#> [172,] 18.55 0.004666339
#> [173,] 18.60 0.004581444
#> [174,] 18.65 0.004498420
#> [175,] 18.70 0.004417220
#> [176,] 18.75 0.004337795
#> [177,] 18.80 0.004260099
#> [178,] 18.85 0.004184090
#> [179,] 18.90 0.004109722
#> [180,] 18.95 0.004036955
#> [181,] 19.00 0.003965747
#> [182,] 19.05 0.003896060
#> [183,] 19.10 0.003827854
#> [184,] 19.15 0.003761094
#> [185,] 19.20 0.003695741
#> [186,] 19.25 0.003631763
#> [187,] 19.30 0.003569124
#> [188,] 19.35 0.003507792
#> [189,] 19.40 0.003447734
#> [190,] 19.45 0.003388919
#> [191,] 19.50 0.003331316
#> [192,] 19.55 0.003274898
#> [193,] 19.60 0.003219633
#> [194,] 19.65 0.003165496
#> [195,] 19.70 0.003112458
#> [196,] 19.75 0.003060494
#> [197,] 19.80 0.003009577
#> [198,] 19.85 0.002959684
#> [199,] 19.90 0.002910789
#> [200,] 19.95 0.002862869
#> [201,] 20.00 0.002815902