genmod.cov_struct.Nested()

statsmodels.genmod.cov_struct.Nested class statsmodels.genmod.cov_struct.Nested(cov_nearest_method='clipped') [source] A nested working dependence structure. A working dependence structure that captures a nested hierarchy of groups, each level of which contributes to the random error term of the model. When using this working covariance structure, dep_data of the GEE instance should contain a n_obs x k matrix of 0/1 indicators, corresponding to the k subgroups nested under the top-level grou

genmod.cov_struct.Independence()

statsmodels.genmod.cov_struct.Independence class statsmodels.genmod.cov_struct.Independence(cov_nearest_method='clipped') [source] An independence working dependence structure. Methods covariance_matrix(expval, index) Returns the working covariance or correlation matrix for a given cluster of data. covariance_matrix_solve(expval, index, ...) Solves matrix equations of the form covmat * soln = rhs and returns the values of soln, where covmat is the covariance matrix represented by this clas

genmod.cov_struct.GlobalOddsRatio()

statsmodels.genmod.cov_struct.GlobalOddsRatio class statsmodels.genmod.cov_struct.GlobalOddsRatio(endog_type) [source] Estimate the global odds ratio for a GEE with ordinal or nominal data. Notes The following data structures are calculated in the class: ?ibd? is a list whose i^th element ibd[i] is a sequence of integer pairs (a,b), where endog_li[i][a:b] is the subvector of binary indicators derived from the same ordinal value. cpp is a dictionary where cpp[group] is a map from cut-point pa

genmod.cov_struct.Exchangeable

statsmodels.genmod.cov_struct.Exchangeable class statsmodels.genmod.cov_struct.Exchangeable [source] An exchangeable working dependence structure. Methods covariance_matrix(expval, index) Returns the working covariance or correlation matrix for a given cluster of data. covariance_matrix_solve(expval, index, ...) Solves matrix equations of the form covmat * soln = rhs and returns the values of soln, where covmat is the covariance matrix represented by this class. initialize(model) Called b

genmod.cov_struct.CovStruct()

statsmodels.genmod.cov_struct.CovStruct class statsmodels.genmod.cov_struct.CovStruct(cov_nearest_method='clipped') [source] A base class for correlation and covariance structures of grouped data. Each implementation of this class takes the residuals from a regression model that has been fitted to grouped data, and uses them to estimate the within-group dependence structure of the random errors in the model. The state of the covariance structure is represented through the value of the class

genmod.cov_struct.Autoregressive()

statsmodels.genmod.cov_struct.Autoregressive class statsmodels.genmod.cov_struct.Autoregressive(dist_func=None) [source] An autoregressive working dependence structure. The dependence is defined in terms of the time component of the parent GEE class. Time represents a potentially multidimensional index from which distances between pairs of observations can be determined. The correlation between two observations in the same cluster is dep_params^distance, where dep_params is the autocorrelati

Generalized Method of Moments gmm

Generalized Method of Moments gmm statsmodels.gmm contains model classes and functions that are based on estimation with Generalized Method of Moments. Currently the general non-linear case is implemented. An example class for the standard linear instrumental variable model is included. This has been introduced as a test case, it works correctly but it does not take the linear structure into account. For the linear case we intend to introduce a specific implementation which will be faster and n

Generalized Linear Models (Formula)

Generalized Linear Models (Formula) Link to Notebook GitHub This notebook illustrates how you can use R-style formulas to fit Generalized Linear Models. To begin, we load the Star98 dataset and we construct a formula and pre-process the data: In [1]: from __future__ import print_function import statsmodels.api as sm import statsmodels.formula.api as smf star98 = sm.datasets.star98.load_pandas().data formula = 'SUCCESS ~ LOWINC + PERASIAN + PERBLACK + PERHISP + PCTCHRT + \

Generalized Linear Models

Generalized Linear Models Link to Notebook GitHub In [1]: from __future__ import print_function import numpy as np import statsmodels.api as sm from scipy import stats from matplotlib import pyplot as plt GLM: Binomial response data Load data In this example, we use the Star98 dataset which was taken with permission from Jeff Gill (2000) Generalized linear models: A unified approach. Codebook information can be obtained by typing: In [2]: print(sm.datasets.star98.NOTE)

Generalized Linear Models

Generalized Linear Models Generalized linear models currently supports estimation using the one-parameter exponential families See Module Reference for commands and arguments. Examples # Load modules and data import statsmodels.api as sm data = sm.datasets.scotland.load() data.exog = sm.add_constant(data.exog) # Instantiate a gamma family model with the default link function. gamma_model = sm.GLM(data.endog, data.exog, family=sm.families.Gamma()) gamma_results = gamma_model.fit() Detailed ex