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)The two data vectors
The bandwidth in the x-direction and y-direction, respectively
The gridsize (only used if xy.mat is not specified).
Gridpoints where a non-parametric density estimate is lower than hthresh are omitted (only used if xy.mat is not specified).
A M times 2 matrix of points where the local parameters are to be estimated.
S3 object of type localgauss containing the fields:
M times 5 matrix of parameter estimates, with columns mu1,mu2,sigma1,sigma2,rho.
M-vector of exitflags from the optimizer. Estimations with exit flags other than 0 should not be trusted.
The negative Hessian of the objective function.
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].
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, https://doi.org/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.
# NOT RUN {
x=rnorm(n=1000)
y=x^2 + rnorm(n=1000)
lgobj = localgauss(x,y)
# }
Run the code above in your browser using DataLab