public class GwrInterpolator extends Object
A Note on the Suitability of This Implementation: Anyone who values his own time should respect the time of others. With that regard, I believe it appropriate to make this note about the current state of the Tinfour GWR implementation. While I believe that code is implemented correctly, it is not complete. Statistics such as R values and F scores are not yet available. The Tinfour GWR classes also lacks tools for detecting multi collinearities in model coefficients. These classes were developed with a specific application in mind: the modeling of terrain and bathymetry. And while they can be applied to many other problems, potential users should consider whether the tool is suitable to their particular requirements.
Development Notes
The current implementation of this class supports a family of surface
models based on polynomials p(x, y) of order 3 or less. While this approach
is appropriate for the original intent of this class, modeling terrain,
there is no reason why the class cannot be adapted to support
other models based on continuous, real-valued variables.
One of the special considerations in terrain modeling is "mass production". Creating a raster grid from unstructured data can involve literally millions of interpolation operations. The design of this class reflects that requirement. In particular, it featured the reuse of Java objects and arrays to avoid the cost of constructing or allocating new instances. However, recent improvements in Java's handling of short-persistence objects (through escape analysis) have made some of these considerations less pressing. So future work may not be coupled to the same approach as the existing implementation.
| Modifier and Type | Class and Description |
|---|---|
static class |
GwrInterpolator.BootstrapResult
A container for the results from a bootstrap analysis
|
| Constructor and Description |
|---|
GwrInterpolator()
Standard constructor.
|
| Modifier and Type | Method and Description |
|---|---|
GwrInterpolator.BootstrapResult |
bootstrap(SurfaceModel model,
BandwidthSelectionMethod bandwidthMethod,
double bandwidthParameter,
double qx,
double qy,
int nSamples,
double[][] samples,
int nRepetitions,
double threshold)
Perform a variation of a statistical bootstrap analysis in which the
resampling is based on random selection of samples without repetition.
|
double |
getAICc()
Get the Akaike information criterion (corrected) organized so that the
minimum value is preferred.
|
long |
getAutomaticBandwidthTestCount()
Gets the number of tests performed in selecting a bandwidth
via the automatic selection method.
|
double |
getBandwidth()
Get the bandwidth setting used in the most recent interpolation.
|
BandwidthSelectionMethod |
getBandwidthSelectionMethod()
Gets the method used for the most recent bandwidth selection.
|
double[] |
getCoefficients()
Gets the coefficients computed by the most recent regression
calculation, or a zero-length array if no results are available.
|
double |
getEffectiveDegreesOfFreedom()
Get the effective degrees of freedom for the a chi-squared distribution
which approximates the distribution of the GWR.
|
double |
getLeungDelta1()
Get leung's delta parameter
|
double |
getLeungDelta2()
Get Leung's delta2 parameter.
|
double[] |
getPredictionInterval(double alpha)
Gets the prediction interval at the interpolation coordinates
on the observed response for the most recent call to computeRegression.
|
double |
getPredictionIntervalHalfRange(double alpha)
Gets a value equal to one half of the range of the prediction interval
on the observed response at the interpolation coordinates for the
most recent call to computeRegression().
|
double[] |
getResiduals()
Gets the residuals from the most recent regression calculation.
|
double |
getResidualSumOfTheSquares()
Gets the residual sum of the squared errors (residuals) for
the predicted versus the observed values at the sample locations.
|
double[][] |
getSamples()
Gets the samples from the most recent computation.
|
double |
getSigmaML()
Gets the ML Sigma value used in the AICc calculation.
|
double |
getSlope()
Gets the slope for the most recent computation expressed as
the fraction change in elevation over a horizontal distance
(i.e. rise-over-run).
|
double |
getStandardDeviation()
Gets an unbiased estimate of the the standard deviation
of the residuals for the predicted values for all samples.
|
SurfaceModel |
getSurfaceModel()
Gets the surface model for the most recently performed
interpolation.
|
double[] |
getSurfaceNormal()
Gets the unit normal to the surface at the position of the most
recent interpolation.
|
double |
getVariance()
Gets an unbiased estimate of the variance of the residuals
for the predicted values for all samples.
|
double[] |
getWeights()
Gets an array of weights from the most recent computation.
|
double |
interpolate(SurfaceModel model,
BandwidthSelectionMethod bandwidthMethod,
double bandwidthParameter,
double qx,
double qy,
int nSamples,
double[][] samples)
Performs regression using the specified surface model and
bandwidth-selection method.
|
double |
interpolateUsingAutomaticModelAndBandwidth(double qx,
double qy,
int nSamples,
double[][] samples)
Performs regression using automatic bandwidth selection and testing all
available models using the AICc criterion.
|
public double interpolateUsingAutomaticModelAndBandwidth(double qx,
double qy,
int nSamples,
double[][] samples)
Values are assigned to samples using the specified valuator, or by taking their z-values directly if no valuator (e.g. a null) is specified.
qx - the x coordinate for the interpolation pointqy - the y coordinate for the interpolation pointnSamples - the number of samples to processsamples - a nSamples-by-3 array giving the x, y, and z
coordinates for input samples.public double interpolate(SurfaceModel model, BandwidthSelectionMethod bandwidthMethod, double bandwidthParameter, double qx, double qy, int nSamples, double[][] samples)
When in doubt, a good general specification for bandwidth-selection is to use BandwidthSelectionMethod.FixedProportionalBandwidth with a bandwidth parameter of 0.5. The model should be selected based on the anticipated behavior of the surface. SurfaceModel.Cubic is usually a good choice for all but flat surfaces.
model - a valid model specificationbandwidthMethod - a valid bandwidth-selection method specificationbandwidthParameter - a bandwidth parameterqx - the x coordinate of the interpolation pointqy - the y coordinate of the interpolation pointnSamples - the number of samples for input processingsamples - an array of dimensions nSamples-by-3 giving x, y, and z
coordinates for input samples.public double getAICc()
public double[] getCoefficients()
public double getEffectiveDegreesOfFreedom()
The definition of this method is based on Leung (2000).
public double getLeungDelta1()
public double getLeungDelta2()
public double[] getPredictionInterval(double alpha)
alpha - the significance level (typically 0..05, etc).public double getPredictionIntervalHalfRange(double alpha)
alpha - the significance level (typically 0..05, etc).public double[] getResiduals()
public double getResidualSumOfTheSquares()
public double[][] getSamples()
public double getSlope()
public double getStandardDeviation()
public double getSigmaML()
public SurfaceModel getSurfaceModel()
public double[] getSurfaceNormal()
public double getVariance()
public double[] getWeights()
public GwrInterpolator.BootstrapResult bootstrap(SurfaceModel model, BandwidthSelectionMethod bandwidthMethod, double bandwidthParameter, double qx, double qy, int nSamples, double[][] samples, int nRepetitions, double threshold)
model - the model to be used to represent the surfacebandwidthMethod - the method used for selecting bandwidthbandwidthParameter - the input parameter for the specified methodqx - X coordinate of query pointqy - Y coordinate of query pointnSamples - the number of samples for processingsamples - an nSamples-by-3 array of samples for processingnRepetitions - number of sub-samples to evaluate for bootstrap
analysis.threshold - the probability of accepting any single sample into
the subsample.public double getBandwidth()
public long getAutomaticBandwidthTestCount()
public BandwidthSelectionMethod getBandwidthSelectionMethod()
Copyright © 2021. All rights reserved.