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:
- y
numpy.ndarray
orpandas.Series
nx1 array for dependent variable
- x
numpy.ndarray
orpandas
object
Two dimensional array with n rows and one column for each independent (exogenous) variable, excluding the constant
- coords
an
n
by
2array
ora
selection
of
two
columns
from
a
data
frame
- params
a
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)
- leafsize
parameter
used
to
creat
KDTree
,default
is
30 - slx_vars
list
with
True,Falsefor
selection
of
X
variables
to
which
SLX
should
be
applied
default is “All”
- var_flag
flag
for
variance
computation
,default
= 1 -uses
analytical
derivation, = 0 - uses numerical approximation with inverse hessian
- conv_flag
flag
for
convergence
diagnostics
,default
= 0for
no
diagnostics
= 1 - prints our minimize convergence summary
- verbosebool
for
intermediate
results
in
nonlinear
optimization
,default
is
False
- options
options
specific
to
scipy
minimize
,such
as
{“disp”:True} (see scipy minimize docs)
- vmbool
if True, include variance-covariance matrix in summary results
- name_y
str
Name of dependent variable for use in output
- name_x
list
of
strings
Names of independent variables for use in output
- name_coords
list
of
strings
Names of coordinate variables used in distance matrix
- name_ds
str
Name of dataset for use in output
- latexbool
Specifies if summary is to be printed in latex format
- y
- Attributes:
- output
dataframe
regression results pandas dataframe
- summary
str
Summary of regression results and diagnostics (note: use in conjunction with the print command)
- y
n
by
1numpy
array
with
dependent
variable
- x
n
by
k
array
with
explanatory
variables
,includes
constant
- xw
n
by
h
array
with
selected
columns
of
X
that
will
have
the
W(alpha) transformation applied to them
- w
list
of
sparse
CSR
arrays
to
use
in
lag
transformation
,if
list has a single element, same weights applied for all
- n
number
of
observations
- k
number
of
explanatory
variables
in
X
(includes
constant
) - transform
tuple
of
transformations
,either
“power” or “exponential” when same transformation applies to all, tuple is a single element tuple (default is “power”)
- verbose
option
for
nonlinear
optimization
,either
False
(default
)or
True
- options
options
specific
to
scipy
minimize
,such
as
{“disp”:True} (see scipy minimize docs)
- betas
numpy
array
with
parameter
estimates
- utu
sum
of
squared
residuals
- ihess
inverse
of
Hessian
matrix
- sign
estimate
of
residual
variance
(divided
by
n
) - sig2
same
as
sign
- vm
coefficient
variance-covariancematrix
(sign
x
ihess
) - predy
vector
of
predicted
values
- u
vector
of
residuals
- ll
float
Log likelihood
- aic
float
Akaike information criterion
- schwarz
float
Schwarz information criterion
- name_x
variable
names
for
explanatory
variables
- name_ds
data
set
name
- name_y
name
of
dependent
variable
- title
output
header
- output
- __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
- property mean_y¶
- property std_y¶