0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_kernel.f90 File Reference

Module for kernel regression and kernel density estimation. More...

Go to the source code of this file.

Data Types

interface  mo_kernel::kernel_cumdensity
 Approximates the cumulative density function (CDF). More...
 
interface  mo_kernel::kernel_density
 Approximates the probability density function (PDF). More...
 
interface  mo_kernel::kernel_density_h
 Approximates the bandwith h of the kernel. More...
 
interface  mo_kernel::kernel_regression
 Multi-dimensional non-parametric kernel regression. More...
 
interface  mo_kernel::kernel_regression_h
 Approximates the bandwith h of the kernel for regression. More...
 
interface  mo_kernel::nadaraya_watson
 
interface  mo_kernel::allocate_globals
 
interface  mo_kernel::cross_valid_density
 
interface  mo_kernel::cross_valid_regression
 
interface  mo_kernel::mesh
 
interface  mo_kernel::golden
 
interface  mo_kernel::trapzd
 
interface  mo_kernel::polint
 

Modules

module  mo_kernel
 Module for kernel regression and kernel density estimation.
 

Functions/Subroutines

real(dp) function, dimension(:), allocatable mo_kernel::kernel_cumdensity_1d_dp (ix, h, silverman, xout, romberg, nintegrate, epsint, mask, nodata)
 
real(sp) function, dimension(:), allocatable mo_kernel::kernel_cumdensity_1d_sp (ix, h, silverman, xout, romberg, nintegrate, epsint, mask, nodata)
 
real(dp) function, dimension(:), allocatable mo_kernel::kernel_density_1d_dp (ix, h, silverman, xout, mask, nodata)
 
real(sp) function, dimension(:), allocatable mo_kernel::kernel_density_1d_sp (ix, h, silverman, xout, mask, nodata)
 
real(dp) function mo_kernel::kernel_density_h_1d_dp (ix, silverman, mask)
 
real(sp) function mo_kernel::kernel_density_h_1d_sp (ix, silverman, mask)
 
real(dp) function, dimension(:), allocatable mo_kernel::kernel_regression_1d_dp (ix, iy, h, silverman, xout, mask, nodata)
 
real(sp) function, dimension(:), allocatable mo_kernel::kernel_regression_1d_sp (ix, iy, h, silverman, xout, mask, nodata)
 
real(dp) function, dimension(:), allocatable mo_kernel::kernel_regression_2d_dp (ix, iy, h, silverman, xout, mask, nodata)
 
real(sp) function, dimension(:), allocatable mo_kernel::kernel_regression_2d_sp (ix, iy, h, silverman, xout, mask, nodata)
 
real(dp) function mo_kernel::kernel_regression_h_1d_dp (ix, iy, silverman, mask)
 
real(sp) function mo_kernel::kernel_regression_h_1d_sp (ix, iy, silverman, mask)
 
real(dp) function, dimension(size(ix, 2)) mo_kernel::kernel_regression_h_2d_dp (ix, iy, silverman, mask)
 
real(sp) function, dimension(size(ix, 2)) mo_kernel::kernel_regression_h_2d_sp (ix, iy, silverman, mask)
 
real(dp) function mo_kernel::nadaraya_watson_1d_dp (z, y, mask, valid)
 
real(sp) function mo_kernel::nadaraya_watson_1d_sp (z, y, mask, valid)
 
real(dp) function mo_kernel::nadaraya_watson_2d_dp (z, y, mask, valid)
 
real(sp) function mo_kernel::nadaraya_watson_2d_sp (z, y, mask, valid)
 
real(dp) function mo_kernel::cross_valid_regression_dp (h)
 
real(sp) function mo_kernel::cross_valid_regression_sp (h)
 
real(dp) function mo_kernel::cross_valid_density_1d_dp (h)
 
real(sp) function mo_kernel::cross_valid_density_1d_sp (h)
 
subroutine mo_kernel::allocate_globals_1d_dp (x, y, xout)
 
subroutine mo_kernel::allocate_globals_1d_sp (x, y, xout)
 
subroutine mo_kernel::allocate_globals_2d_dp (x, y, xout)
 
subroutine mo_kernel::allocate_globals_2d_sp (x, y, xout)
 
subroutine mo_kernel::deallocate_globals ()
 
real(sp) function mo_kernel::golden_sp (ax, bx, cx, func, tol, xmin)
 
subroutine shft2 (a, b, c)
 
subroutine shft3 (a, b, c, d)
 
real(dp) function mo_kernel::golden_dp (ax, bx, cx, func, tol, xmin)
 
subroutine shft2 (a, b, c)
 
subroutine shft3 (a, b, c, d)
 
real(dp) function, dimension(n) mo_kernel::mesh_dp (start, end, n, delta)
 
real(sp) function, dimension(n) mo_kernel::mesh_sp (start, end, n, delta)
 
subroutine mo_kernel::trapzd_dp (kernel, x, h, a, b, res, n)
 
subroutine mo_kernel::trapzd_sp (kernel, x, h, a, b, res, n)
 
subroutine mo_kernel::polint_dp (xa, ya, x, y, dy)
 
subroutine mo_kernel::polint_sp (xa, ya, x, y, dy)
 

Variables

real(sp), dimension(:,:), allocatable mo_kernel::global_x_sp
 
real(sp), dimension(:,:), allocatable mo_kernel::global_xout_sp
 
real(sp), dimension(:), allocatable mo_kernel::global_y_sp
 
real(dp), dimension(:,:), allocatable mo_kernel::global_x_dp
 
real(dp), dimension(:,:), allocatable mo_kernel::global_xout_dp
 
real(dp), dimension(:), allocatable mo_kernel::global_y_dp
 

Detailed Description

Module for kernel regression and kernel density estimation.

This module provides routines for kernel regression of data as well as kernel density estimation of both probability density functions (PDF) and cumulative density functions (CDF).
So far only a Gaussian kernel is implemented (Nadaraya-Watson) which can be used for one- and multidimensional data.
Furthermore, the estimation of the bandwith needed for kernel methods is provided by either Silverman''s rule of thumb or a Cross-Vaildation approach.
The Cross-Validation method is actually an optimization of the bandwith and might be the most costly part of the kernel smoother. Therefore, the bandwith estimation is not necessarily part of the kernel smoothing but can be determined first and given as an optional argument to the smoother.

Changelog
  • Juliane Mai, Mar 2013
  • Stephan Thober, Mar 2013
  • Matthias Cuntz, Mar 2013
  • Matthias Cuntz, May 2013
    • sort -> qsort
    • module procedure golden
  • Stephan Thober, Jul 2015
    • using sort_index in favor of qsort_index
  • Matthias Cuntz, Mar 2016
    • Romberg integration in cumdensity
  • Juliane Mai
Date
Mar 2013

Definition in file mo_kernel.f90.

Function/Subroutine Documentation

◆ shft2() [1/2]

subroutine golden_sp::shft2 ( real(sp), intent(out)  a,
real(sp), intent(inout)  b,
real(sp), intent(in)  c 
)
private

Definition at line 2430 of file mo_kernel.f90.

◆ shft2() [2/2]

subroutine golden_dp::shft2 ( real(dp), intent(out)  a,
real(dp), intent(inout)  b,
real(dp), intent(in)  c 
)
private

Definition at line 2500 of file mo_kernel.f90.

◆ shft3() [1/2]

subroutine golden_sp::shft3 ( real(sp), intent(out)  a,
real(sp), intent(inout)  b,
real(sp), intent(inout)  c,
real(sp), intent(in)  d 
)
private

Definition at line 2438 of file mo_kernel.f90.

◆ shft3() [2/2]

subroutine golden_dp::shft3 ( real(dp), intent(out)  a,
real(dp), intent(inout)  b,
real(dp), intent(inout)  c,
real(dp), intent(in)  d 
)
private

Definition at line 2508 of file mo_kernel.f90.