⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nl.dlg

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 DLG
字号:
/*
  nl

*!  VERSION 1.1.2  21mar2005

  keyword:  eclass

*/

VERSION 9.0

INCLUDE _std_glm
DEFINE _dlght 350
INCLUDE header

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

SCRIPT PREINIT
BEGIN
	create BOOLEAN main_isUserType
END

DIALOG main, label("nl - Nonlinear least squares") tabtitle("Model")
BEGIN

  RADIO    rb_subexp	_lft	_top	_iwd	., first		///
	onclickon(program subexp)					///
	label("Enter a substitutable expression")
  RADIO    rb_preprog	@	_ss	@	.,			///
	onclickon(program preprog)					///
	label("Use a preprogrammed substitutable expression")
  RADIO    rb_evaluator	@	_ss	@	., last			///
	onclickon(program eval)						///
	label("Use a function evaluator program")

  TEXT     tx_dv	_lft	+35	_vnwd	.,			///
  	label("Dependent variable:")
  DEFINE holdy @y
  VARNAME  vn_dv	@	_ss	@	.,			///
  	label("Dependent variable")

  TEXT     tx_subexpr	_vlx	holdy	_vlwd	.,			///
	label("Substitutable expression:")
  EDIT     ed_subexpr	@	_ss	@	.,			///
	label("Substitutable expression")
  TEXT     tx_iv	_vlx	holdy	@	.,			///
  	label("Independent variables:")
  VARLIST  vl_iv	@	_ss	@	.,			///
  	label("Independent variables") allowcat

  TEXT     tx_oneiv	_vlx	holdy	@	.,			///
	label("Independent variable:")
  VARNAME  vn_oneiv	@	_ss	@	.,			///
	label("Independent variable")


  TEXT     tx_functions	_lft	_ls	_cwd1	.,			///
  	label("Function:")
  LISTBOX  lb_functions	@	_ss	@	115,			///
  	contents(main_functions_contents)				///
  	values(main_functions_values)					///
  	onselchangelist(main_functions_scripts)

  TEXT     tx_funcprog	_lft	135	_cwd1	.,			///
	label("Function evaluator:")
  EDIT     ed_funcprog	@	_ss	@	.,			///
	label("Function evaluator")
  TEXT     tx_fpopts    @	_ls	@	.,			///
	label("Options for function evaluator:")
  EDIT     ed_fpopts    @	_ss	@	.,			///
	  label("Options for function evaluator")

  TEXT     tx_param	@	_ls	_cwd1	.,			///
	label("Parameters:")
  DEFINE holdy @y
  EDIT     ed_param	@	_ss	@	.,			///
	option(parameters) label("Parameters")
  TEXT     tx_paramnum	_lft2	holdy	@	.,			///
	label("Number of parameters:")
  EDIT     ed_paramnum	@	_ss	_spwd	.,			///
	option(nparameters)


  TEXT     tx_variables	_lft	+145	_cwd1	.,			///
  	label("Variables: (optional)")
  DEFINE holdy @y
  VARLIST  vl_variables	@	_ss	@	.,			///
  	option(variables) label("Variables")

  TEXT     tx_initial	_lft2	holdy	_cwd1	.,			///
	label("Initial values: (optional)")
  EDIT     ed_initial	@	_ss	@	.,			///
	option(initial) label("Initial values")

  GROUPBOX gb_usrprog	_lft2	150	_cwd1	_ht9,			///
	label("Specifications for preprogrammed expression")
  TEXT     tx_user	_ilft2	_ss	_cwd3	.,			///
	label("Name:")
  EDIT     ed_user	@	_ss	_vnwd	.,			///
	label("Name for user-supplied substitutable expression")
  TEXT     tx_useropts	@	_ls	_cwd3	.,			///
	label("Options for program:")
  EDIT     ed_useropts	@	_ss	@ 	.,			///
	  label("Options for program")
END

LIST main_functions_contents
BEGIN
 	 "Exponential:  Y = b0 + b1*b2^X"
 	 "Exponential:  Y = b1*b2^X"
 	 "Exponential:  Y = b1*(1-b2^X)"
 	 "Logistic:  Y = b0 + b1/(1 + exp(-b2*(X-b3)))"
 	 "Logistic:  Y = b1/(1 + exp(-b2*(X-b3)))"
 	 "Gompertz:  Y = b0 + b1*exp(-exp(-b2*(X-b3)))"
 	 "Gompertz:  Y = b1*exp(-exp(-b2*(X-b3)))"
 	 "User-Supplied Substitutable Expression Program"
END

LIST main_functions_values
BEGIN
	exp3
	exp2
	exp2a
	log4
	log3
	gom4
	gom3
	" "
END

LIST main_functions_scripts
BEGIN
	program useroff
	program useroff
	program useroff
	program useroff
	program useroff
	program useroff
	program useroff
	program useron
END

DIALOG model2, tabtitle("Model 2")
BEGIN
  CHECKBOX ck_lnlsq	_lft	_top	_iwd	.,			///
	onclickon(model2.en_lnlsq.enable)				///
	onclickoff(model2.en_lnlsq.disable)				///
	label("Use log least-squares where ln(depvar-#) is assumed normally distributed")
  EDIT     en_lnlsq   _indent2	_ss	_en7wd	.,	numonly		///
	option(lnlsq) label("#")
  TEXT     tx_lnlsq   _en7sep	@	_rben7r	.,			///
	label("#")

  CHECKBOX ck_noconstant	_lft	_ls	_cwd1	.,		///
	option(noconstant)						///
	onclickon(program check_noconstant)				///
	onclickoff(program check_noconstant)				///
	label("Model does not have a constant")
  CHECKBOX ck_hasconstant	@	_ms	115	.,		///
	onclickon(program check_hasconstant)				///
	onclickoff(program check_hasconstant)				///
	label("Constant term is: ")
  EDIT     ed_hasstring		+120	@	155	.,		///
	option(hasconstant) label("Constant term")
END

INCLUDE byifin
INCLUDE weights_fai

DIALOG robust, tabtitle("SE/Robust")
BEGIN
  CHECKBOX ck_robust	_lft	_top	_iwd	_ht15,			///
	label("Robust standard errors")					///
	onclickoff(script roboff)					///
	onclickon(script robon)						///
	option(robust)							///
	groupbox
  TEXT     tx_clust	_indent	_ss	_ibwd	.,			///
	label("Cluster variable: (optional)")
  VARNAME  vn_clust	@	_ss	_vnwd	.,			///
	label("Cluster variable") option(cluster)

  GROUPBOX gb_bias	@	_xls	_ibwd	_ht6,			///
	label("Bias correction")
  RADIO    rb_hc1	_indent	_ss	_en14wd	.,			///
	first label("n/(n-k)") option(NONE)
  DEFINE rb_x @x
  DEFINE rb_wd @cx
  TEXT     tx_hc1	_en14sep @	_en14r4c .,			///
	label("(default)")
  DEFINE txt_x @x
  DEFINE txt_wd @cx
  RADIO    rb_hc2	rb_x	_ss	rb_wd	.,			///
	label("1/(1-h)") option(hc2)
  TEXT     tx_hc2	txt_x	@	txt_wd	.,			///
	label("(best for homoskedastic)")

  RADIO    rb_hc3	rb_x	_ss	rb_wd	.,			///
	last label("1/(1-h)^2")	option(hc3)
  TEXT     tx_hc3	txt_x	@	txt_wd	.,			///
	label("(best for heteroskedastic)")
END

SCRIPT robon
BEGIN
	robust.gb_bias.enable
	robust.rb_hc1.enable
	robust.rb_hc2.enable
	robust.rb_hc3.enable
	robust.tx_hc1.enable
	robust.tx_hc2.enable
	robust.tx_hc3.enable
	robust.tx_clust.enable
	robust.vn_clust.enable
END

SCRIPT roboff
BEGIN
	robust.gb_bias.disable
	robust.rb_hc1.disable
	robust.rb_hc2.disable
	robust.rb_hc3.disable
	robust.tx_hc1.disable
	robust.tx_hc2.disable
	robust.tx_hc3.disable
	robust.tx_clust.disable
	robust.vn_clust.disable
END

DIALOG rpt, tabtitle("Reporting")
BEGIN
  DEFINE   _x  _lft
  DEFINE   _cx _spr
  DEFINE   _y  _top
  INCLUDE  _sp_level

  GROUPBOX gb_newvar	_lft	+35	_iwd	_ht2,			///
	label("Generate new variables")

  CHECKBOX ck_leave	_ilft	_ss	_inwd	.,			///
	option(leave)							///
	label("Create variables containing derivative of E(y)")

  TEXT     tx_title	_lft	_xxls	60	.,			///
	label("Title:")
  DEFINE holdy @y
  EDIT     ed_title	@	_ss	_cwd1	.,			///
	option(title) label("title")
  TEXT     tx_title2	@	_ls	60	.,			///
	label("Subtitle:")
  DEFINE holdy @y
  EDIT     ed_title2	@	_ss	_cwd1	.,			///
	  option(title2) label("subtitle")
END

PROGRAM subexp
BEGIN
	call script subexp_on
	call script eval_off
END

PROGRAM preprog
BEGIN
	call script preprog_on
	call script eval_off
END

PROGRAM eval
BEGIN
	call script eval_on
END


SCRIPT subexp_on
BEGIN
	main.tx_variables.setposition . 135
	main.vl_variables.setposition . 155
	main.tx_initial.setposition 10 185
	main.ed_initial.setposition 10 205
	main.tx_subexpr.show
	main.ed_subexpr.show
	main.tx_iv.hide
	main.vl_iv.hide
	main.tx_oneiv.hide
	main.vn_oneiv.hide
	main.tx_functions.hide
	main.lb_functions.hide
	main.gb_usrprog.hide
	main.tx_user.hide
	main.ed_user.hide
	main.tx_useropts.hide
	main.ed_useropts.hide
END

SCRIPT preprog_on
BEGIN
	main.tx_variables.setposition . 285
	main.vl_variables.setposition . 305
	main.tx_initial.setposition 305 285
	main.ed_initial.setposition 305 305
	main.tx_iv.show
	main.vl_iv.show
	main.tx_oneiv.show
	main.vn_oneiv.show
	main.tx_functions.show
	main.lb_functions.show
	main.gb_usrprog.show
	main.tx_user.show
	main.ed_user.show
	main.tx_useropts.show
	main.ed_useropts.show
	main.lb_functions.withvalue main.lb_functions.setvalue "@"
	main.tx_subexpr.hide
	main.ed_subexpr.hide
END

SCRIPT eval_on
BEGIN
	main.tx_variables.setposition . 285
	main.vl_variables.setposition . 305
	main.tx_initial.setposition 305 285
	main.ed_initial.setposition 305 305
	main.tx_subexpr.hide
	main.ed_subexpr.hide
	main.tx_funcprog.show
	main.ed_funcprog.show
	main.tx_fpopts.show
	main.ed_fpopts.show
	main.tx_param.show
	main.ed_param.show
	main.tx_paramnum.show
	main.ed_paramnum.show
	main.tx_iv.show
	main.vl_iv.show
	main.tx_oneiv.hide
	main.vn_oneiv.hide
	main.tx_functions.hide
	main.lb_functions.hide
	main.gb_usrprog.hide
	main.tx_user.hide
	main.ed_user.hide
	main.tx_useropts.hide
	main.ed_useropts.hide
END

SCRIPT eval_off
BEGIN
	main.tx_funcprog.hide
	main.ed_funcprog.hide
	main.tx_fpopts.hide
	main.ed_fpopts.hide
	main.tx_param.hide
	main.ed_param.hide
	main.tx_paramnum.hide
	main.ed_paramnum.hide
END

PROGRAM useron
BEGIN
	call main_isUserType.settrue
	if ! H(main.lb_functions) {
		call main.gb_usrprog.show
		call main.tx_user.show
		call main.ed_user.show
		call main.tx_useropts.show
		call main.ed_useropts.show
		call script manyvars
	}
END

PROGRAM useroff
BEGIN
	call main_isUserType.setfalse
	if ! H(main.lb_functions) {
		call main.gb_usrprog.hide
		call main.tx_user.hide
		call main.ed_user.hide
		call main.tx_useropts.hide
		call main.ed_useropts.hide
		call script onevar
	}
END

SCRIPT manyvars
BEGIN
	main.tx_iv.show
	main.vl_iv.show
	main.tx_oneiv.hide
	main.vn_oneiv.hide
END

SCRIPT onevar
BEGIN
	main.tx_iv.hide
	main.vl_iv.hide
	main.tx_oneiv.show
	main.vn_oneiv.show
END

DIALOG max, tabtitle("Opt options")
BEGIN

  SPINNER  sp_iterate		_lft	_top	_spwd	.,		///
	option(iterate)							///
	min(1) max(1000000) default(10000)				///
	label("Maximum iterations")
  TEXT     tx_iterate		_spsep	@	_ckspr	.,		///
	label("Maximum iterations")

  EDIT     en_eps		_lft	_ls	_en7wd	., 		///
	option(eps) default(1e-5)					///
	label("Convergence criterion")
  TEXT     tx_eps		_en7sep	@	_rbvnr	.,		///
	label("Convergence criterion (default: 1e-5)")

  EDIT     en_delta		_lft	_ls	_en7wd	.,  		///
	option(delta) default(4e-7)					///
	label("Delta for computing derivatives")
  TEXT     tx_delta		_en7sep	@	_rbvnr	.,		///
	label("Delta for computing derivatives (default: 4e-7)")

  GROUPBOX gb_log		_lft	_ls	_cwd1	_ht6,		///
	label("Iteration log")
  RADIO    rb_log		_ilft	_ss	_cwd3	., first	///
	option(NONE) label("Show log")
  RADIO    rb_trace		@	_ss	@	., 		///
	option(trace) label("Detailed log")
  RADIO    rb_nolog		@	_ss	@	.,		///
	option(nolog) label("Suppress log") last
END

PROGRAM check_noconstant
BEGIN
	if model2.ck_noconstant {
		call model2.ck_hasconstant.disable
	}
	if ! model2.ck_noconstant {
		call model2.ck_hasconstant.enable
	}
END

PROGRAM check_hasconstant
BEGIN
	if model2.ck_hasconstant {
		call model2.ck_noconstant.disable
		call model2.ed_hasstring.enable
	}
	if ! model2.ck_hasconstant {
		call model2.ck_noconstant.enable
		call model2.ed_hasstring.disable
	}
END

PROGRAM main_subexpr_output
BEGIN
	put main.vn_dv " " "= " main.ed_subexpr
END

PROGRAM command
BEGIN
	allowxi
	INCLUDE _by_pr
	put "nl "
	if main.rb_subexp {
		require main.vn_dv
		require main.ed_subexpr
		put "("
		put /program main_subexpr_output
		put ") "
	}
	if main.rb_preprog {
		put main.lb_functions
		if main_isUserType {
			require main.ed_user
			put main.ed_user
		}
		put " " ": "
		if ! main_isUserType {
			varlist main.vn_dv
			varlist main.vn_oneiv
		}
		if main_isUserType {
			varlist main.vn_dv [main.vl_iv]
		}
	}

	if main.rb_evaluator {
		require main.ed_funcprog
		put main.ed_funcprog
		put " " "@ "
		varlist main.vn_dv [main.vl_iv]
	}

	INCLUDE _weights_pr
	INCLUDE _ifin_pr
	beginoptions
		optionarg main.vl_variables
		optionarg main.ed_initial
		if main.rb_evaluator {
			optionarg main.ed_param
			optionarg main.ed_paramnum
			if !main.ed_param & !main.ed_paramnum {
				stopbox stop `"On the "Model" tab,"' 	///
					`"either "Parameters" or "Number of parameters" must be filled in."'
			}
		}
		if main.ed_useropts {
			put " " main.ed_useropts
		}

		put main.ed_fpopts

		if model2.ck_lnlsq {
			require model2.en_lnlsq
			optionarg model2.en_lnlsq
		}
		option model2.ck_noconstant
		if model2.ck_hasconstant {
			require model2.ed_hasstring
			if model2.ed_hasstring {
				optionarg model2.ed_hasstring
			}
		}

		if robust.ck_robust {
			if robust.vn_clust {
				if ! robust.rb_hc1 {
					stopbox stop `"On the "SE/Robust" tab,"'	///
				`"Only "n/(n-k)" is allowed with a cluster variable"'
				}
			}
			option robust.ck_robust
			optionarg robust.vn_clust
			option radio(robust rb_hc1 rb_hc2 rb_hc3)
		}

		optionarg /hidedefault rpt.sp_level
		option rpt.ck_leave
		optionarg rpt.ed_title
		optionarg rpt.ed_title2

		optionarg /hidedefault max.sp_iterate
		optionarg /hidedefault max.en_eps
		optionarg /hidedefault max.en_delta
		option radio(max rb_log rb_nolog rb_trace)
	endoptions
END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -