var.plot: Nonparametric Variance Function Estimation and Plotting

Description Usage Arguments Details Value See Also Examples

View source: R/var.plot.R

Description

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

Usage

1
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

1
2
3
4
5
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

Example output

Loading required package: sm
Package 'sm', version 2.2-5.6: type help(sm) for summary information
Loading required package: Formula
Loading required package: nlme
Warning message:
no DISPLAY variable so Tk is not available 
  [1]  4.206062  1.601789 10.439550  1.872813  9.947393  3.712525 10.686313
  [8]  9.623119  8.050397  4.804372  8.822719  1.387454  5.567495  9.774135
 [15]  4.483276  2.150387  3.212202  9.107681  8.270726  5.408606 10.821706
 [22] 10.222492  4.586617 10.349725 10.879550  6.668273  9.876211  2.737450
 [29]  9.190887 10.150601  6.342179  9.779645  9.693576  7.212318  5.395036
 [36]  3.076369  1.327852  2.992569  7.473657  8.524540  2.207123  1.314327
 [43] 10.890439  6.005769  9.159829  4.208400  2.572197  1.540200  1.380207
 [50]  6.619228 10.907077  9.156207  1.293786 10.817193  8.987337  4.792651
 [57]  6.987744  1.484486  5.867218  9.994196  9.068292  9.570048  4.262180
 [64]  9.593505  9.129290  9.322476 10.706384  4.521482  8.295656  3.630731
 [71]  3.059014  2.857372 10.777942  3.945787  7.192296  2.898387  9.660517
 [78]  9.476029  2.545494  1.250231  1.807945 10.694349  4.753623  8.928144
 [85]  1.535563  9.799492  4.428387  8.675515  7.236708  5.936491  8.906938
 [92]  3.450403  9.119939  9.035360  3.620870  8.944618  1.956330  9.526530
 [99]  9.400235  1.358353 10.360492  6.876318 10.246957 10.633234  9.579681
[106]  2.501499  1.713973  1.486946 10.529410 10.793118 10.678601  9.629694
[113]  2.629420 10.875368  1.726598  9.901853 10.550654  3.154919  9.721469
[120]  5.373840  9.493577  8.154930  8.180369  9.172276  3.399753 10.885643
[127]  7.886250 10.712434  9.382095  6.960221  1.999619  7.561350  9.220744
[134]  4.376950  6.265040  1.586756  1.307797  9.708979  5.337967  2.623719
[141]  1.267494  9.600842 10.607500  8.251740  2.033105 10.386884  5.127919
[148]  9.957543 10.794212  6.979553  1.250185 10.409870  5.053240  7.425277
[155] 10.605114  9.066206  3.375180  3.852691  1.394075  8.785449  3.559555
[162]  1.636281  1.314422  2.970430 10.422908  9.099096  6.731255  2.021687
[169]  9.327532  2.743622  9.152000 10.304196  8.552770  9.167199  2.975144
[176] 10.322147  8.906540  9.996319 10.625708  7.188537  6.529425  8.776350
[183]  8.285489  2.539179  2.672429  7.116296  8.331169  1.589836 10.453236
[190]  2.743791  6.175750  1.691911  8.447634  9.867637  6.439920  9.084631
[197]  2.812050 10.907519  4.506216 10.218021  7.327857  1.293517  7.106298
[204] 10.845818  2.955410  6.441723 10.029927  9.867434  3.124455 10.897920
[211]  1.252924  6.772033 10.282627  4.220206  5.367987 10.734610 10.723580
[218]  2.345941  7.619022 10.839371 10.219058 10.733408  1.507559  7.898591
[225]  5.723466  7.068246 10.386514  2.266728  1.361667  2.682953  1.430038
[232]  2.353650  9.043576  3.533843 10.444033  4.000435  3.104072  9.259196
[239]  6.652350 10.146915  3.807039 10.117985  1.218659  2.045552  3.052168
[246]  2.294402  5.775296  9.547400  1.483034  9.793416  2.983530  2.834617
[253]  4.052006  2.390637  9.702057 10.226263  7.709585  9.369060  3.223573
[260]  5.773394  6.461906 10.494288  9.603184  8.228690  8.597717  2.115171
[267] 10.607181  4.274019  1.332135  5.308855  2.345832  9.883095  2.053754
[274] 10.462344  8.968981  7.926121  8.564053  2.825560 10.908187  4.584451
[281]  3.159676  8.347697  9.159289  6.330944  5.620203  1.402405  1.246637
[288]  7.268689  2.272894  3.143111  8.527627  4.265779  9.774804  6.270705
[295]  4.367885  6.146047  1.292345  8.028402  9.429649  1.740125  9.910978
[302]  3.026252  2.462517 10.761450  2.060114 10.498866  7.664568  9.956574
[309]  2.739556  9.619540  4.661221  9.640182  7.681885  1.677055  9.580766
[316]  8.814606  9.067344 10.902841  3.158919  9.308578  2.068575  9.318312
[323]  2.822284  4.002504  5.525784 10.474016 10.621132  6.705658  5.187370
[330] 10.204499 10.273258  9.580978  3.657481  3.126650  3.449408 10.893134
[337] 10.905961  3.711492  4.599649  9.135737 10.273047  4.924513  9.258470
[344]  9.442321  9.891544 10.597778  7.291975  3.679189  6.309492 10.585604
[351] 10.211093  9.680612  2.174524  3.983125  9.707643  9.173439  8.482426
[358]  8.427354  2.728221  6.685154  9.654817  3.034800 10.845471

plmm documentation built on May 2, 2019, 7:29 a.m.