/*
	predictnl

*!  VERSION 2.0.1  05mar2011

*/

VERSION 12.0

INCLUDE _std_large
INCLUDE _ht330
INCLUDE header

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

DIALOG main, label("predictnl - Nonlinear predictions after estimation") /*
		*/ tabtitle("Main")
BEGIN
  TEXT     tx_var            _lft      _top      _vnwd     .,		/*
		*/ label("Generate variable:")
  TEXT     tx_pnlexp         _lft3_2   @         _comb3_1  .,		/*
		*/ label("Nonlinear expression:")
  EDIT     ed_var            _lft      _ss       _vnwd     ., max(32)	/*
		*/ label("Generate variable")
  TEXT     tx_equals         _eqxpos   @         _eqwd     .,		/*
		*/ center label("=")
  EXP     ex_pnlexp         _lft3_2   @         _comb3_1  .,           /*
		*/ error("Nonlinear expression")			/*
		*/ label("Create...")
  TEXT     tx_pnltxt1        _indent2  _ls       _inwd     .,		/*
		*/ label("You may use the special functions predict() and")
  DEFINE   _y  @y
  TEXT     tx_pnltxt2        @         _vss      @         .,		/*
		*/ label("xb() in the nonlinear expression; see the help.")

  DEFINE   _x  _lft
  DEFINE   _cx _cwd3_0
  INCLUDE  _type

  GROUPBOX gb_gens           _lft      +35       _iwd      _ht17h,	/*
		*/ label("Additionally generate variables containing:")
  CHECKBOX ck_se             _ilft     _ss       _cwd2     .,		/*
		*/ clickon("gaction main.ed_se.enable")			/*
		*/ clickoff("gaction main.ed_se.disable")		/*
		*/ label("Standard errors:")
  DEFINE   holdy @y
  EDIT     ed_se             _indent2  _ss       _vnwd     ., max(32)	/*
		*/ option(se) label("Standard errors")
  CHECKBOX ck_wald           _ilft     _ms       _cwd2     .,		/*
		*/ clickon("gaction main.ed_wald.enable")		/*
		*/ clickoff("gaction main.ed_wald.disable")		/*
		*/ label("Wald test statistics:")
  EDIT     ed_wald           _indent2  _ss       _vnwd     ., max(32)   /*
		*/ option(wald) label("Wald test statistics")
  CHECKBOX ck_variance       _lft2     holdy     _cwd2     .,		/*
		*/ clickon("gaction main.ed_variance.enable")		/*
		*/ clickoff("gaction main.ed_variance.disable")		/*
		*/ label("Variances:")
  EDIT     ed_variance       _indent2  _ss       _vnwd     ., max(32)   /*
		*/ option(variance) label("Variances")
  CHECKBOX ck_p              _lft2     _ms       _cwd2     .,		/*
		*/ clickon("gaction main.ed_p.enable")			/*
		*/ clickoff("gaction main.ed_p.disable")		/*
		*/ label("Significance levels of Wald tests:")
  EDIT     ed_p              _indent2  _ss       _vnwd     ., max(32)   /*
		*/ option(p) label("Significance levels of Wald tests")
  CHECKBOX ck_ci             _ilft     _ms       _comb3_2  .,		/*
		*/ clickon("script ci_on")				/*
		*/ clickoff("script ci_off")				/*
		*/ label("Lower and upper confidence intervals:")
  DEFINE   hldy @y
  EDIT     ed_ci1            _indent2  _ss       _vnwd     ., max(32)   /*
		*/ label("Lower confidence intervals")
  EDIT     ed_ci2            _vnsep    @         _vnwd     ., max(32)   /*
		*/ label("Upper confidence intervals")
  TEXT     tx_cisiglev       _ilft3_3  hldy      _cwd3_2   .,		/*
		*/ label("CI significance level:")
  SPINNER  sp_cisiglev       @         _ss       _spwd     .,		/*
		*/ min(1) max(100) default(global S_level)		/*
		*/ option(level) label("CI significance level")
  CHECKBOX ck_g              _ilft     _ms       _ibwd     .,		/*
		*/ clickon("gaction main.ed_g.enable")			/*
		*/ clickoff("gaction main.ed_g.disable")		/*
		*/ label("Derivatives:  (specify variable name stub)")
  EDIT     ed_g              _indent2  _ss       _vnwd     ., max(31)   /*
		*/ option(g) label("Derivatives")
END


INCLUDE _type_list_fd
INCLUDE ifin


DIALOG adv, tabtitle("Advanced")
BEGIN
  CHECKBOX ck_iterate        _lft      _top      _ckwd     ., label("") /*
		*/ clickon("gaction adv.sp_iterate.enable")		/*
		*/ clickoff("gaction adv.sp_iterate.disable")
  SPINNER  sp_iterate        _cksep    @         _spwd     .,		/*
		*/ min(1) max(1000000) default(100)			/*
		*/ option(iterate)					/*
		*/ label("Maximum iterations for finding optimal step size")
  TEXT     tx_iterate        _spsep    @         _ckspr    .,		/*
		*/ label("Maximum iterations for finding optimal step size")

  CHECKBOX ck_force          _lft      _ls       _iwd      .,		/*
		*/ option(force)					/*
  */ label("Calculate standard errors, etc., even when possibly inappropriate")
END


SCRIPT ci_on
BEGIN
	main.ed_ci1.enable
	main.ed_ci2.enable
	main.tx_cisiglev.enable
	main.sp_cisiglev.enable
END

SCRIPT ci_off
BEGIN
	main.ed_ci1.disable
	main.ed_ci2.disable
	main.tx_cisiglev.disable
	main.sp_cisiglev.disable
END

INCLUDE _p_gentype_sc

PROGRAM command
BEGIN
	put "predictnl "
	put " " /program _p_gentype_output
	require main.ex_pnlexp
	put " " "= " main.ex_pnlexp " "
	INCLUDE _ifin_pr
	beginoptions
		optionarg main.ed_se
		optionarg main.ed_variance
		optionarg main.ed_wald
		optionarg main.ed_p
		if main.ck_ci {
			require main.ed_ci1
			require main.ed_ci2
			put " ci(" main.ed_ci1 " " main.ed_ci2 ") "
			optionarg /hidedefault main.sp_cisiglev
		}
		optionarg main.ed_g
		optionarg adv.sp_iterate
		option adv.ck_force
	endoptions
END
