#NEWLINE# def get_prediction( self , exog = None , transform = True , weights = None , row_labels = None , pred_kwds = None ) : #NEWLINE# #INDENT# "\n    compute prediction results\n\n    Parameters\n    ----------\n    exog : array-like, optional\n        The values for which you want to predict.\n    transform : bool, optional\n        If the model was fit via a formula, do you want to pass\n        exog through the formula. Default is True. E.g., if you fit\n        a model y ~ log(x1) + log(x2), and transform is True, then\n        you can pass a data structure that contains x1 and x2 in\n        their original form. Otherwise, you'd need to log the data\n        first.\n    weights : array_like, optional\n        Weights interpreted as in WLS, used for the variance of the predicted\n        residual.\n    args, kwargs :\n        Some models can take additional arguments or keywords, see the\n        predict method of the model for the details.\n\n    Returns\n    -------\n    prediction_results : instance\n        The prediction results instance contains prediction and prediction\n        variance and can on demand calculate confidence intervals and summary\n        tables for the prediction of the mean and of new observations.\n\n    " #NEWLINE# if ( transform and hasattr ( self . model , 'formula' ) and ( exog is not None ) ) : #NEWLINE# #INDENT# from patsy import dmatrix #NEWLINE# exog = dmatrix ( self . model . data . design_info . builder , exog ) #NEWLINE# #UNINDENT# if ( exog is not None ) : #NEWLINE# #INDENT# if ( row_labels is None ) : #NEWLINE# #INDENT# if hasattr ( exog , 'index' ) : #NEWLINE# #INDENT# row_labels = exog . index #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# row_labels = None #NEWLINE# #UNINDENT# #UNINDENT# exog = np . asarray ( exog ) #NEWLINE# if ( ( exog . ndim == 1 ) and ( ( self . model . exog . ndim == 1 ) or ( self . model . exog . shape [ 1 ] == 1 ) ) ) : #NEWLINE# #INDENT# exog = exog [ : , None ] #NEWLINE# #UNINDENT# exog = np . atleast_2d ( exog ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# exog = self . model . exog #NEWLINE# if ( weights is None ) : #NEWLINE# #INDENT# weights = getattr ( self . model , 'weights' , None ) #NEWLINE# #UNINDENT# if ( row_labels is None ) : #NEWLINE# #INDENT# row_labels = getattr ( self . model . data , 'row_labels' , None ) #NEWLINE# #UNINDENT# #UNINDENT# if ( weights is not None ) : #NEWLINE# #INDENT# weights = np . asarray ( weights ) #NEWLINE# if ( ( weights . size > 1 ) and ( ( weights . ndim != 1 ) or ( weights . shape [ 0 ] == exog . shape [ 1 ] ) ) ) : #NEWLINE# #INDENT# raise ValueError ( 'weights has wrong shape' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( pred_kwds is None ) : #NEWLINE# #INDENT# pred_kwds = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# predicted_mean = self . model . predict ( self . params , exog , ** pred_kwds ) #NEWLINE# covb = self . cov_params ( ) #NEWLINE# var_pred_mean = ( exog * np . dot ( covb , exog . T ) . T ) . sum ( 1 ) #NEWLINE# var_resid = ( self . scale / weights ) #NEWLINE# if ( self . cov_type == 'fixed scale' ) : #NEWLINE# #INDENT# var_resid = ( self . cov_kwds [ 'scale' ] / weights ) #NEWLINE# #UNINDENT# dist = [ 'norm' , 't' ] [ self . use_t ] #NEWLINE# return PredictionResults ( predicted_mean , var_pred_mean , var_resid , df = self . df_resid , dist = dist , row_labels = row_labels )