This function constructs a log-likelihood function for a single regression
coefficient (beta1), conditional on selection via the overall F-test.
The log-likelihood is approximated using Monte Carlo integration.
Usage
compute_likelihood_function(X, y, sigma_sq, alpha_ov = 0.05, B = 1e+06)
Arguments
- X
A numeric matrix of predictors (n x p), with beta1 corresponding to the first column.
- y
A numeric response vector of length n.
- sigma_sq
The noise variance.
- alpha_ov
The significance level for the overall F-test (default: 0.05).
- B
The number of Monte Carlo samples (default: 1e6).
Value
A function of one argument beta1 that returns the approximate
log-likelihood, conditional on selection.
If the observed data fails the selection condition, the function returns -Inf.