Generalized Least Squares

Generalized Least Squares Link to Notebook GitHub In [1]: from __future__ import print_function import statsmodels.api as sm import numpy as np from statsmodels.iolib.table import (SimpleTable, default_txt_fmt) The Longley dataset is a time series dataset: In [2]: data = sm.datasets.longley.load() data.exog = sm.add_constant(data.exog) print(data.exog[:5]) [[ 1. 83. 234289. 2356. 1590. 107608. 1947. ] [ 1. 88.5 259426.

Generalized Estimating Equations

Generalized Estimating Equations Generalized Estimating Equations estimate generalized linear models for panel, cluster or repeated measures data when the observations are possibly correlated withing a cluster but uncorrelated across clusters. It supports estimation of the same one-parameter exponential families as Generalized Linear models (GLM). See Module Reference for commands and arguments. Examples The following illustrates a Poisson regression with exchangeable correlation within cluste

GEEResults.wald_test()

statsmodels.genmod.generalized_estimating_equations.GEEResults.wald_test GEEResults.wald_test(r_matrix, cov_p=None, scale=1.0, invcov=None, use_f=None) Compute a Wald-test for a joint linear hypothesis. Parameters: r_matrix : array-like, str, or tuple array : An r x k array where r is the number of restrictions to test and k is the number of regressors. It is assumed that the linear combination is equal to zero. str : The full hypotheses to test can be given as a string. See the examples.

GEEResults.t_test()

statsmodels.genmod.generalized_estimating_equations.GEEResults.t_test GEEResults.t_test(r_matrix, cov_p=None, scale=None, use_t=None) Compute a t-test for a each linear hypothesis of the form Rb = q Parameters: r_matrix : array-like, str, tuple array : If an array is given, a p x k 2d array or length k 1d array specifying the linear restrictions. It is assumed that the linear combination is equal to zero. str : The full hypotheses to test can be given as a string. See the examples. tuple :

GEEResults.summary()

statsmodels.genmod.generalized_estimating_equations.GEEResults.summary GEEResults.summary(yname=None, xname=None, title=None, alpha=0.05) [source] Summarize the GEE regression results Parameters: yname : string, optional Default is y xname : list of strings, optional Default is var_## for ## in p the number of regressors title : string, optional Title for the top table. If not None, then this replaces the default title alpha : float significance level for the confidence intervals co

GEEResults.standard_errors()

statsmodels.genmod.generalized_estimating_equations.GEEResults.standard_errors GEEResults.standard_errors(cov_type='robust') [source] This is a convenience function that returns the standard errors for any covariance type. The value of bse is the standard errors for whichever covariance type is specified as an argument to fit (defaults to ?robust?). Parameters: cov_type : string One of ?robust?, ?naive?, or ?bias_reduced?. Determines the covariance used to compute standard errors. Defaults

GEEResults.sensitivity_params()

statsmodels.genmod.generalized_estimating_equations.GEEResults.sensitivity_params GEEResults.sensitivity_params(dep_params_first, dep_params_last, num_steps) [source] Refits the GEE model using a sequence of values for the dependence parameters. Parameters: dep_params_first : array-like The first dep_params in the sequence dep_params_last : array-like The last dep_params in the sequence num_steps : int The number of dep_params in the sequence Returns: results : array-like The GEERe

GEEResults.save()

statsmodels.genmod.generalized_estimating_equations.GEEResults.save GEEResults.save(fname, remove_data=False) save a pickle of this instance Parameters: fname : string or filehandle fname can be a string to a file path or filename, or a filehandle. remove_data : bool If False (default), then the instance is pickled without changes. If True, then all arrays with length nobs are set to None before pickling. See the remove_data method. In some cases not all arrays will be set to None. Not

GEEResults.remove_data()

statsmodels.genmod.generalized_estimating_equations.GEEResults.remove_data GEEResults.remove_data() remove data arrays, all nobs arrays from result and model This reduces the size of the instance, so it can be pickled with less memory. Currently tested for use with predict from an unpickled results and model instance. Warning Since data and some intermediate results have been removed calculating new statistics that require them will raise exceptions. The exception will occur the first time

GEEResults.predict()

statsmodels.genmod.generalized_estimating_equations.GEEResults.predict GEEResults.predict(exog=None, transform=True, *args, **kwargs) Call self.model.predict with self.params as the first argument. Parameters: exog : array-like, optional The values for which you want to predict. transform : bool, optional If the model was fit via a formula, do you want to pass exog through the formula. Default is True. E.g., if you fit a model y ~ log(x1) + log(x2), and transform is True, then you can pa