Title: | Random Coefficient Binary Response Estimation |
---|---|
Description: | Nonparametric maximum likelihood estimation methods for random coefficient binary response models and some related functionality for sequential processing of hyperplane arrangements. See J. Gu and R. Koenker (2020) <DOI:10.1080/01621459.2020.1802284>. |
Authors: | Roger Koenker [aut, cre], Jiaying Gu [aut] |
Maintainer: | Roger Koenker <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.6.2 |
Built: | 2025-01-30 06:08:05 UTC |
Source: | https://github.com/cran/RCBR |
Given a fitted model by the exact NPMLE procedure prediction is made at a new design point with lower and upper bounds for the prediction due to ambiguity of the assignment of mass within the cell enumerated polygons.
bounds.KW2(object, ...)
bounds.KW2(object, ...)
object |
is the fitted NPMLE object |
... |
is expected to contain an argument |
a list consisting of the following components:
Point prediction
lower bound prediction
upper bound prediction
indices of crossed polygons
Jiaying Gu
predict.KW2
for a simpler prediction function without bounds
Groeneboom and Hendrickx semiparametric binary response estimator (scalar case) score estimator based on NPMLE avoids any smoothing proposed by Groneboom and Hendrickx (2018).
GH(b, X, y, eps = 0.001)
GH(b, X, y, eps = 0.001)
b |
parameter vector (fix last entry as a known number, usually 1 or -1, for normalization) |
X |
design matrix |
y |
binary response vector |
eps |
trimming tolerance parameter |
A list with components:
evaluation of a score function at parameter value
estimated standard error
sindex single index linear predictor
Groeneboom, P. and K. Hendrickx (2018) Current Status Linear Regression, Annals of Statistics, 46, 1415-1444,
Groeneboom and Hendrickx semiparametric binary response estimator (scalar case) score estimator based on NPMLE avoids any smoothing proposed by Groneboom and Hendrickx (2018).
GH.se(bstar, X, y, eps = 0.001, hc = 2)
GH.se(bstar, X, y, eps = 0.001, hc = 2)
bstar |
parameter vector (fix last entry as a known number, usually 1 or -1, for normalization) |
X |
design matrix |
y |
binary response vector |
eps |
trimming tolerance parameter |
hc |
kernel bandwidth (used for the standard error estimation) |
A list with components:
evaluation of a score function at parameter value
estimated standard error
sindex single index linear predictor
Groeneboom, P. and K. Hendrickx (2018) Current Status Linear Regression, Annals of Statistics, 46, 1415-1444,
These parameters can be passed via the ...
argument of the rcbr
function.
defaults as suggested in Gautier and Kitamura matlab code
GK.control(n, u = -20:20/10, v = -20:20/10, T = 3, TX = 10, Mn = 1/log(n)^2)
GK.control(n, u = -20:20/10, v = -20:20/10, T = 3, TX = 10, Mn = 1/log(n)^2)
n |
the sample size |
u |
grid values for intercept coordinate |
v |
grid values for slope coordinate |
T |
Truncation parameter for numerator must grow "sufficiently slowly with n" |
TX |
Truncation parameter for denomerator must grow "sufficiently slowly with n" |
Mn |
Trimming parameter "chosen to go to 0 slowly with n" |
updated list
Modal choice data for journey to work in the Washington DC area from the late 1960's. The variables are: * 'DCOST': difference in cost of car versus transit (transit - car) * 'CARS': number of cars at home * 'DOVTT': difference in out of vehicle time (transit - car) * 'DIVTT': difference in in vehicle time (transit - car) * 'DEPEND': coded 1 if by car, 0 if by mass transit
Horowitz93
Horowitz93
A data frame with 842 observations on 5 variables:
https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_mws.html
Horowitz, J L, (1993) Semiparametric estimation of a work-trip mode choice model. Journal of Econometrics, 58, 49-70.
These parameters can be passed via the ...
argument of the rcbr
function.
The first three arguments are only relevant if full cell enumeration is employed for
bivariate version of the NPMLE.
KW.control( uv = NULL, u = NULL, v = NULL, initial = c(0, 0), epsbound = 1, epstol = 1e-07, presolve = 1, verb = 0 )
KW.control( uv = NULL, u = NULL, v = NULL, initial = c(0, 0), epsbound = 1, epstol = 1e-07, presolve = 1, verb = 0 )
uv |
matrix of evaluation points for potential mass points |
u |
grid of evaluation points for potential mass points |
v |
grid of evaluation points for potential mass points |
initial |
initial point for cell enumeration algorithm |
epsbound |
controls how close witness points can be to vertices of a cell |
epstol |
zero tolerance for witness solutions |
presolve |
controls whether Mosek does a presolve of the LP |
verb |
controls verbosity of Mosek solver 0 implies it is quiet |
updated list
Interface function for calls to optimizer from various REBayes functions There is currently only one option for the optimization that based on Mosek. It relies on the Rmosek interface to R see installation instructions in the Readme file in the inst directory of this package. This version of the function is intended to work with versions of Mosek after 7.0. A more experimental option employing the pogs package available from https://github.com/foges/pogs and employing an ADMM (Alternating Direction Method of Multipliers) approach has been deprecated, those interested could try installing version 1.4 of REBayes, and following the instructions provided there.
KWDual(A, d, w, ...)
KWDual(A, d, w, ...)
A |
Linear constraint matrix |
d |
constraint vector |
w |
weights for |
... |
other parameters passed to control optimization: These may
include |
Returns a list with components:
f |
dual solution vector, the mixing density |
g |
primal solution vector, the mixture density evaluated at the data points |
logLik |
log likelihood |
status |
return status from Mosek |
. Mosek termination messages are treated as warnings from an R perspective since solutions producing, for example, MSK_RES_TRM_STALL: The optimizer is terminated due to slow progress, may still provide a satisfactory solution, especially when the return status variable is "optimal".
R. Koenker
Koenker, R and I. Mizera, (2013) “Convex Optimization, Shape Constraints, Compound Decisions, and Empirical Bayes Rules,” JASA, 109, 674–685.
Mosek Aps (2015) Users Guide to the R-to-Mosek Optimization Interface, https://docs.mosek.com/8.1/rmosek/index.html.
Koenker, R. and J. Gu, (2017) REBayes: An R Package for Empirical Bayes Mixture Methods, Journal of Statistical Software, 82, 1–26.
log likelihood for Gautier Kitamura procedure
## S3 method for class 'GK' logLik(object, ...)
## S3 method for class 'GK' logLik(object, ...)
object |
a fitted object of class "GK" |
... |
other parameters for logLik |
a scalar log likelihood
log likelihood for KW1 procedure
## S3 method for class 'KW1' logLik(object, ...)
## S3 method for class 'KW1' logLik(object, ...)
object |
a fitted object of class "KW1" |
... |
other parameters for logLik |
a scalar log likelihood
Compare cell counts for each cell with its neighbours and return indices of the locally maximal cells.
neighbours(SignVector)
neighbours(SignVector)
SignVector |
n by m matrix of signs produced by NICER |
Column indices of the cells that are locally maximal, i.e. those
whose neighbours have strictly fewer cell counts. The corresponding
interior points of these cells can be used as potential mass points
for the NPMLE function rcbr.fit.KW
.
Find interior points and cell counts of the polygons (cells) formed by a line arrangement.
NICER(A, b, initial = c(0, 0), verb = TRUE, epsbound = 1, epstol = 1e-07)
NICER(A, b, initial = c(0, 0), verb = TRUE, epsbound = 1, epstol = 1e-07)
A |
is a n by 2 matrix of slope coefficients |
b |
is an n vector of intercept coefficients |
initial |
origin for the interior point vectors |
verb |
controls verbosity of Mosek solution |
epsbound |
is a scalar tolerance controlling how close the witness point can be to an edge of the polytope |
epstol |
is a scalar tolerance for the LP convergence |
Modified version of the algorithm of Rada and Cerny (2018). The main modifications include preprocessing as hyperplanes are added to determine which new cells are created, thereby reducing the number of calls to the witness function to solve LPs, and treatment of degenerate configurations as well as those in "general position." When the hyperplanes are in general position the number of polytopes (cells) is determined by the elegant formula of Zazlavsky (1975)
. In
degenerate cases, i.e. when hyperplanes are not in general position, the
number of cells is more complicated as considered by Alexanderson and Wetzel (1981).
The function polycount
is provided to check agreement with their results
in an effort to aid in the selection of tolerances for the witness
function.
Current version is intended for use with , but the algorithm is adaptable to
, and there is an experimental version called
NICERd
in the package.
A list with components:
SignVector a n by m matrix of signs determining position of cell relative to each hyperplane.
w a d by m matrix of interior points for the m cells
Alexanderson, G.L and J.E. Wetzel, (1981) Arrangements of planes in space, Discrete Math, 34, 219–240. Gu, J. and R. Koenker (2020) Nonparametric Maximum Likelihood Methods for Binary Response Models with Random Coefficients, J. Am. Stat Assoc Rada, M. and M. Cerny (2018) A new algorithm for the enumeration of cells of hyperplane arrangements and a comparison with Avis and Fukada's reverse search, SIAM J. of Discrete Math, 32, 455-473. Zaslavsky, T. (1975) Facing up to arrangements: Face-Count Formulas for Partitions of Space by Hyperplanes, Memoirs of the AMS, Number 154.
{ if(packageVersion("Rmosek") > "8.0.0"){ A = cbind(c(1,-1,1,-2,2,1,3), c(1,1,1,1,1,-1,-2)) B = matrix(c(3,1,7,-2,7,-1,1), ncol = 1) plot(NULL,xlim = c(-10,10),ylim = c(-10,10)) for (i in 1:nrow(A)) abline(a = B[i,1]/A[i,2], b = -A[i,1]/A[i,2],col = i) f = NICER(A, B) for (j in 1:ncol(f$SignVector)) points(f$w[1,j], f$w[2,j], cex = 0.5) } }
{ if(packageVersion("Rmosek") > "8.0.0"){ A = cbind(c(1,-1,1,-2,2,1,3), c(1,1,1,1,1,-1,-2)) B = matrix(c(3,1,7,-2,7,-1,1), ncol = 1) plot(NULL,xlim = c(-10,10),ylim = c(-10,10)) for (i in 1:nrow(A)) abline(a = B[i,1]/A[i,2], b = -A[i,1]/A[i,2],col = i) f = NICER(A, B) for (j in 1:ncol(f$SignVector)) points(f$w[1,j], f$w[2,j], cex = 0.5) } }
Find interior points and cell counts of the polygons (polytopes) formed by a hyperplane arrangement.
NICERd( A, b, initial = rep(0, ncol(A)), verb = TRUE, accelerate = FALSE, epsbound = 1, epstol = 1e-07 )
NICERd( A, b, initial = rep(0, ncol(A)), verb = TRUE, accelerate = FALSE, epsbound = 1, epstol = 1e-07 )
A |
is a n by d matrix of hyperplane slope coefficients |
b |
is an n vector of hyperplane intercept coefficients |
initial |
origin for the interior point vectors |
verb |
controls verbosity of Mosek solution |
accelerate |
allows the option to turn off acceleration step (turned off by default) |
epsbound |
is a scalar tolerance controlling how close the witness point can be to an edge of the polytope |
epstol |
is a scalar tolerance for the LP convergence |
Modified version of the algorithm of Rada and Cerny (2018).
The main modifications include preprocessing as hyperplanes are added
to determine which new cells are created, thereby reducing the number of
calls to the witness function to solve LPs, and treatment of degenerate
configurations as well as those in "general position." (for for now). When the hyperplanes
are in general position the number of cells (polytopes) is determined by the
elegant formula of Zaslavsky (1975)
. In
degenerate cases, i.e. when hyperplanes are not in general position, the
number of cells is more complicated as considered by Alexanderson and Wetzel (1981).
The function polycount
is provided to check agreement with their results
in an effort to aid in the selection of tolerances for the witness
function for arrangement in .
The current version is intended mainly for use with
, but the algorithm is adapted to
the general position setting with
, although it requires hyperplanes in general position and may require some patience when both
the sample size is large.
if hyperplanes not general position (i.e. all cross at origin), turn off accelerate
A list with components:
SignVector a n by m matrix of signs determining position of cell relative to each hyperplane.
w a d by m matrix of interior points for the m cells
Alexanderson, G.L and J.E. Wetzel, (1981) Arrangements of planes in space, Discrete Math, 34, 219–240. Rada, M. and M. Cerny (2018) A new algorithm for the enumeration of cells of hyperplane arrangements and a comparison with Avis and Fukada's reverse search, SIAM J. of Discrete Math, 32, 455-473. Zaslavsky, T. (1975) Facing up to arrangements: Face-Count Formulas for Partitions of Space by Hyperplanes, Memoirs of the AMS, Number 154.
Given a fitted model by the Guatier-Kitamura procedure plot the estimated density contours
## S3 method for class 'GK' plot(x, ...)
## S3 method for class 'GK' plot(x, ...)
x |
is the fitted GK object |
... |
other arguments to pass to |
nothing (invisibly)
Given a fitted model by the rcbr NPMLE procedure plot the estimated mass points
## S3 method for class 'KW2' plot(x, smooth = 0, pal = NULL, inches = 1/6, N = 25, tol = 0.001, ...)
## S3 method for class 'KW2' plot(x, smooth = 0, pal = NULL, inches = 1/6, N = 25, tol = 0.001, ...)
x |
is the fitted NPMLE object |
smooth |
is a parameter to control bandwidth of the smoothing if a contour plot of the estimated density is desired, default is no smoothing and only the mass points of the discrete estimate are plotted. |
pal |
a color palette |
inches |
as used in |
N |
scaling of the color palette |
tol |
tolerance for size of mass points |
... |
other arguments to pass to |
nothing (invisibly)
When the hyperplane arrangement is degenerate, i.e. not in general position, the number of distinct cells can be checked against the formula of Alexanderson and Wetzel (1981).
polycount(A, b, maxints = 10)
polycount(A, b, maxints = 10)
A |
is a n by m matrix of hyperplane slope coefficients |
b |
is an n vector of hyperplane intercept coefficients |
maxints |
is maximum number of lines allowed to cross at the same vertex |
number of distinct cells
Alexanderson, G.L and J.E. Wetzel, (1981) Arrangements of planes in space, Discrete Math, 34, 219–240.
Given an existing cell configuration represented by the Signvector and associated interior points w, identify the polygons crossed by the next new line.
polyzone(SignVector, w, A, b)
polyzone(SignVector, w, A, b)
SignVector |
current SignvVctor matrix |
w |
associated interior points |
A |
design matrix for full problem aka [1,z] |
b |
associated final column of design matrix aka [v] |
vector of indices of crossed polygons
Jiaying Gu
Profile likelihood and (GEE) score methods for estimation of random coefficient binary
response models. This function is a wrapper for rcbr
that uses the offset
argument to implement estimation of additional fixed parameters. It may be useful to
restrict the domain of the optimization over the profiled parameters, this can be
accomplished, at least for box constraints by setting omethod = "L-BFGS-B"
and specifying the lo
and up
accordingly.
prcbr( formula, b0, data, logL = TRUE, omethod = "BFGS", lo = -Inf, up = Inf, ... )
prcbr( formula, b0, data, logL = TRUE, omethod = "BFGS", lo = -Inf, up = Inf, ... )
formula |
is of the extended form enabled by the Formula package.
In the Cosslett, or current status, model the formula takes the form
|
b0 |
is either an initial value of the parameter for the Z covariates or a matrix of such values, in which case optimization occurs over this discrete set, when there is only one covariate then b0 is either scalar, or a vector. |
data |
data frame for formula variables |
logL |
if logL is TRUE the log likelihood is optimized, otherwise a GEE score criterion is minimized. |
omethod |
optimization method for |
lo |
lower bound(s) for the parameter domain |
up |
upper bound(s) for the parameter domain |
... |
other arguments to be passed to |
a list comprising the components:
output of the optimizer for the profiled parameters beta
output of the optimizer for the random coefficients eta
Given a fitted model by the Gautier Kitamura procedure predictions are made
at new design points given by the newdata
argument.
## S3 method for class 'GK' predict(object, ...)
## S3 method for class 'GK' predict(object, ...)
object |
is the fitted object of class "GK" |
... |
is expected to contain an argument |
a vector pf predicted probabilities
Given a fitted model by the rcbr NPMLE procedure predictions are made
at new design points given by the newdata
argument.
## S3 method for class 'KW2' predict(object, ...)
## S3 method for class 'KW2' predict(object, ...)
object |
is the fitted NPMLE object |
... |
is expected to contain an argument |
a vector pf predicted probabilities
bound.KW2
for a prediction function with bounds
Two methods are implemented for estimating binary response models with random coefficients: A nonparametric maximum likelihood method proposed by Cosslett (1986) and extended by Ichimura and Thompson (1998), and a (hemispherical) deconvolution method proposed by Gautier and and Kitamura (2013). The former is closely related to the NPMLE for mixture models of Kiefer and Wolfowitz (1956). The latter is an R translation of the matlab implementation of Gautier and Kitamura.
rcbr(formula, data, subset, offset, mode = "GK", ...)
rcbr(formula, data, subset, offset, mode = "GK", ...)
formula |
an expression of the generic form |
data |
is a |
subset |
specifies a subsample of the data used for fitting the model |
offset |
specifies a fixed shift in |
mode |
controls whether the Gautier and Kitamura, "GK", or Kiefer and Wolfowitz, "KW" methods are used. |
... |
miscellaneous other arguments to control fitting.
See |
The predict
method produces estimates of the probability of a "success"
(y = 1) for a particular vector, (z,v)
, when aggregated over the estimated
distribution of random coefficients.
The logLik
produces an evaluation of the log likelihood value
associated with a fitted model.
of object of class GK
, KW1
, with components described in
further detail in the respective fitting functions.
Jiaying Gu and Roger Koenker
Kiefer, J. and J. Wolfowitz (1956) Consistency of the Maximum Likelihood Estimator in the Presence of Infinitely Many Incidental Parameters, Ann. Math. Statist, 27, 887-906.
Cosslett, S. (1983) Distribution Free Maximum Likelihood Estimator of the Binary Choice Model, Econometrica, 51, 765-782.
Gautier, E. and Y. Kitamura (2013) Nonparametric estimation in random coefficients binary choice models, Ecoonmetrica, 81, 581-607.
Gu, J. and R. Koenker (2020) Nonparametric Maximum Likelihood Methods for Binary Response Models with Random Coefficients, J. Am. Stat Assoc
Groeneboom, P. and K. Hendrickx (2016) Current Status Linear Regression, preprint available from https://arxiv.org/abs/1601.00202.
Ichimura, H. and T. S. Thompson, (1998) Maximum likelihood estimation of a binary choice model with random coefficients of unknown distribution," Journal of Econometrics, 86, 269-295.
{ if(packageVersion("Rmosek") > "8.0.0"){ # Simple Test Problem for rcbr n <- 60 B0 = rbind(c(0.7,-0.7,1),c(-0.7,0.7,1)) z <- rnorm(n) v <- rnorm(n) s <- sample(0:1, n, replace = TRUE) XB0 <- cbind(1,z,v) %*% t(B0) u <- s * XB0[,1] + (1-s) * XB0[,2] y <- (u > 0) - 0 D <- data.frame(z = z, v = v, y = y) f <- rcbr(y ~ z + v, mode = "KW", data = D) plot(f) # Simple Test Problem for rcbr set.seed(15) n <- 100 B0 = rbind(c(0.7,-0.7,1),c(-0.7,0.7,1)) z <- rnorm(n) v <- rnorm(n) s <- sample(0:1, n, replace = TRUE) XB0 <- cbind(1,z,v) %*% t(B0) u <- s * XB0[,1] + (1-s) * XB0[,2] y <- (u > 0) - 0 D <- data.frame(z = z, v = v, y = y) f <- rcbr(y ~ z + v, mode = "GK", data = D) contour(f$u, f$v, matrix(f$w, length(f$u))) points(x = 0.7, y = -0.7, col = 2) points(x = -0.7, y = 0.7, col = 2) f <- rcbr(y ~ z + v, mode = "GK", data = D, T = 7) contour(f$u, f$v, matrix(f$w, length(f$u))) points(x = 0.7, y = -0.7, col = 2) points(x = -0.7, y = 0.7, col = 2) } }
{ if(packageVersion("Rmosek") > "8.0.0"){ # Simple Test Problem for rcbr n <- 60 B0 = rbind(c(0.7,-0.7,1),c(-0.7,0.7,1)) z <- rnorm(n) v <- rnorm(n) s <- sample(0:1, n, replace = TRUE) XB0 <- cbind(1,z,v) %*% t(B0) u <- s * XB0[,1] + (1-s) * XB0[,2] y <- (u > 0) - 0 D <- data.frame(z = z, v = v, y = y) f <- rcbr(y ~ z + v, mode = "KW", data = D) plot(f) # Simple Test Problem for rcbr set.seed(15) n <- 100 B0 = rbind(c(0.7,-0.7,1),c(-0.7,0.7,1)) z <- rnorm(n) v <- rnorm(n) s <- sample(0:1, n, replace = TRUE) XB0 <- cbind(1,z,v) %*% t(B0) u <- s * XB0[,1] + (1-s) * XB0[,2] y <- (u > 0) - 0 D <- data.frame(z = z, v = v, y = y) f <- rcbr(y ~ z + v, mode = "GK", data = D) contour(f$u, f$v, matrix(f$w, length(f$u))) points(x = 0.7, y = -0.7, col = 2) points(x = -0.7, y = 0.7, col = 2) f <- rcbr(y ~ z + v, mode = "GK", data = D, T = 7) contour(f$u, f$v, matrix(f$w, length(f$u))) points(x = 0.7, y = -0.7, col = 2) points(x = -0.7, y = 0.7, col = 2) } }
Two methods are implemented for estimating binary response models with random coefficients: A nonparametric maximum likelihood method proposed by Cosslett (1986) and extended by Ichimura and Thompson (1998), and a (hemispherical) deconvolution method proposed by Gautier and and Kitamura (2013). The former is closely related to the NPMLE for mixture models of Kiefer and Wolfowitz (1956). The latter is an R translation of the matlab implementation of Gautier and Kitamura.
rcbr.fit(x, y, offset = NULL, mode = "KW", control)
rcbr.fit(x, y, offset = NULL, mode = "KW", control)
x |
design matrix |
y |
binary response vector |
offset |
specifies a fixed shift in |
mode |
controls whether the Gautier and Kitamura, "GK", or Kiefer and Wolfowitz, "KW" methods are used. |
control |
control parameters for fitting methods
See |
The predict
method produces estimates of the probability of a "success"
(y = 1) for a particular vector, (z,v)
, when aggregated over the estimated
distribution of random coefficients.
of object of class GK
, KW1
, with components described in
further detail in the respective fitting functions.
Jiaying Gu and Roger Koenker
Kiefer, J. and J. Wolfowitz (1956) Consistency of the Maximum Likelihood Estimator in the Presence of Infinitely Many Incidental Parameters, Ann. Math. Statist, 27, 887-906.
Cosslett, S. (1983) Distribution Free Maximum Likelihood Estimator of the Binary Choice Model, Econometrica, 51, 765-782. Gautier, E. and Y. Kitamura (2013) Nonparametric estimation in random coefficients binary choice models, Ecoonmetrica, 81, 581-607.
Groeneboom, P. and K. Hendrickx (2016) Current Status Linear Regression, preprint available from https://arxiv.org/abs/1601.00202.
Ichimuma, H. and T. S. Thompson, (1998) Maximum likelihood estimation of a binary choice model with random coefficients of unknown distribution," Journal of Econometrics, 86, 269-295.
This is an implementation based on the matlab version of Gautier and
Kitamura's deconvolution method for the bivariate random coefficient
binary response model. Methods based on the fitted object are provided
for predict
, logLik
and plot
.requires orthopolynom
package for Gegenbauer polynomials
rcbr.fit.GK(X, y, control)
rcbr.fit.GK(X, y, control)
X |
the design matrix expected to have an intercept column of ones as the first column. |
y |
the binary response. |
control |
is a list of tuning parameters for the fitting,see
|
a list with components:
grid values
grid values
estimated function values on 2d u x v grid
design matrix
response vector
Gautier and Kitamura for original matlab version, Jiaying Gu and Roger Koenker for the R translation.
Gautier, E. and Y. Kitamura (2013) Nonparametric estimation in random coefficients binary choice models, Ecoonmetrica, 81, 581-607.
This is the original one dimensional version of the Cosslett model, also known as the current status model:
invoked with the formula y ~ v
. By default the algorithm computes a vector
of potential locations for the mass points of by finding interior
points of the intervals between the ordered
v
, and then solving a convex
optimization problem to determine these masses. Alternatively, a vector of
predetermined locations can be passed via the control argument. Additional
covariate effects can be accommodated by either specifying a fixed offset in
the call to rcbr
or by using the profile likelihood function prcbr
.
rcbr.fit.KW1(X, y, control)
rcbr.fit.KW1(X, y, control)
X |
the design matrix expected to have an intercept column of ones as the first column, the last column is presumed to contain values of the covariate that is designated to have coefficient one. |
y |
the binary response. |
control |
is a list of parameters for the fitting, see
|
a list with components:
x evaluation points for the fitted distribution
y estimated mass associated with the v
points
logLik the loglikelihood value of the fit
status mosek solution status
Jiaying Gu and Roger Koenker
Gu, J. and R. Koenker (2018) Nonparametric maximum likelihood estimation of the random coefficients binary choice model, preprint.
Exact NPMLE fitting requires that the uv
argument contain a matrix
whose rows represent points in the interior of the locally maximal polytopes
determined by the hyperplane arrangement of the observations. If it is not
provided it will be computed afresh here; since this can be somewhat time
consuming, uv
is included in the returned object so that it can be
reused if desired. Approximate NPMLE fitting can be achieved by specifying
an equally spaced grid of points at which the NPMLE can assign mass using
the arguments u
and v
. If the design matrix X
contains
only 2 columns, so we have the Cosslett, aka current status, model then the
polygons in the prior description collapse to intervals and the default method
computes the locally maximal count intervals and passes their interior points
to the optimizer of the log likelihood. Alternatively, as in the bivariate
case one can specify a grid to obtain an approximate solution.
rcbr.fit.KW2(x, y, control)
rcbr.fit.KW2(x, y, control)
x |
the design matrix expected to have an intercept column of ones as the first column, the last column is presumed to contain values of the covariate that is designated to have coefficient one. |
y |
the binary response. |
control |
is a list of parameters for the fitting, see
|
a list with components:
uv evaluation points for the fitted distribution
W estimated mass associated with the uv
points
logLik the loglikelihood value of the fit
status mosek solution status
Jiaying Gu and Roger Koenker
Gu, J. and R. Koenker (2018) Nonparametric maximum likelihood estimation of the random coefficients binary choice model, preprint.
Find (if possible) an interior point of a polytope solving a linear program
witness(A, b, s, epsbound = 1, epstol = 1e-07, presolve = 1, verb = 0)
witness(A, b, s, epsbound = 1, epstol = 1e-07, presolve = 1, verb = 0)
A |
Is a n by d matrix of hyperplane slope coefficients. |
b |
Is an n vector of hyperplane intercept coefficients. |
s |
Is an n vector of signs. |
epsbound |
Is a scalar tolerance controlling how close the witness point can be to an edge of the polytope. |
epstol |
Is a scalar tolerance for the LP convergence. |
presolve |
Controls whether Mosek should presolve the LP. |
verb |
Controls verbosity of Mosek solution. |
Solves LP:
S is diag(s), if at the solution eps > 0, then w is a valid interior point
otherwise the LP fails to find an interior point, another s must be tried.
Constructs a problem formulation that can be passed to Rmosek for solution.
List with components:
w proposed interior point at solution
fail indicator of whether w is a valid interior point