# qrminfundtheorem: Minimizes the negative of log-likelihood for OR1 model In bqror: Bayesian Quantile Regression for Ordinal Models

 qrminfundtheorem R Documentation

## Minimizes the negative of log-likelihood for OR1 model

### Description

This function minimizes the negative of log-likelihood for OR1 model with respect to cut-points δ using the fundamental theorem of calculus.

### Usage

```qrminfundtheorem(deltaIn, y, x, beta, cri0, cri1, stepsize, maxiter, h, dh, sw, p)
```

### Arguments

 `deltaIn` initialization of cut-points. `y` observed ordinal outcomes, column vector of size (n x 1). `x` covariate matrix of size (n x k) including a column of ones with or without column names. `beta` β, a column vector of size (k x 1). `cri0` initial criterion, cri0 = 1. `cri1` criterion lies between (0.001 to 0.0001). `stepsize` learning rate lies between (0.1, 1). `maxiter` maximum number of iteration. `h` change in each value of δ, holding other δ constant for first derivatives. `dh` change in each value of δ, holding other δ constant for second derivaties. `sw` iteration to switch from BHHH to inv(-H) algorithm. `p` quantile level or skewness parameter, p in (0,1).

### Details

First derivative from first principle

dy/dx=[f(x+h)-f(x-h)]/2h

Second derivative from first principle

f'(x-h)=(f(x)-f(x-h))/h

f''(x)= [{(f(x+h)-f(x))/h} - (f(x)-f(x-h))/h]/h

= [(f(x+h)+f(x-h)-2 f(x))]/h^2

cross partial derivatives

f(x) = [f(x+dh,y)-f(x-dh,y)]/2dh

f(x,y)=[{(f(x+dh,y+dh) - f(x+dh,y-dh))/2dh} - {(f(x-dh,y+dh) - f(x-dh,y-dh))/2dh}]/2dh

= 0.25* [{(f(x+dh,y+dh)-f(x+dh,y-dh))} -{(f(x-dh,y+dh)-f(x-dh,y-dh))}]/dh2

### Value

Returns a list with components

• `deltamin`: cutpoint vector that minimizes the log-likelihood function.

• `negsum`: negative sum of log-likelihood.

• `logl`: log-likelihood values.

• `G`: gradient vector, (n x k) matrix with i-th row as the score for the i-th unit.

• `H`: Hessian matrix.

### References

Rahman, M. A. (2016). “Bayesian Quantile Regression for Ordinal Models.” Bayesian Analysis, 11(1): 1-24. DOI: 10.1214/15-BA939

differential calculus, functional maximization, mldivide

### Examples

```set.seed(101)
deltaIn <- c(-0.002570995,  1.044481071)
data("data25j4")
y <- data25j4\$y
xMat <- data25j4\$x
p <- 0.25
beta <- c(0.3990094, 0.8168991, 2.8034963)
cri0     <- 1
cri1     <- 0.001
stepsize <- 1
maxiter  <- 10
h        <- 0.002
dh       <- 0.0002
sw       <- 20
output <- qrminfundtheorem(deltaIn, y, xMat, beta, cri0, cri1, stepsize, maxiter, h, dh, sw, p)

# deltamin
#   0.8266967 0.3635708
# negsum
#   645.4911
# logl
#    -0.7136999
#    -1.5340787
#    -1.1072447
#    -1.4423124
#    -1.3944677
#    -0.7941271
#    -1.6544072
#    -0.3246632
#    -1.8582422
#    -0.9220822
#    -2.1117739 .. soon
# G
#    0.803892784  0.00000000
#   -0.420190546  0.72908381
#   -0.421776117  0.72908341
#   -0.421776117 -0.60184063
#   -0.421776117 -0.60184063
#    0.151489598  0.86175120
#    0.296995920  0.96329114
#   -0.421776117  0.72908341
#   -0.340103190 -0.48530164
#    0.000000000  0.00000000
#   -0.421776117 -0.60184063.. soon
# H
#   -338.21243  -41.10775
#   -41.10775 -106.32758

```

bqror documentation built on July 6, 2022, 5:07 p.m.