spreg.NSLX

class spreg.NSLX(y, x, coords, params=[(10, inf, 'exponential')], distance_metric='Euclidean', leafsize=30, slx_vars='All', var_flag=1, conv_flag=0, verbose=False, options=None, vm=False, name_y=None, name_x=None, name_ds=None, name_coords=None, latex=False)[source]

Estimation of the nonlinear SLX model - inverse distance power function and negative exponential distance function supported Includes output of all results.

Parameters:
ynumpy.ndarray or pandas.Series

nx1 array for dependent variable

xnumpy.ndarray or pandas object

Two dimensional array with n rows and one column for each independent (exogenous) variable, excluding the constant

coordsan n by 2 array or a selection of two columns from a data frame
paramsa list of tuples containing the two parameters for the construction

of the distance weights and the transformation: (k,distance_upper_bound,transformation) if the list consists of a single element, the same parameters are applied to all transformations default is [(10,np.inf,”exponential”)] for 10 knn neighbors, variable bandwidth and exponential transformation (see make_wnslx in UTILS)

distance_metric: metric for distance computations, either “Euclidean” (default) or “Arc”

(for decimal lat-lon degrees)

leafsizeparameter used to creat KDTree, default is 30
slx_varslist with True,False for selection of X variables to which SLX should be applied

default is “All”

var_flagflag for variance computation, default = 1 - uses analytical derivation,

= 0 - uses numerical approximation with inverse hessian

conv_flagflag for convergence diagnostics, default = 0 for no diagnostics

= 1 - prints our minimize convergence summary

verbosebool for intermediate results in nonlinear optimization, default is False
optionsoptions specific to scipy minimize, such as {“disp”:True}

(see scipy minimize docs)

vmbool

if True, include variance-covariance matrix in summary results

name_ystr

Name of dependent variable for use in output

name_xlist of strings

Names of independent variables for use in output

name_coordslist of strings

Names of coordinate variables used in distance matrix

name_dsstr

Name of dataset for use in output

latexbool

Specifies if summary is to be printed in latex format

Attributes:
outputdataframe

regression results pandas dataframe

summarystr

Summary of regression results and diagnostics (note: use in conjunction with the print command)

yn by 1 numpy array with dependent variable
xn by k array with explanatory variables, includes constant
xwn by h array with selected columns of X that will have the

W(alpha) transformation applied to them

wlist of sparse CSR arrays to use in lag transformation, if

list has a single element, same weights applied for all

nnumber of observations
knumber of explanatory variables in X (includes constant)
transformtuple of transformations, either “power” or “exponential”

when same transformation applies to all, tuple is a single element tuple (default is “power”)

verboseoption for nonlinear optimization, either False (default) or

True

optionsoptions specific to scipy minimize, such as {“disp”:True}

(see scipy minimize docs)

betasnumpy array with parameter estimates
utusum of squared residuals
ihessinverse of Hessian matrix
signestimate of residual variance (divided by n)
sig2same as sign
vmcoefficient variance-covariance matrix (sign x ihess)
predyvector of predicted values
uvector of residuals
llfloat

Log likelihood

aicfloat

Akaike information criterion

schwarzfloat

Schwarz information criterion

name_xvariable names for explanatory variables
name_dsdata set name
name_yname of dependent variable
titleoutput header
__init__(y, x, coords, params=[(10, inf, 'exponential')], distance_metric='Euclidean', leafsize=30, slx_vars='All', var_flag=1, conv_flag=0, verbose=False, options=None, vm=False, name_y=None, name_x=None, name_ds=None, name_coords=None, latex=False)[source]

Methods

__init__(y, x, coords[, params, ...])

Attributes

mean_y

std_y

property mean_y
property std_y