in svinfer/linear_model/linear_regression.py [0:0]
def fit(self, data):
"""
fit model
:return: a tuple; the 1st element is the estimated beta,
the 2nd element is the estimated sigma squared, the 3rd element is
the estimated variance-covariance matrix of the estimated beta.
"""
n, xtx, xty, yty = self._preprocess_data(data)
self.beta, self.sigma_sq, omega = LinearRegressionCoefficients(
n, xtx, xty, yty, self.x_s2, df_corrected=self.df_corrected
).estimate_all()
self.beta_vcov = LinearRegressionVariance(
n,
xtx,
xty,
yty,
self.sigma_sq,
omega,
self.x_s2,
n_replications=self.n_replications,
random_state=self.random_state,
).simulate_beta_vcov()
self.beta_standarderror = np.sqrt(np.diag(self.beta_vcov))
return self