# loglik: Log-likelihood of the bivariate distribution of (Y,X) In ProbYX: Inference for the Stress-Strength Model R = P(Y<X)

## Description

Computation of the log-likelihood function of the bivariate distribution (Y,X). The log-likelihood is reparametrized with the parameter of interest ψ, corresponding to the quantity R, and the nuisance parameter λ.

## Usage

 `1` ```loglik(ydat, xdat, lambda, psi, distr = "exp") ```

## Arguments

 `ydat` data vector of the sample measurements from Y. `xdat` data vector of the sample measurements from X. `lambda` nuisance parameter vector, λ. Values can be determined from the reparameterisation of the original parameters of the bivariate distribution chosen in `distr`. `psi` scalar parameter of interest, ψ, for the probability R. Value can be determined from the reparameterisation of the original parameters of the bivariate distribution chosen in `distr`. `distr` character string specifying the type of distribution assumed for X_1 and X_2. Possible choices for `distr` are "exp" (default) for the one-parameter exponential, "norm_EV" and "norm_DV" for the Gaussian distribution with, respectively, equal or unequal variances assumed for the two random variables.

## Details

For further information on the random variables Y and X, see help on `Prob`.
Reparameterisation in order to determine ψ and λ depends on the assumed distribution. Here the following relashonships have been used:

Exponential models:

ψ= α / (α + β) and λ = α + β, with Y ~ exp(α) and X ~ exp(β);

Gaussian models with equal variances:

ψ = Φ (μ_2 - μ_1) / √{2 σ^2} and λ = (λ_1, λ_2) = ( μ_1 / √{2 σ^2}, √{2 σ^2} ), with Y ~ N(μ_1, σ^2) and X ~ N(μ_2, σ^2);

Gaussian models with unequal variances:

ψ = Φ (μ_2 - μ_1) / √{σ_1^2 + σ_2^2} and λ = (λ_1, λ_2, λ_3) = (μ_1, σ_1^2, σ_2^2), with Y ~ N(μ_1, σ_1^2) and X ~ N(μ_2, σ_2^2).

The Standard Normal cumulative distribution function is indicated with Φ.

## Value

Value of the log-likelihood function computed in ψ=`psi` and λ=`lambda`.

Giuliana Cortese

## References

Cortese G., Ventura L. (2013). Accurate higher-order likelihood inference on P(Y<X). Computational Statistics, 28:1035-1059.

`MLEs`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ``` # data from the first population Y <- rnorm(15, mean=5, sd=1) # data from the second population X <- rnorm(10, mean=7, sd=1) mu1 <- 5 mu2 <- 7 sigma <- 1 # parameter of interest, the R probability interest <- pnorm((mu2-mu1)/(sigma*sqrt(2))) # nuisance parameters nuisance <- c(mu1/(sigma*sqrt(2)), sigma*sqrt(2)) # log-likelihood value loglik(Y, X, nuisance, interest, "norm_EV") ```