/*
	rocreg estat

*!  VERSION 1.0.2  01jul2011

	***
	USE EXTREME CARE WHEN CHANGING CONTROL NAMES. The names used
	in this file have multiple external dependencies.

*/

VERSION 12.0

INCLUDE _std_mlarge
DEFINE _dlght 280
INCLUDE header

HELP hlp1, view("help rocreg postestimation")
RESET res1

SCRIPT PREINIT
BEGIN
	create BOOLEAN has_FactorVars
	has_FactorVars.setfalse
END

DIALOG main, label("estat - Postestimation tools for rocreg")		///
	tabtitle("Main")
BEGIN
  TEXT     tx_subcmd		_lft	_top	_iwd	.,		///
  	label("Reports and statistics: (subcommand)")
  LISTBOX  lb_subcmd		@	_ss	_iwd	70,		///
  	contents(main_subcommand_contents)				///
  	values(main_subcommand_values)					///
  	onselchangelist(main_subcommand_scripts)

  DEFINE holdy 110

  // nproc options
  CHECKBOX ck_auc		_lft	holdy	_iwd	.,		///
	option("auc")							///
	label("Estimate total area under the ROC curve")
  CHECKBOX ck_roc		@	_ms	@	.,		///
	onclickon("main.ed_roc.enable")					///
	onclickoff("main.ed_roc.disable")				///
	label("Estimate ROC for given false-positive rates:")
  EDIT ed_roc			+20	_ss	_vnwd	.,		///
	option(roc)							///
	label("Estimate ROC for given false-positive rates")
  CHECKBOX ck_invroc		_lft	_ms	_iwd	.,		///
	onclickon("main.ed_invroc.enable")				///
	onclickoff("main.ed_invroc.disable")				///
	label("Estimate false-positive rate for given ROC values:")
  EDIT ed_invroc		+20	_ss	_vnwd	.,		///
	option(invroc)							///
	label("Estimate false-positive rate for given ROC values")
  CHECKBOX ck_pauc		_lft	_ms	_iwd	.,		///
	onclickon("main.ed_pauc.enable")				///
	onclickoff("main.ed_pauc.disable")				///
	label("Estimate partial area under the ROC curve for given false-positive rates:")
  EDIT ed_pauc			+20	_ss	_vnwd	.,		///
	option(pauc)							///
	label("Estimate partial area under the ROC curve for given false-positive rates")
END

LIST main_subcommand_contents
BEGIN
	 "Postestimation for nonparametric ROC curve estimation (nproc)"
END

LIST main_subcommand_values
BEGIN
	nproc
END

LIST main_subcommand_scripts
BEGIN
	script sel_nproc
END

SCRIPT sel_nproc
BEGIN
	script main_hide_all
	script nproc_on
END

SCRIPT main_hide_all
BEGIN
	main.ck_auc.hide
	main.ck_roc.hide
	main.ed_roc.hide
	main.ck_invroc.hide
	main.ed_invroc.hide
	main.ck_pauc.hide
	main.ed_pauc.hide
END
	
SCRIPT nproc_on
BEGIN
	main.ck_auc.show
	main.ck_roc.show
	main.ed_roc.show
	main.ck_invroc.show
	main.ed_invroc.show
	main.ck_pauc.show
	main.ed_pauc.show
END

PROGRAM command
BEGIN
	put "estat "
	put main.lb_subcmd
	beginoptions
		// nproc options
		if (!main.ck_auc & !main.ck_roc &	///
			!main.ck_invroc & !main.ck_pauc) {
			stopbox stop `"You must specify at least one option"'
		}
		option main.ck_auc

		if main.ck_roc {
			require main.ed_roc
			if !main.ed_roc.isnumlist() {
stopbox stop `"An invalid numlist is specified for "Estimate ROC for given false-positive rates""'
			}
			optionarg main.ed_roc
		}

		if main.ck_invroc {
			require main.ed_invroc
			if !main.ed_invroc.isnumlist() {
stopbox stop `"An invalid numlist is specified for "Estatimate false-positive rate for given ROC values""'
			}
			optionarg main.ed_invroc
		}

		if main.ck_pauc {
			require main.ed_pauc
			if !main.ed_pauc.isnumlist() {
stopbox stop `"An invalid numlist is specified for "Estimate partial area under the ROC curve for given false-positive rates""'
			}
			optionarg main.ed_pauc
		}
	endoptions
END
