We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is some pseudo code.
# Linear regression by Max Likelihood import numpy as np import scipy.stats as sts import scipy.optimize as opt y, x1, x2 = data def log_lik(y, x1, x2, beta_0, beta_1, beta_2, sigma): epsilon = y - beta_0 - beta_1 * x1 - beta_2 * x2 pdf_vals = sts.norm.pdf(epsilon, loc=0.0, scale=sigma) log_lik_func = np.log(pdf_vals).sum() return log_lik_func def crit_lr(params, *args): beta_0, beta_1, beta_2, sigma = params y, x1, x2 = args neg_log_lik = -log_lik(y, x1, x2, beta_0, beta_1, beta_2, sigma) return neg_log_lik beta_0_init = ? beta_1_init = ? beta_2_init = ? sigma_init = ? params_init = np.array([beta_0_init, beta_1_init, beta_2_init, sigma_init]) args_lr = (y, x1, x2) results = opt.minimize(crit_lr, params_init, args=(args_lr))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here is some pseudo code.
The text was updated successfully, but these errors were encountered: