Package 'localgauss'

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-10-14 06:48:25 UTC
Source: CRAN

Help Index


local Gaussian parameters

Description

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.

Usage

localgauss(x,y,b1=1,b2=1,gsize=15,hthresh=0.001,xy.mat=NULL)

Arguments

x, y

The two data vectors

b1, b2

The bandwidth in the x-direction and y-direction, respectively

gsize

The gridsize (only used if xy.mat is not specified).

hthresh

Gridpoints where a non-parametric density estimate is lower than hthresh are omitted (only used if xy.mat is not specified).

xy.mat

A M times 2 matrix of points where the local parameters are to be estimated.

Details

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].

Value

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.

References

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.

See Also

localgauss.indtest.

Examples

x=rnorm(n=1000)
    y=x^2 + rnorm(n=1000)
    lgobj = localgauss(x,y)

Pointwise Independence test based on local Gaussian correlation

Description

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.

Usage

localgauss.indtest(locobj,R=10,alpha=0.10,seed=1)

Arguments

locobj

localgauss-object

R

Number of bootstrap replica

alpha

significance level (note: two sided test)

seed

Random seed in used for bootstrap

Details

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.

Value

S3 object of type localgauss.indtest containing the fields:

localgauss

simply returns locobj.

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.

References

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.

See Also

localgauss.

Examples

x=rnorm(n=100)
    y=x^2 + rnorm(n=100)
    lgobj = localgauss(x,y,gsize=8)
    lgind = localgauss.indtest(lgobj)

Local Gaussian correlation plot

Description

Plots estimates of local Gaussian correlation.

Usage

## 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)

Arguments

x

S3 object of class "localgauss" produced by the localgauss-function

...

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 plot.points is TRUE.

point.size

The size of observations points if plot.points is TRUE.

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.

References

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.

See Also

localgauss.

Examples

x=rnorm(n=1000)
    y=x^2 + rnorm(n=1000)
    lgobj = localgauss(x,y)
    plot(lgobj)