/*
	spearman

*!  VERSION 1.1.3  05jul2006

*/

VERSION 9.0

INCLUDE _std_large
DEFINE _dlght 410
INCLUDE header

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

DIALOG main, label("spearman - Spearman's rank correlation coefficients") ///
	tabtitle("Main")
BEGIN
  TEXT	    tx_var		_lft	_top	_iwd	.,		///
	label("Variables: (leave empty for all)")
  VARLIST  vl_var		@	_ss	@	.,		///
	label("Variables")

  GROUPBOX gb_stats		_lft	_ls	_iwd	_ht7,		///
	label("List of statistics")

  CHECKBOX ck_rho		_indent	_ss	_inwd	.,		///
	label("Display correlation coefficient (default)") option(rho)
  CHECKBOX ck_obs		@	_ms	@	.,		///
	label("Display number of observations") option(obs)
  CHECKBOX ck_p			@	_ms	@	.,		///
	label("Display significance level") option(p)

  GROUPBOX gb_displayadj	_lft	_xls	_iwd	_ht4h,		///
  	label("Display adjustment")
  CHECKBOX ck_print		_ilft	_ss	_ckwd 	., 		///
	onclickoff(main.ed_print.disable)				///
	onclickon(main.ed_print.enable)
  EDIT      ed_print		_cksep	@	_spwd	.,		///
	default(0.10) option(print)
  TEXT	    tx_print		_spsep	@	_rbsprb	.,		///
	label("Significance level for displaying coefficients")
  CHECKBOX ck_star		_ilft	_ms	_ckwd   .,		///
	onclickoff(main.ed_star.disable)				///
	onclickon(main.ed_star.enable)
  EDIT     ed_star		_cksep	@	_spwd	.,		///
	default(0.05) option(star)
  TEXT     tx_star		_spsep	@	_rbsprb	.,		///
	label("Significance level for displaying with a star")

  GROUPBOX gb_significance	_lft	_xls	_iwd	_ht6,		///
	label("Significance levels")
  RADIO    rb_none		_indent	_ss	_inwd	.,		///
	label("Do not adjust significance level") option(NONE) first
  RADIO    rb_bonferroni	@	_ss	@	.,		///
	label("Use Bonferroni-adjusted significance level")		///
	option(bonferroni)
  RADIO    rb_sidak		@	_ss	@	.,		///
	label("Use Sidak-adjusted significance level")			///
	option(sidak)  last

  CHECKBOX ck_pw		_lft	_xls	_iwd	.,		///
	option(pw)							///
	label("Calculate all pairwise correlation coefficients by using all available data")
  CHECKBOX ck_mat		_lft	_ms	_iwd	.,		///
	label("Force matrix table output") option(matrix)
END

INCLUDE byifin

PROGRAM stats_option_output
BEGIN
	option main.ck_rho
	option main.ck_obs
	option main.ck_p
END

PROGRAM command
BEGIN
  	INCLUDE _by_pr
        put "spearman "
        varlist [main.vl_var]

        INCLUDE _ifin_pr
        beginoptions
		if (main.ck_rho | main.ck_obs | main.ck_p) {
			put "stats("
			put /program stats_option_output
			put ") "
		}
                if main.ck_print{
			optionarg main.ed_print
                }
		if main.ck_star{
			optionarg main.ed_star
		}
		option radio(main rb_none rb_bonferroni rb_sidak)
		option main.ck_pw
		option main.ck_mat
      endoptions
END
