Last data update: 2014.03.03

R: Nonparametric Variance Function Estimation and Plotting
var.plotR Documentation

Nonparametric Variance Function Estimation and Plotting

Description

Plot the estimated nonparametric variance function and provide the estimated function values.

Usage

var.plot(object, heteroX, data, var.fun.bws = "ROT", var.fun.poly.index = 0, ...)

Arguments

object

a model fitted using the model fitting function plmm.

heteroX

at most two variables conditioning the heteroskedasticity of the regression error variance. If there are two variables, they can be passed either as a 2-element list or a 2-column matrix.

data

an optional data frame containing the variables in the model. If relevant variables are not found in data, the variables are taken from the environment from which var.plot was called.

var.fun.bws

the bandwidth selection method for the kernel regression estimation of the variance function. A rule-of-thumb type method “ROT” (default), “h.select” (cross validation using binning technique) or “hcv” (ordinary cross validation are available.

var.fun.poly.index

the degree of polynomial of the kernel regression to estimate the nonparametric variance function: either 1 for local linear or 0 (default) for local constant.

...

optional arguments relevant to estimation and plotting with sm.regression.

Details

The variance function plotted is an unconditional estimate, i.e. the sum of the estimated variances of the random effects and the regression error. As opposed to wplmm, var.plot does not trim negative estimates of the variance function values. var.fun.values returned from var.plot are also untrimmed estimates. “ROT” selects the bandwidths for heteroskedasticity conditioning variable w by sd(w)N^{-1/(4+q)} where q is th the number of the conditioning variables (1 or 2) and N is the sample size. Some of the relevant optional arguments include display, nbins and ngrid. See sm.options.

Value

The following values are returned invisibly (they are not printed, but can be assigned).

var.fun.values

the estimated untrimmed conditional variance function values at the data points.

var.comp

the estimated variance of the random effects.

h.var.fun

the bandwidths used to estimate the nonparametric variance function.

See Also

wplmm, sm.regression, sm.options

Examples

data(plmm.data)
model <- plmm(y1~x1+x2+x3|t1, random=cluster, data=plmm.data)
var.plot(model, heteroX=x3, data=plmm.data)
result <- var.plot(model, heteroX=x3, data=plmm.data, display="none")
result$var.fun.values

Results