User Tools

Site Tools


isis:slxfig:parameterspace_plot

Chi-squared parabola

require("isisscripts");

variable t = [-3:3:.01];

define f(x){
  return -x^2+9;
}

variable L = f(t);


variable X = xfig_plot_new;
X.plot(t,L);
%X.axis(;off);
X.xlabel(`$\theta$`);
X.ylabel(`$ln L$`);


variable sig1_lo,sig1_hi,sig2_lo,sig2_hi,sig3_lo,sig3_hi;
sig1_lo = min(t[where(L>max(L)-0.5)]);
sig1_hi = max(t[where(L>max(L)-0.5)]);
sig2_lo = min(t[where(L>max(L)-2)]);
sig2_hi = max(t[where(L>max(L)-2)]);
sig3_lo = min(t[where(L>max(L)-4.5)]);
sig3_hi = max(t[where(L>max(L)-4.5)]);

X.yaxis(; major=[max(L),max(L)-0.5,max(L)-2,max(L)-4.5],
       ticlabels=[`$L_{\text{max}}$`,
		  `$L_{\text{max}}$-0.5`,
		  `$L_{\text{max}}$-2`,
		  `$L_{\text{max}}$-4.5`],
       ticlabels2=0);
X.x1axis(; major=[sig1_lo,sig2_lo,sig3_lo,0,sig1_hi,sig2_hi,sig3_hi],
	 ticlabels=[`$-1\sigma$`,`$-2\sigma$`,
		    `$-3\sigma$`,`$\hat{\theta}=0$`,`$+1\sigma$`,
		    `$+2\sigma$`,`$+3\sigma$`],
	);

						 						  
						  
%X.world1(min_max(t;pad=0.1),min_max(L;pad=0.1));
X.plot([min(t[where(L>max(L)-0.5)]),max(t[where(L>max(L)-0.5)])],[max(L)-0.5,max(L)-0.5];color="black",width=3,
       backward_arrow,forward_arrow,arrow_type=2,arrow_style=3,arrow_width=6);
X.plot([min(t[where(L>max(L)-2)]),max(t[where(L>max(L)-2)])],[max(L)-2,max(L)-2];color="black",width=3,
       backward_arrow,forward_arrow,arrow_type=1,arrow_style=3,arrow_width=6);
X.plot([min(t[where(L>max(L)-4.5)]),max(t[where(L>max(L)-4.5)])],[max(L)-4.5,max(L)-4.5];color="black",width=3,
       backward_arrow,forward_arrow,arrow_type=3,arrow_style=1,arrow_width=6);
% lines 1 sigma
X.plot([min(t[where(L>max(L)-0.5)]),min(t[where(L>max(L)-0.5)])],[0,max(L)-0.5]);
X.plot([max(t[where(L>max(L)-0.5)]),max(t[where(L>max(L)-0.5)])],[0,max(L)-0.5]);
% lines 2 sigma
X.plot([min(t[where(L>max(L)-2)]),min(t[where(L>max(L)-2)])],[0,max(L)-2]);
X.plot([max(t[where(L>max(L)-2)]),max(t[where(L>max(L)-2)])],[0,max(L)-2]);
% lines 3 sigma
X.plot([min(t[where(L>max(L)-4.5)]),min(t[where(L>max(L)-4.5)])],[0,max(L)-4.5]);
X.plot([max(t[where(L>max(L)-4.5)]),max(t[where(L>max(L)-4.5)])],[0,max(L)-4.5]);
% line max, max-0.5, max-2, max-4.5
X.plot([-4,0,],[max(L),max(L)];line=1);
X.plot([-4,0,],[max(L)-0.5,max(L)-0.5];line=1);
X.plot([-4,0,],[max(L)-2,max(L)-2];line=1);
X.plot([-4,0,],[max(L)-4.5,max(L)-4.5];line=1);

variable sig_1 = xfig_new_text(`$68.3\,\%$`);
variable sig_2 = xfig_new_text(`$90\,\%$`);
variable sig_3 = xfig_new_text(`$99\,\%$`);


X.add_object(sig_1,0,max(L)-1);
X.add_object(sig_2,0,max(L)-2.5);
X.add_object(sig_3,0,max(L)-5);


X.render("chisqr_parabola.eps");
isis/slxfig/parameterspace_plot.txt · Last modified: 2013-01-07 13:37 by Tobias Beuchert