Skip to contents

log likelihood and derivatives for F distribution

Usage

llikF(x, df1, df2, full = FALSE)

Arguments

x

variable that is distributed by f distribution

df1, df2

degrees of freedom. Inf is allowed.

full

Add the data frame showing x, mean, sd as well as the fx and derivatives

Value

data frame with fx for the log pdf value of with dDf1 and dDf2

that has the derivatives with respect to the df1/df2 parameters at the observation time-point

Details

In an rxode2() model, you can use llikF() but you have to use the x and rate arguments. You can also get the derivative of df1 and df2 with llikFDdf1() and llikFDdf2().

Author

Matthew L. Fidler

Examples


# \donttest{
x <- seq(0.001, 5, length.out = 100)

llikF(x^2, 1, 5)
#>               fx         dDf1          dDf2
#> 1    5.939135090 -5.769327755  0.0098138672
#> 2    1.996061339 -1.829698617  0.0098667834
#> 3    1.308027230 -1.151720596  0.0100203751
#> 4    0.898151814 -0.758467992  0.0102713542
#> 5    0.601410048 -0.484842238  0.0106143384
#> 6    0.365567397 -0.278507461  0.0110419510
#> 7    0.167275143 -0.115987118  0.0115449567
#> 8   -0.005928407  0.015333168  0.0121124287
#> 9   -0.161467803  0.123053577  0.0127319420
#> 10  -0.304110944  0.212138450  0.0133897879
#> 11  -0.437089645  0.286034532  0.0140712037
#> 12  -0.562684604  0.347253504  0.0147606108
#> 13  -0.682555520  0.397699568  0.0154418570
#> 14  -0.797939098  0.438864917  0.0160984557
#> 15  -0.909773848  0.471951996  0.0167138175
#> 16  -1.018782007  0.497952966  0.0172714700
#> 17  -1.125525217  0.517703019  0.0177552614
#> 18  -1.230443500  0.531917117  0.0181495454
#> 19  -1.333883243  0.541215913  0.0184393449
#> 20  -1.436117763  0.546144408  0.0186104926
#> 21  -1.537362702  0.547185650  0.0186497493
#> 22  -1.637787764  0.544770962  0.0185448973
#> 23  -1.737525805  0.539287723  0.0182848126
#> 24  -1.836679954  0.531085385  0.0178595139
#> 25  -1.935329266  0.520480216  0.0172601925
#> 26  -2.033533263  0.507759100  0.0164792220
#> 27  -2.131335592  0.493182655  0.0155101530
#> 28  -2.228767013  0.476987816  0.0143476919
#> 29  -2.325847849  0.459390036  0.0129876676
#> 30  -2.422589998  0.440585182  0.0114269877
#> 31  -2.518998603  0.420751193  0.0096635860
#> 32  -2.615073425  0.400049565  0.0076963639
#> 33  -2.710810000  0.378626673  0.0055251263
#> 34  -2.806200581  0.356614982  0.0031505147
#> 35  -2.901234940  0.334134152  0.0005739382
#> 36  -2.995901017  0.311292055 -0.0022024960
#> 37  -3.090185467  0.288185720 -0.0051760516
#> 38  -3.184074111  0.264902202 -0.0083434311
#> 39  -3.277552304  0.241519400 -0.0117008417
#> 40  -3.370605236  0.218106810 -0.0152440579
#> 41  -3.463218177  0.194726229 -0.0189684823
#> 42  -3.555376677  0.171432411 -0.0228692014
#> 43  -3.647066718  0.148273673 -0.0269410395
#> 44  -3.738274839  0.125292465 -0.0311786073
#> 45  -3.828988227  0.102525891 -0.0355763478
#> 46  -3.919194789  0.080006197 -0.0401285781
#> 47  -4.008883199  0.057761220 -0.0448295271
#> 48  -4.098042931  0.035814802 -0.0496733702
#> 49  -4.186664276  0.014187176 -0.0546542601
#> 50  -4.274738350 -0.007104684 -0.0597663547
#> 51  -4.362257091 -0.028046739 -0.0650038410
#> 52  -4.449213248 -0.048627585 -0.0703609577
#> 53  -4.535600366 -0.068838184 -0.0758320130
#> 54  -4.621412763 -0.088671614 -0.0814114015
#> 55  -4.706645505 -0.108122840 -0.0870936184
#> 56  -4.791294380 -0.127188508 -0.0928732707
#> 57  -4.875355868 -0.145866755 -0.0987450876
#> 58  -4.958827105 -0.164157039 -0.1047039284
#> 59  -5.041705859 -0.182059980 -0.1107447891
#> 60  -5.123990491 -0.199577223 -0.1168628074
#> 61  -5.205679923 -0.216711307 -0.1230532668
#> 62  -5.286773611 -0.233465550 -0.1293115988
#> 63  -5.367271506 -0.249843943 -0.1356333846
#> 64  -5.447174028 -0.265851061 -0.1420143563
#> 65  -5.526482033 -0.281491973 -0.1484503963
#> 66  -5.605196787 -0.296772169 -0.1549375368
#> 67  -5.683319932 -0.311697491 -0.1614719584
#> 68  -5.760853464 -0.326274073 -0.1680499885
#> 69  -5.837799706 -0.340508283 -0.1746680988
#> 70  -5.914161282 -0.354406680 -0.1813229026
#> 71  -5.989941093 -0.367975967 -0.1880111521
#> 72  -6.065142296 -0.381222952 -0.1947297352
#> 73  -6.139768282 -0.394154517 -0.2014756717
#> 74  -6.213822655 -0.406777586 -0.2082461105
#> 75  -6.287309215 -0.419099097 -0.2150383254
#> 76  -6.360231938 -0.431125983 -0.2218497115
#> 77  -6.432594959 -0.442865149 -0.2286777813
#> 78  -6.504402560 -0.454323453 -0.2355201612
#> 79  -6.575659147 -0.465507693 -0.2423745875
#> 80  -6.646369247 -0.476424593 -0.2492389023
#> 81  -6.716537483 -0.487080791 -0.2561110501
#> 82  -6.786168572 -0.497482830 -0.2629890742
#> 83  -6.855267306 -0.507637151 -0.2698711122
#> 84  -6.923838547 -0.517550083 -0.2767553934
#> 85  -6.991887212 -0.527227840 -0.2836402345
#> 86  -7.059418267 -0.536676516 -0.2905240366
#> 87  -7.126436719 -0.545902081 -0.2974052813
#> 88  -7.192947604 -0.554910380 -0.3042825282
#> 89  -7.258955983 -0.563707126 -0.3111544109
#> 90  -7.324466935 -0.572297907 -0.3180196342
#> 91  -7.389485548 -0.580688177 -0.3248769714
#> 92  -7.454016916 -0.588883261 -0.3317252608
#> 93  -7.518066132 -0.596888352 -0.3385634034
#> 94  -7.581638284 -0.604708517 -0.3453903600
#> 95  -7.644738447 -0.612348689 -0.3522051484
#> 96  -7.707371685 -0.619813679 -0.3590068413
#> 97  -7.769543041 -0.627108167 -0.3657945633
#> 98  -7.831257537 -0.634236713 -0.3725674892
#> 99  -7.892520171 -0.641203751 -0.3793248413
#> 100 -7.953335909 -0.648013598 -0.3860658874

model <- function(){
  model({
    fx <- llikF(time, df1, df2)
    dMean <- llikFDdf1(time, df1, df2)
    dSd <- llikFDdf2(time, df1, df2)
  })
}

et <- et(x)
et$df1 <- 1
et$df2 <- 5

rxSolve(model, et)
#>  
#>  
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
#> ── Solved rxode2 object ──
#> ── Parameters ($params): ──
#> # A tibble: 1 × 0
#> ── Initial Conditions ($inits): ──
#> named numeric(0)
#> ── First part of data (object): ──
#> # A tibble: 100 × 6
#>     time     fx   dMean     dSd   df1   df2
#>    <dbl>  <dbl>   <dbl>   <dbl> <dbl> <dbl>
#> 1 0.001   2.48  -2.32   0.00983     1     5
#> 2 0.0515  0.484 -0.380  0.0108      1     5
#> 3 0.102   0.112 -0.0731 0.0117      1     5
#> 4 0.152  -0.118  0.0943 0.0125      1     5
#> 5 0.203  -0.291  0.204  0.0133      1     5
#> 6 0.253  -0.431  0.283  0.0140      1     5
#> # ℹ 94 more rows
# }