bpr_gradient: Gradient of the BPR log likelihood function

Description Usage Arguments Value Mathematical formula See Also Examples

View source: R/bpr.R

Description

bpr_gradient computes the gradient w.r.t the coefficients w of the Binomial distributed Probit regression log likelihood function.

Usage

1
bpr_gradient(w, H, data, is_NLL = FALSE)

Arguments

w

A vector of parameters (i.e. coefficients of the basis functions)

H

The L x M matrix design matrix, where L is the number of observations and M the number of basis functions.

data

An L x 2 matrix containing in the 1st column the total number of trials and in the 2nd the number of successes. Each row corresponds to each row of the design matrix.

is_NLL

Logical, indicating if the Negative Log Likelihood should be returned.

Value

the gradient vector of the log likelihood w.r.t the vector of coefficients w

Mathematical formula

The gradient of the Binomial distributed Probit regression log likelihood function w.r.t to w is computed by the following formula:

log p(y | f, w) = ∑_{l=1}^{L} log Binom(m_{l} | t_{l}, Φ(w^{t}h(x_{l})))

See Also

bpr_likelihood, design_matrix

Examples

1
2
3
4
5
6
7
obj <- polynomial.object(M=2)
obs <- c(0,.2,.5)
des_mat <- design_matrix(obj, obs)
H <- des_mat$H
w <- c(.1,.1,.1)
data <- matrix(c(10,12,15,7,9,8), ncol=2)
gr <- bpr_gradient(w, H, data)

andreaskapou/mpgex documentation built on Nov. 25, 2017, 8:08 a.m.