/*
	lsens

*!  VERSION 2.1.0  20mar2007

*/

VERSION 10.0

INCLUDE _std_wide
DEFINE _dlght 320
INCLUDE header

HELP hlp1, view("help lsens")
RESET res1

SCRIPT POSTINIT
BEGIN
	script gr_plots_setDefaultConnected
END

DIALOG main, tabtitle("Main")	///
	label("lsens - Graph sensitivity and specificity versus probability cutoff")
BEGIN
  GROUPBOX gb_test        _lft      _top      _iwd      _ht4,	///
	label("Graph sensitivity and specificity versus probability cutoff for:")
  RADIO    rb_estimate    _ilft     _ss       _ibwd     .,	///
	label("Estimation sample")      			///
	first							///
	onclickon(script ifin_enable)

  RADIO    rb_all         @         _ss       @         .,	///
	label("All observations in the data")			///
	last							///
	onclickon(script ifin_disable)				///
	option(all)
  GROUPBOX gb_opt         _lft      _xls      _iwd      _ht18h,	///
	label("Options")
  TEXT     tx_genprob     _ilft     _ss       _ibwd     .,	///
	label("Create variable containing probability cutoffs:")
  EDIT     vn_genprob     @         _ss       _vnwd     .,	///
	label("Probability cutoffs variable")			///
	option(genprob)
  TEXT     tx_gensens     @         _ms       _ibwd     .,	///
	label("Create variable containing sensitivity:")
  EDIT     vn_gensens     @         _ss       _vnwd     .,	///
	label("Sensitivity variable")				///
	option(gensens)
  TEXT     tx_genspec     @         _ms       _ibwd     .,	///
	label("Create variable containing specificity:")
  EDIT     vn_genspec     @         _ss       _vnwd     .,	///
	label("Specificity variable")				///
	option(genspec)
  CHECKBOX ck_replace     @         _ls       _ibwd     .,	///
	label("Overwrite existing variables")			///
	option(replace) nomem
  CHECKBOX ck_nograph     @         _ms       @         .,	///
	label("Suppress graph")					///
	onclickoff(script graph_on)				///
	onclickon(script graph_off)				///
	option(nograph)
END

SCRIPT graph_on
BEGIN
	/* turn on all the graphs tabs */
	script gr_plots_enable
	script gr_addplots_enable
	script gr_yaxis_enable
	script gr_xaxis_enable
	script gr_titles_enable
	script gr_legend_enable
	script gr_overall_enable
END

SCRIPT graph_off
BEGIN
	/* turn off all the graphs tabs */
	script gr_plots_disable
	script gr_addplots_disable
	script gr_yaxis_disable
	script gr_xaxis_disable
	script gr_titles_disable
	script gr_legend_disable
	script gr_overall_disable
END

INCLUDE ifin
INCLUDE weights_f

INCLUDE _beta_adv

INCLUDE gr_plots
INCLUDE gr_addplots
INCLUDE gr_yaxis
INCLUDE gr_xaxis
INCLUDE gr_titles
INCLUDE gr_legend
INCLUDE gr_overall

PROGRAM command
BEGIN
	put "lsens "
        put " " /program _beta_adv_depvar_output
	put " " /program weights_output
	put " " /program ifin_output
	beginoptions
		option main.rb_all
		optionarg main.vn_genprob
		optionarg main.vn_gensens
		optionarg main.vn_genspec
		option main.ck_replace
		option main.ck_nograph
		put " " /program _beta_adv_lbbeta_output

		if ! main.ck_nograph {
			put " " /program gr_plots_output
			put " " /program gr_addplots_output
			put " " /program gr_yaxis_output
			put " " /program gr_xaxis_output
			put " " /program gr_titles_output
			put " " /program gr_legend_output
			put " " /program gr_overall_output
		}
	endoptions
END
