fit_true_model: Fit true regression model

Description Usage Arguments Details Value Functions

View source: R/fit_true_model.R

Description

Fit true regression model E(Y_i | X_i) = alpha_0 + Phi(beta^T X_i), where Phi is the standard Normal CDF.

Usage

1
2
3
4
5
fit_true_model(xs, ys, init = NULL)

objective(alpha_betas, xs, ys)

gradient(alpha_betas, xs, ys)

Arguments

xs

n x p matrix of predictors

ys

Length-n vector of outcomes

init

Initial guess for parameters

alpha_betas

Value of coefficients to evaluate the function. First entry must be the intercept, and the rest are the other coefficients.

Details

Under the hood, the fitting is done using BFGS, as implemented in the optim function in R.

Value

fit_true_model returns a length-(p + 1) vector of coefficients, where the first is the intercept and the rest are the beta values. If the fitting algorithm did not converge, fit_true_model will fail with an error.

objective and gradient return the value of the objective function and gradient evaluated for some coefficients alpha_beta, respectively.

Functions


shiandy/bst235project documentation built on May 14, 2019, 2:01 a.m.