Mercurial > forge
changeset 3292:d4d945f232e7 octave-forge
turn off attempt to run in parallel, fix plotting for 2.6.10
author | mcreel |
---|---|
date | Thu, 29 Mar 2007 11:08:49 +0000 |
parents | 3482f207431d |
children | 637b03573470 |
files | main/econometrics/inst/kernel_example.m |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/main/econometrics/inst/kernel_example.m Thu Mar 29 11:07:34 2007 +0000 +++ b/main/econometrics/inst/kernel_example.m Thu Mar 29 11:08:49 2007 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2006 Michael Creel <michael.creel@uab.es> +# Copyright (C) 2007 Michael Creel <michael.creel@uab.es> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ n = 500; # set this to greater than 0 to try parallel computations (requires MPITB) -compute_nodes = 3; +compute_nodes = 0; nodes = compute_nodes + 1; # count master node close all; @@ -51,9 +51,9 @@ printf("\n"); printf("########################################################################\n"); printf("time for kernel regression example using %d data points and %d compute nodes: %f\n", n, nodes, t1); +plot(x, fit, ";fit;", x, trueline,";true;"); grid("on"); title("Example 1: Kernel regression fit"); -plot(x, fit, x, trueline); ############################################################ # kernel density example: univariate - fit to Chi^2(3) data @@ -73,9 +73,8 @@ printf("time for univariate kernel density example using %d data points and %d compute nodes: %f\n", n, nodes, t1); printf("A rough integration under the fitted univariate density is %f\n", sum(dens)*stepsize); figure(); +plot(grid_x, dens, ";fitted density;", grid_x, chisquare_pdf(grid_x,3), ";true density;"); title("Example 2: Kernel density fit: Univariate Chi^2(3) data"); -xlabel("true density is Chi^2(3)"); -plot(grid_x, [dens chisquare_pdf(grid_x,3)]); ############################################################ # kernel density example: bivariate @@ -104,11 +103,10 @@ dens = reshape(dens, gridsize, gridsize); printf("A rough integration under the fitted bivariate density is %f\n", sum(sum(dens))*stepsize^2); figure(); -#legend("off"); +surf(grid_x, grid_y, dens); title("Example 3: Kernel density fit: dependent bivatiate data"); xlabel("true marginal density is N(0,1)"); ylabel("true marginal density is Chi^2(3)"); -surf(grid_x, grid_y, dens); # more extensive test of parallel if compute_nodes > 0 # only try this if parallel is available ns =[4000; 8000; 10000; 12000; 16000; 20000];