spaloess: Spatially Local Polynomial Regression Fitting

Description Usage Arguments Details Author(s) Examples

Description

The first layer of the Spatial locally weighted regression, using local fitting with different type of distance calculation.

Usage

1
2
3
4
5
6
spaloess(formula, data, weights, subset, na.action, model = FALSE,
  napred = TRUE, span = 0.75, enp.target, degree = 2L,
  parametric = FALSE, distance = "Latlong", alltree = FALSE,
  drop_square = FALSE, normalize = FALSE, family = c("gaussian",
  "symmetric"), method = c("loess", "model.frame"),
  control = loess.control(...), ...)

Arguments

formula

a formula specifying the numeric response and one to four numeric predictors.

data

an optional data from, list or environment containing the variables in the model. If not found in 'data', the variables are taken from 'environment', typically the environment from which 'loess' is called.

weights

optional weights for each case

subset

an optional specification of a subset of the data to be used

na.action

the action to be taken with missing values in the response or predictors. The default is given by 'getOption("na.action")'.

model

Should the model frame be returned?

napred

Should missing observations in the dataset be predicted. Default is TRUE.

span

The parameter alpha which controls the portion of data points used in the local fit.

enp.target

An alternative way to specify 'span', as the approximate equivalent number of parameters to be used.

degree

The degree of the polynomials to be used, normally 1 or 2. (Degree 0 is also allowed, but see the 'Note'.)

parametric

should any terms be fitted globally rather than locally? Terms can be specified by name, number or as a logical vector of the same length as the number of predictors.

distance

Options: "Euclid", or "Latlong" which is for great circle distance

alltree

Should the kd-tree built based on all observations or only non-NA observations.

drop_square

For fits with more than one predictor and 'degree = 2', should the quadratic term be dropped for particular predictors? Terms are specified in the same way as for 'parametric'.

normalize

Should the predictors be normalized to a common scale if there is more than one? The normalization used is to set the 10 "Latlong" distance.

family

If 'gaussian' fitting is by least-squares, and if 'symmetric' a re-descending M estimator is used with Tukey's bi-weight function.

method

Fit the model or just extract the model frame.

control

control parameters: see 'loess.control'.

...

arguments passed to or from other methods.

Details

This spaloess function is the first wrapper of the spatial loess fitting procedure. It checks all the validity of all input arguments, and formats arguments like drop_square, parametric. Also generate other important arguments, like iteration, and pass all arguments into the second wrapper function: newsimpleLoess

Author(s)

Xiaosu Tong, based on 'loess' function of B. D. Ripley, and 'cloess' package of Cleveland, Grosse and Shyu.

Examples

1
2
3
4
5
6
    set.seed(66)
    x1 <- rnorm(100, mean=-100, sd=10)
    x2 <- rnorm(100, mean=38, sd=4)
    y <- 0.1*x1 + 1*x2 - 10 + rnorm(100, 0, 1.3)
    testdata <- data.frame(LON = x1, LAT = x2, tmax = y)
    cars.lo <- spaloess(tmax ~ LON + LAT, testdata, distance = "Latlong", napred = FALSE)

XiaosuTong/Spaloess documentation built on May 9, 2019, 11:06 p.m.