Log likelihood of T and it's derivatives (from stan)

llikT(x, df, mean = 0, sd = 1, full = FALSE)

Arguments

x

Observation

df

degrees of freedom (\(> 0\), maybe non-integer). df = Inf is allowed.

mean

Mean for the likelihood

sd

Standard deviation for the likelihood

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 dDf dMean and dSd that has the derivatives with respect to the parameters at the observation time-point

Author

Matthew L. Fidler

Examples


x <- seq(-3, 3, length.out = 21)

llikT(x, 7, 0, 1)
#>            fx          dDf      dMean        dSd
#> 1  -4.2612484 -0.086858773 -1.5000000  3.5000000
#> 2  -3.8091335 -0.060260433 -1.5115465  3.0811756
#> 3  -3.3561547 -0.037201674 -1.5047022  2.6112853
#> 4  -2.9088542 -0.018379169 -1.4723926  2.0920245
#> 5  -2.4761000 -0.004340221 -1.4062500  1.5312500
#> 6  -2.0693878  0.004691380 -1.2972973  0.9459459
#> 7  -1.7028228  0.009010785 -1.1374408  0.3649289
#> 8  -1.3925134  0.009569214 -0.9218950 -0.1702945
#> 9  -1.1551333  0.007927361 -0.6521739 -0.6086957
#> 10 -1.0056349  0.005918024 -0.3385049 -0.8984485
#> 11 -0.9545342  0.005051942  0.0000000 -1.0000000
#> 12 -1.0056349  0.005918024  0.3385049 -0.8984485
#> 13 -1.1551333  0.007927361  0.6521739 -0.6086957
#> 14 -1.3925134  0.009569214  0.9218950 -0.1702945
#> 15 -1.7028228  0.009010785  1.1374408  0.3649289
#> 16 -2.0693878  0.004691380  1.2972973  0.9459459
#> 17 -2.4761000 -0.004340221  1.4062500  1.5312500
#> 18 -2.9088542 -0.018379169  1.4723926  2.0920245
#> 19 -3.3561547 -0.037201674  1.5047022  2.6112853
#> 20 -3.8091335 -0.060260433  1.5115465  3.0811756
#> 21 -4.2612484 -0.086858773  1.5000000  3.5000000

llikT(x, 15, 0, 1, full=TRUE)
#>       x df mean sd         fx           dDf      dMean        dSd
#> 1  -3.0 15    0  1 -4.6956220 -0.0338931511 -2.0000000  5.0000000
#> 2  -2.7 15    0  1 -4.1042965 -0.0225073150 -1.9380888  4.2328398
#> 3  -2.4 15    0  1 -3.5354158 -0.0134033865 -1.8497110  3.4393064
#> 4  -2.1 15    0  1 -2.9974985 -0.0065857823 -1.7310665  2.6352396
#> 5  -1.8 15    0  1 -2.5001272 -0.0019378861 -1.5789474  1.8421053
#> 6  -1.5 15    0  1 -2.0536885  0.0007929097 -1.3913043  1.0869565
#> 7  -1.2 15    0  1 -1.6689304  0.0019903977 -1.1678832  0.4014599
#> 8  -0.9 15    0  1 -1.3563325  0.0021369166 -0.9108159 -0.1802657
#> 9  -0.6 15    0  1 -1.1253251  0.0017504002 -0.6250000 -0.6250000
#> 10 -0.3 15    0  1 -0.9834495  0.0012985422 -0.3180915 -0.9045726
#> 11  0.0 15    0  1 -0.9355929  0.0011086635  0.0000000 -1.0000000
#> 12  0.3 15    0  1 -0.9834495  0.0012985422  0.3180915 -0.9045726
#> 13  0.6 15    0  1 -1.1253251  0.0017504002  0.6250000 -0.6250000
#> 14  0.9 15    0  1 -1.3563325  0.0021369166  0.9108159 -0.1802657
#> 15  1.2 15    0  1 -1.6689304  0.0019903977  1.1678832  0.4014599
#> 16  1.5 15    0  1 -2.0536885  0.0007929097  1.3913043  1.0869565
#> 17  1.8 15    0  1 -2.5001272 -0.0019378861  1.5789474  1.8421053
#> 18  2.1 15    0  1 -2.9974985 -0.0065857823  1.7310665  2.6352396
#> 19  2.4 15    0  1 -3.5354158 -0.0134033865  1.8497110  3.4393064
#> 20  2.7 15    0  1 -4.1042965 -0.0225073150  1.9380888  4.2328398
#> 21  3.0 15    0  1 -4.6956220 -0.0338931511  2.0000000  5.0000000