Description Usage Arguments Details Value References See Also Examples

Estimates a logit model with two choices by maximizing a locally weighted likelihood function – the logit equivalent of cparlwr

1 2 3 |

`form ` |
Model formula |

`nonpar ` |
List of either one or two variables for |

`window ` |
Window size. Default: 0.25. |

`bandwidth ` |
Bandwidth. Default: not used. |

`kern ` |
Kernel weighting functions. Default is the tri-cube. Options include "rect", "tria", "epan", "bisq", "tcub", "trwt", and "gauss". |

`distance ` |
Options: "Euclid", "Mahal", or "Latlong" for Euclidean, Mahalanobis, or "great-circle" geographic distance.
May be abbreviated to the first letter but must be capitalized.
Note: |

`target` |
If |

`data ` |
A data frame containing the data. Default: use data in the current working directory |

`minp` |
Specifies a limit for the estimated probability. Any estimated probability lower than |

The list of explanatory variables is specified in the base model formula while *Z* is specified using *nonpar*.
*X* can include any number of explanatory variables, but *Z* must have at most two.

The model is estimated by maximizing the following weighted log-likelihood function at each target point:

*∑ w_i { y_i log(P_i) + (1-y_i) log(1-P_i ) } *

where y is the discrete dependent variable, X is the set of explanatory variables, and
*P_i = exp(X_i β) / (1+ exp(X_i β)).*

When *Z* includes a single variable, *w_i* is a simple kernel weighting function: * w_i = K((z_i - z_0 )/(sd(z)*h)) *.
When *Z* includes two variables (e.g., nonpar=~z1+z2), the method for specifying *w* depends on the *distance* option.
Under either option, the *i*th row of the matrix *Z* = (z1, z2) is transformed such
that *z_i = sqrt(z_i * V * t(z_i)).* Under the "Mahal" option, *V* is the inverse of cov(*Z*).
Under the *"Euclid"* option, *V* is the inverse of diag(cov(*Z*)).
After this transformation, the weights again reduce to the simple kernel weighting function *K((z_i - z_0 )/(sd(z)*h))*.
*h* is specified by the *bandwidth* or *window* option.

The great circle formula is used to construct the distances used to form the weights when *distance = "Latlong"*;
in this case, the variable list for *nonpar* must be listed as
*nonpar = ~latitude+longitude* (or *~lo+la* or *~lat+long*, etc), with the longitude and latitude variables expressed in degrees
(e.g., -87.627800 and 41.881998 for one observation of longitude and latitude, respectively).
The order in which latitude and longitude are listed does not matter and the function only looks for the
first two letters to determine which variable is latitude and which is longitude.
It is important to note that the great circle distance measure is left in miles rather than being standardized.
Thus, the window option should be specified when *distance = "Latlong"* or the bandwidth should be adjusted to account for the scale.
The kernel weighting function becomes *K(distance/h)* under the *"Latlong"* option.

Following White (1982), the covariance matrix for a quasi-maximum likelihood model is *A^{-1}BA^{-1} *, where

*A = ∑ w_i d^2LnL_i/dβ dβ' *

*B = ∑ w_i^2 (dLnL_i/dβ)(dLnL_i/dβ') *

For the logit model,

* A = ∑ w_i P_i(1 - P_i) X_i X_i' *

* B = ∑ w_i^2 (y_i - P_i)^2 X_i X_i' *

The covariance matrix is calculated at all target points and the implied standard errors are then interpolated to each data point.

Available kernel weighting functions include the following:

Kernel | Call abbreviation | Kernel function K(z) |

Rectangular | ``rect'' | 1/2 * I(|z|<1) |

Triangular | ``tria'' | (1-|z|) * I(|z|<1) |

Epanechnikov | ``epan'' | 3/4 * (1-z^2)*I(|z| < 1) |

Bi-Square | ``bisq'' | 15/16 * (1-z^2)^2 * I(|z| < 1) |

Tri-Cube | ``tcub'' | 70/81 * (1-|z|^3)^3 * I(|z| < 1) |

Tri-Weight | ``trwt'' | 35/32 * (1-z^2)^3 * I(|z| < 1) |

Gaussian | ``gauss'' | 2pi^{-.5} exp(-z^2/2) |

`target` |
The target points for the original estimation of the function. |

`xcoef.target` |
Estimated coefficients, |

`xcoef.target.se` |
Standard errors for |

`xcoef` |
Estimated coefficients, |

`xcoef.se` |
Standard errors for |

`p` |
The estimated probabilities. |

`lnl` |
The log-likelihood value. |

Fan, Jianqing, Nancy E. Heckman, and M.P. Wand, "Local Polynomial Kernel Regression for Generalized Linear Models and Quasi-Likelihood Functions,"
*Journal of the American Statistical Association* 90 (1995), 141-150.

Loader, Clive. *Local Regression and Likelihood.* New York: Springer, 1999.

McMillen, Daniel P. and John F. McDonald, "Locally Weighted Maximum Likelihood Estimation: Monte Carlo Evidence and an Application,"
in Luc Anselin, Raymond J.G.M. Florax, and Sergio J. Rey, eds., *Advances in Spatial Econometrics*, Springer-Verlag, New York (2004), 225-239.

Tibshirani, Robert and Trevor Hastie, "Local Likelihood Estimation," *Journal of the American Statistical Association* 82 (1987), 559-568.

cparprobit

cparmlogit

gmmlogit

gmmprobit

splogit

spprobit

spprobitml

1 2 3 4 5 6 7 8 9 | ```
set.seed(5647)
data(cookdata)
cookdata <- cookdata[!is.na(cookdata$AGE),]
n = nrow(cookdata)
cookdata$ystar <- cookdata$DCBD - .5*cookdata$AGE
cookdata$y <- cookdata$ystar - mean(cookdata$ystar) + rnorm(n,sd=4) > 0
fit <- cparlogit(y~DCBD+AGE,~LONGITUDE+LATITUDE,window=.5,
distance="Latlong",data=cookdata,minp=0.001)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.