Plot Interaction of Categorical Factors

Plot Interaction of Categorical Factors Link to Notebook GitHub In this example, we will vizualize the interaction between categorical factors. First, we will create some categorical data are initialized. Then plotted using the interaction_plot function which internally recodes the x-factor categories to ingegers. In [1]: import numpy as np import matplotlib.pyplot as plt import pandas as pd from statsmodels.graphics.factorplots import interaction_plot In [2]: np.random.

Poisson.cdf()

statsmodels.discrete.discrete_model.Poisson.cdf Poisson.cdf(X) [source] Poisson model cumulative distribution function Parameters: X : array-like X is the linear predictor of the model. See notes. Returns: The value of the Poisson CDF at each point. : Notes The CDF is defined as where assumes the loglinear model. I.e., The parameter X is in the above formula.

Pitfalls

Pitfalls This page lists issues which may arise while using statsmodels. These can be the result of data-related or statistical problems, software design, ?non-standard? use of models, or edge cases. statsmodels provides several warnings and helper functions for diagnostic checking (see this blog article for an example of misspecification checks in linear regression). The coverage is of course not comprehensive, but more warnings and diagnostic functions will be added over time. While the under

PHRegResults.wald_test()

statsmodels.duration.hazard_regression.PHRegResults.wald_test PHRegResults.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. tuple : A

PHRegResults.t_test()

statsmodels.duration.hazard_regression.PHRegResults.t_test PHRegResults.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 : A tuple

PHRegResults.summary()

statsmodels.duration.hazard_regression.PHRegResults.summary PHRegResults.summary(yname=None, xname=None, title=None, alpha=0.05) [source] Summarize the proportional hazards regression results. Parameters: yname : string, optional Default is y xname : list of strings, optional Default is x# 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 interval

PHRegResults.remove_data()

statsmodels.duration.hazard_regression.PHRegResults.remove_data PHRegResults.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 an attrib

PHRegResults.save()

statsmodels.duration.hazard_regression.PHRegResults.save PHRegResults.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. Notes If rem

PHRegResults.predict()

statsmodels.duration.hazard_regression.PHRegResults.predict PHRegResults.predict(endog=None, exog=None, strata=None, offset=None, pred_type='lhr') [source] Returns predicted values from the fitted proportional hazards regression model. Parameters: params : array-;like The proportional hazards model parameters. endog : array-like Duration (time) values at which the predictions are made. Only used if pred_type is either ?cumhaz? or ?surv?. If using model exog, defaults to model endog (time

PHRegResults.load()

statsmodels.duration.hazard_regression.PHRegResults.load classmethod PHRegResults.load(fname) load a pickle, (class method) Parameters: fname : string or filehandle fname can be a string to a file path or filename, or a filehandle. Returns: unpickled instance :