~ubuntu-branches/ubuntu/lucid/octave-econometrics/lucid

« back to all changes in this revision

Viewing changes to inst/kernel_density.m

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2009-05-24 10:53:59 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090524105359-g7h66je519gx6t5r
Tags: 1:1.0.8-1
* New upstream release
* debian/control:
  + (Standards-Version): Bump to 3.8.1 (no changes needed)
  + (Depends): Add ${misc:Depends}
  + (Vcs-Git, Vcs-Browser): Adjust to new Git repository
* debian/copyright:
  + Use DEP5 URL in Format-Specification
  + Use separate License stanzas for instructing about the location of
    the different licenses used in the package

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#               makes a product kernel a reasonable choice.
32
32
#       do_cv: bool (optional). default false. If true, calculate leave-1-out
33
33
#                density for cross validation
34
 
#       computenodes: int (optional, default 0). Number of compute nodes for parallel evaluation
 
34
#       computenodes: int (optional, default 0).
 
35
#               Number of compute nodes for parallel evaluation
35
36
#       debug: bool (optional, default false). show results on compute nodes if doing
36
37
#               a parallel run
37
38
# outputs:
43
44
 
44
45
function z = kernel_density(eval_points, data, bandwidth, kernel, prewhiten, do_cv, computenodes, debug)
45
46
 
46
 
        if nargin < 3; error("kernel_density: at least 3 arguments are required"); endif
 
47
        if nargin < 2; error("kernel_density: at least 2 arguments are required"); endif
 
48
 
 
49
        n = rows(data);
 
50
        k = columns(data);
 
51
 
47
52
 
48
53
        # set defaults for optional args
 
54
        if (nargin < 3) bandwidth = (n ^ (-1/(4+k))); endif     # bandwidth - see Li and Racine pg. 26
49
55
        if (nargin < 4) kernel = "__kernel_normal"; endif # what kernel?
50
56
        if (nargin < 5) prewhiten = false; endif        # automatic prewhitening?
51
57
        if (nargin < 6) do_cv = false; endif            # ordinary or leave-1-out