Title: | Estimating Local Gaussian Parameters |
---|---|
Description: | Computational routines for estimating local Gaussian parameters. Local Gaussian parameters are useful for characterizing and testing for non-linear dependence within bivariate data. See e.g. Tjostheim and Hufthammer, Local Gaussian correlation: A new measure of dependence, Journal of Econometrics, 2013, Volume 172 (1), pages 33-48 <DOI:10.1016/j.jeconom.2012.08.001>. |
Authors: | Tore Selland Kleppe <[email protected]> |
Maintainer: | Tore Selland Kleppe <[email protected]> |
License: | GPL-2 |
Version: | 0.41 |
Built: | 2024-11-13 06:43:12 UTC |
Source: | CRAN |
Routine for estimating local Gaussian parameters based on a sample
from the bivariate distribution under consideration. The routine can either
estimate local parameters on a grid covering the data controlled by the gsize
and hthresh
parameters. Otherwise, local Gaussian parameters can be estimated at coordinates
specified by the user in xy.mat
.
localgauss(x,y,b1=1,b2=1,gsize=15,hthresh=0.001,xy.mat=NULL)
localgauss(x,y,b1=1,b2=1,gsize=15,hthresh=0.001,xy.mat=NULL)
x , y
|
The two data vectors |
b1 , b2
|
The bandwidth in the |
gsize |
The gridsize (only used if |
hthresh |
Gridpoints where a non-parametric density estimate is lower than hthresh are omitted (only used if |
xy.mat |
A M times 2 matrix of points where the local parameters are to be estimated. |
The objective function is maximized using a modified Newton method. The user should check whether the field eflag in the returned object is zero for all estimates. If not, the optimizer has not converged and the estimates should not be trusted. For more details, see [Reference to article].
S3 object of type localgauss
containing the fields:
par.est |
M times 5 matrix of parameter estimates, with columns mu1,mu2,sigma1,sigma2,rho. |
eflag |
M-vector of exitflags from the optimizer. Estimations with exit flags other than 0 should not be trusted. |
hessian |
The negative Hessian of the objective function. |
Geir Drage Berentsen, Tore Selland Kleppe, Dag Tjostheim, Introducing localgauss, an R Package for Estimating and Visualizing Local Gaussian Correlation, Journal of Statistical Software, 56(12), 1-18, 2014, doi:10.18637/jss.v056.i12 See also Tjoestheim, D. and Hufthammer K. O., Local Gaussian correlation: A new measure of dependence, Journal of Econometrics, 172(1),pages 33-48,2013, for a detailed description of local Gaussian correlation.
x=rnorm(n=1000) y=x^2 + rnorm(n=1000) lgobj = localgauss(x,y)
x=rnorm(n=1000) y=x^2 + rnorm(n=1000) lgobj = localgauss(x,y)
Routine for testing for local independence based on local Gaussian parameters. It accepts an S3 object produced by localgauss()
, and perfoms a bootstrap-based test with null-hypothesis being that x
and y
are indpendent.
localgauss.indtest(locobj,R=10,alpha=0.10,seed=1)
localgauss.indtest(locobj,R=10,alpha=0.10,seed=1)
locobj |
|
R |
Number of bootstrap replica |
alpha |
significance level (note: two sided test) |
seed |
Random seed in used for bootstrap |
The test is based on producing a null-distribution of local Gaussian correlations were the original data are resampled from their empirical marginal distributions. The bootstrap-based null-distribution is produced for each point specified in xy.mat
in locobj
. An estimated local correlation for the original data significantly larger than the null-distribution is indicated with +1 (returned in the vector test.results
). An estimated local correlation for the original data insignifcant with respect to the null-distribution is indicated with 0. An estimated local correlation for the original datasignificantly smaller than the null-distribution is indicated with -1.
S3 object of type localgauss.indtest
containing the fields:
localgauss |
simply returns |
upper |
Vector containing the 1-alpha/2 quantiles of the null-distributions. |
lower |
Vector containing the alpha/2 quantiles of the null-distributions. |
test.results |
Vector containing the test results. |
Geir Drage Berentsen, Tore Selland Kleppe, Dag Tjostheim, Introducing localgauss, an R Package for Estimating and Visualizing Local Gaussian Correlation, Journal of Statistical Software, 56(12), 1-18, 2014, (http://www.jstatsoft.org/v56/i12/). Note that for compability reasons, the graphics routines described in the paper have been taken out from release 0.40. See also Tjoestheim, D. and Hufthammer K. O., Local Gaussian correlation: A new measure of dependence, Journal of Econometrics, 172(1),pages 33-48,2013, for a detailed description of local Gaussian correlation and Berentsen, G.D. and Tjoestheim D., Recognizing and visualizing departures from independence in bivariate data using local Gaussian correlation, http://people.uib.no/gbe062/local-gaussian-correlation/ for a description of the local independence test.
x=rnorm(n=100) y=x^2 + rnorm(n=100) lgobj = localgauss(x,y,gsize=8) lgind = localgauss.indtest(lgobj)
x=rnorm(n=100) y=x^2 + rnorm(n=100) lgobj = localgauss(x,y,gsize=8) lgind = localgauss.indtest(lgobj)
Plots estimates of local Gaussian correlation.
## S3 method for class 'localgauss' plot(x,...,plot.text=TRUE,plot.points=FALSE,tsize=3, lowcol="cyan",highcol="magenta",point.col="black", point.size=NULL,xlab="",ylab="",divergent.col.grad=T)
## S3 method for class 'localgauss' plot(x,...,plot.text=TRUE,plot.points=FALSE,tsize=3, lowcol="cyan",highcol="magenta",point.col="black", point.size=NULL,xlab="",ylab="",divergent.col.grad=T)
x |
S3 object of class "localgauss" produced by the |
... |
Not used. |
plot.text |
If TRUE, the numerical values of the estimated local correlation are added to each tile. |
plot.points |
If TRUE, the original observations are overlain. |
tsize |
The font size used if plot.text is TRUE |
lowcol |
The color used to indicate negative correlation of -1 |
highcol |
The color used to indicate positive correlation of 1 |
point.col |
The colour used for observations points if |
point.size |
The size of observations points if |
xlab , ylab
|
The label of x-axis and y-axis, respectively. |
divergent.col.grad |
If TRUE, a divergent color gradient between lowcol and highcol with 0 as midpoint is used. If FALSE a ordinary color gradient between lowcol and highcol is used. |
Geir Drage Berentsen, Tore Selland Kleppe, Dag Tjostheim, Introducing localgauss, an R Package for Estimating and Visualizing Local Gaussian Correlation, Journal of Statistical Software, 56(12), 1-18, 2014, (http://www.jstatsoft.org/v56/i12/). See also Tjoestheim, D. and Hufthammer K. O., Local Gaussian correlation: A new measure of dependence, Journal of Econometrics, 172(1),pages 33-48,2013, for a detailed description of local Gaussian correlation.
x=rnorm(n=1000) y=x^2 + rnorm(n=1000) lgobj = localgauss(x,y) plot(lgobj)
x=rnorm(n=1000) y=x^2 + rnorm(n=1000) lgobj = localgauss(x,y) plot(lgobj)