Skip to contents

This function numerically approximates the conditional maximum likelihood estimate (MLE) of a single regression coefficient using a Monte Carlo approximation to the selective likelihood, conditional on passing the overall F-test.

Usage

compute_MLE(X, y, sigma_sq, alpha_ov, interval = c(-10, 10), B = 1e+06)

Arguments

X

A numeric matrix of predictor variables (n x p), with the first column corresponding to beta1.

y

A numeric response vector of length n.

sigma_sq

The noise variance. If unknown, it should be estimated beforehand.

alpha_ov

The significance level for the overall F-test (used in defining the selection region).

interval

A numeric vector of length 2 giving the search interval for beta1 (default: c(-10, 10)).

B

The number of Monte Carlo samples used to approximate the likelihood (default: 1e6).

Value

A list containing:

beta

The MLE of beta1 (a single coefficient) under the selective likelihood.

max_likelihood

The maximum log-likelihood value achieved at the optimal beta1.