using runmlwin in batch mode on Unix

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

got it! apologies (and much thanks) for the continued responses ... I fixed it and re-ran, now got an error reading "file /tmp/St29511.000004 not found", with log-file output (part 1):

Fit model using PQL2
. runmlwin distress_cats cons , ///
> level2(group: cons) ///
> level1(idcode:) ///
> discrete(distribution(binomial) link(logit) denominator(denominator) pql2)
> ///
> rigls maxiterations(100) ///
> nopause
---------------------------------------------------------- begin runmlwin ---
- if c(stata_version) >= 15 local user user
- if _caller() >= 12 version 12.0, `user'
= if _caller() >= 12 version 12.0, user
- if _caller() <= 9 version 9.0, `user'
= if _caller() <= 9 version 9.0, user
- display " "

- if replay() {
if ("`e(cmd)'" ~= "runmlwin") error 301
syntax [, Level(cilevel) CFORMAT(string) PFORMAT(string) SFORMAT(string) no
> HEADer noGRoup noCONTrast noFETable noRETable SD CORrelations OR IRr RRr MOde
> MEdian Zratio *]
runmlwin_display, level(`level') cformat(`cformat') pformat(`pformat') sfor
> mat(`sformat') `header' `group' `contrast' `fetable' `retable' `sd' `correlat
> ions' `or' `irr' `rrr' `mode' `median' `zratio'
makecns, displaycns
}
- else {
- syntax anything [if] [in], [Level(cilevel) CFORMAT(string) PFORMAT(string)
> SFORMAT(string) noHEADer noGRoup noCONTrast noFETable noRETable SD CORrelatio
> ns OR IRr RRr MOde MEdian Zratio *]
- timer clear 99
- timer on 99
- Estimates `0'
= Estimates distress_cats cons , level2(group: cons) level1(idcode:) di
> screte(distribution(binomial) link(logit) denominator(denominator) pql2) ri
> gls maxiterations(100) nopause
---------------------------------------------- begin runmlwin.Estimates ---
- if _caller() >= 12 version 12.0
- if _caller() <= 9 version 9.0
- local runmlwin_cmdline `0'
= local runmlwin_cmdline distress_cats cons , level2(group: cons) level
> 1(idcode:) discrete(distribution(binomial) link(logit) denominator(denomina
> tor) pql2) rigls maxiterations(100) nopause
- local maxlevels 1
- gettoken comma tmpstr : 0, parse(",") bind
- while strpos("`tmpstr'", "level") != 0 {
= while strpos(", level2(group: cons) level1(idcode:) discrete(distri
> bution(binomial) link(logit) denominator(denominator) pql2) rigls maxiterat
> ions(100) nopause", "level") != 0 {
- local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
= local tmpstr = substr(", level2(group: cons) level1(idcode:) discre
> te(distribution(binomial) link(logit) denominator(denominator) pql2) rigls
> maxiterations(100) nopause", strpos(", level2(group: cons) level1(idcod
> e:) discrete(distribution(binomial) link(logit) denominator(denominator) pq
> l2) rigls maxiterations(100) nopause", "level") + 5, .)
- local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
= local lev = substr("2(group: cons) level1(idcode:) discrete(distribut
> ion(binomial) link(logit) denominator(denominator) pql2) rigls maxiteration
> s(100) nopause", 1, strpos("2(group: cons) level1(idcode:) discrete(dis
> tribution(binomial) link(logit) denominator(denominator) pql2) rigls maxite
> rations(100) nopause", "(") - 1)
- if `=real("`lev'")' != . {
= if 2 != . {
- if `lev' > `maxlevels' {
= if 2 > 1 {
- local maxlevels `lev'
= local maxlevels 2
- }
- }
- }
- while strpos("`tmpstr'", "level") != 0 {
= while strpos("2(group: cons) level1(idcode:) discrete(distribution(bi
> nomial) link(logit) denominator(denominator) pql2) rigls maxiterations(100)
> nopause", "level") != 0 {
- local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
= local tmpstr = substr("2(group: cons) level1(idcode:) discrete(distri
> bution(binomial) link(logit) denominator(denominator) pql2) rigls maxiterat
> ions(100) nopause", strpos("2(group: cons) level1(idcode:) discrete(dis
> tribution(binomial) link(logit) denominator(denominator) pql2) rigls maxite
> rations(100) nopause", "level") + 5, .)
- local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
= local lev = substr("1(idcode:) discrete(distribution(binomial) link(log
> it) denominator(denominator) pql2) rigls maxiterations(100) nopause", 1,
> strpos("1(idcode:) discrete(distribution(binomial) link(logit) denominator(
> denominator) pql2) rigls maxiterations(100) nopause", "(") - 1)
- if `=real("`lev'")' != . {
= if 1 != . {
- if `lev' > `maxlevels' {
= if 1 > 2 {
local maxlevels `lev'
}
- }
- }
- while strpos("`tmpstr'", "level") != 0 {
= while strpos("1(idcode:) discrete(distribution(binomial) link(logit) de
> nominator(denominator) pql2) rigls maxiterations(100) nopause", "level")
> != 0 {
local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
if `=real("`lev'")' != . {
if `lev' > `maxlevels' {
local maxlevels `lev'
}
}
}
- if ("`verbose'"~="") display as text "Highest level: `maxlevels'"
= if (""~="") display as text "Highest level: 2"
- local levargs
- forvalues l = 2/`maxlevels' {
= forvalues l = 2/2 {
- local levargs LEVEL`l'(string) `levargs'
= local levargs LEVEL2(string)
- }
- syntax anything(name=eqlist id="equations" equalok) [if] [in], [ `levargs
> ' ] LEVEL1(string) [ Weights(string) Constraints(numlist >0 integer) IGLS RIG
> LS TOLerance(numlist >0 integer min=1 max=1) MAXIterations(numlist >0 integer
> min=1 max=1) FPSandwich RPSandwich INITSPrevious INITSB(namelist min=1 max=1
> ) INITSV(namelist min=1 max=1) INITSModel(namelist min=1 max=1) DISCRETE(stri
> ng) MCMC(string) SEED(numlist integer min=1 max=1) SIMulate(namelist min=1 ma
> x=1) MLWINPATH(string) MLWINSCRIPTPATH(string) VIEWMacro SAVEMacro(string) SA
> VEWorksheet(string) SAVEStata(string) USEWorksheet(string) Level(cilevel) CFO
> RMAT(string) PFORMAT(string) SFORMAT(string) OR IRr RRr SD CORrelations MOde
> MEdian Zratio noHEADer noGRoup noCONTrast noFETable noRETable noDrop FORCESor
> t FORCERecast noMLWIN noPause noVERSIONCHECK BATCh noSORT PLUGIN Verbose VIEW
> FULLMacro SAVEFULLMacro(string) SAVEEQuation(string) MLWINSETTINGS(string) ]
= syntax anything(name=eqlist id="equations" equalok) [if] [in], [ LEVEL2(s
> tring) ] LEVEL1(string) [ Weights(string) Constraints(numlist >0 integer) IGL
> S RIGLS TOLerance(numlist >0 integer min=1 max=1) MAXIterations(numlist >0 in
> teger min=1 max=1) FPSandwich RPSandwich INITSPrevious INITSB(namelist min=1
> max=1) INITSV(namelist min=1 max=1) INITSModel(namelist min=1 max=1) DISCRETE
> (string) MCMC(string) SEED(numlist integer min=1 max=1) SIMulate(namelist min
> =1 max=1) MLWINPATH(string) MLWINSCRIPTPATH(string) VIEWMacro SAVEMacro(strin
> g) SAVEWorksheet(string) SAVEStata(string) USEWorksheet(string) Level(cilevel
> ) CFORMAT(string) PFORMAT(string) SFORMAT(string) OR IRr RRr SD CORrelations
> MOde MEdian Zratio noHEADer noGRoup noCONTrast noFETable noRETable noDrop FOR
> CESort FORCERecast noMLWIN noPause noVERSIONCHECK BATCh noSORT PLUGIN Verbose
> VIEWFULLMacro SAVEFULLMacro(string) SAVEEQuation(string) MLWINSETTINGS(strin
> g) ]
- local doublevar 1
- if c(mode) == "batch" local batch = c(mode)
- if "`mlwinpath'" == "" & "`mlwinscriptpath'" ~= "" & "`batch'" ~= "" loca
> l mlwinpath `mlwinscriptpath'
= if "" == "" & "" ~= "" & "batch" ~= "" local mlwinpath
- if "`mlwinpath'" == "" & "$MLwiNScript_path" ~= "" & "`batch'" ~= "" loca
> l mlwinpath $MLwiNScript_path
= if "" == "" & "/udd/nkabe/ado/personal/mlnscript" ~= "" & "batch" ~= "" l
> ocal mlwinpath /udd/nkabe/ado/personal/mlnscript
- if "`mlwinpath'" == "" & "$MLwiN_path" ~= "" local mlwinpath $MLwiN_path
= if "/udd/nkabe/ado/personal/mlnscript" == "" & "/udd/nkabe/ado/personal/m
> lnscript" ~= "" local mlwinpath /udd/nkabe/ado/personal/mlnscript
- if "`mlwin'"~="nomlwin" & "`mlwinpath'" ~= "" {
= if ""~="nomlwin" & "/udd/nkabe/ado/personal/mlnscript" ~= "" {
- capture confirm file "`mlwinpath'"
= capture confirm file "/udd/nkabe/ado/personal/mlnscript"
- if _rc == 601 {
display as error "`mlwinpath' does not exist." _n
exit 198
}
- if "`versioncheck'" ~= "noversioncheck" {
= if "" ~= "noversioncheck" {
- quietly capture runmlwin_verinfo `mlwinpath'
= quietly capture runmlwin_verinfo /udd/nkabe/ado/personal/mlnscript
---------------------------------------------- begin runmlwin_verinfo ---
- version 9.0
- syntax [anything] [, *]
- tempname ver1
- tempname ver2
- tempname ver3
- tempname ver4
- scalar `ver1' = .
= scalar __000001 = .
- scalar `ver2' = .
= scalar __000002 = .
- scalar `ver3' = .
= scalar __000003 = .
- scalar `ver4' = .
= scalar __000004 = .
- capture plugin call runmlwin_getversion, `"`anything'"' "`ver1'" "`ver2
> '" "`ver3'" "`ver4'"
= capture plugin call runmlwin_getversion, `"/udd/nkabe/ado/personal/mlns
> cript"' "__000001" "__000002" "__000003" "__000004"
- if c(rc) == 199 {
- display as error "Warning: getversion plugin could not be loaded"
- }
- display as text "Version: " `ver1' as text "." `ver2' as text "." `ver3
> ' as text "." `ver4'
= display as text "Version: " __000001 as text "." __000002 as text "." _
> _000003 as text "." __000004
- return clear
- return scalar ver1 = `ver1'
= return scalar ver1 = __000001
- return scalar ver2 = `ver2'
= return scalar ver2 = __000002
- return scalar ver3 = `ver3'
= return scalar ver3 = __000003
- return scalar ver4 = `ver4'
= return scalar ver4 = __000004
------------------------------------------------ end runmlwin_verinfo ---
- if _rc == 198 {
display as error "`mlwinpath' is not a valid version of MLwiN"
exit 198
}
- local majorver `r(ver1)'
= local majorver .
- local minorver `r(ver2)'
= local minorver .
- local versionok = 1
- local versionold = 0
- if (`majorver' < 2) | (`majorver' == 2 & `minorver' < 36) local versionok
> = 0
= if (. < 2) | (. == 2 & . < 36) local versionok = 0
- if (`majorver' < 3) | (`majorver' == 3 & `minorver' < 03) local versionol
> d = 1
= if (. < 3) | (. == 3 & . < 03) local versionold = 1
- if `versionok' == 0 {
= if 1 == 0 {
display as error "runmlwin assumes MLwiN version 2.36 or higher. You can
> download the latest version of MLwiN at:" _n "https://www.bristol.ac.uk/cmm/s
> oftware/mlwin/download/upgrades.html." _n "If you want to ignore this warning
> and attempt to continue anyway you can use the noversioncheck option"
exit 198
}
- if `versionold' == 1 display as error "WARNING: Your version of MLwiN is
> out of date. You can download the latest version of MLwiN at:" _n "https://ww
> w.bristol.ac.uk/cmm/software/mlwin/download/upgrades.html"
= if 0 == 1 display as error "WARNING: Your version of MLwiN is out of date
> . You can download the latest version of MLwiN at:" _n "https://www.bristol.a
> c.uk/cmm/software/mlwin/download/upgrades.html"
- }
- local mlwinversion `majorver'.`minorver'
= local mlwinversion ...
- if "`mlwinversion'" ~= "..." {
= if "..." ~= "..." {
if `mlwinversion' < 3 {
local doublevar 0
}
}
- }
- marksample touse, novarlist
- if ("`discrete'"~="") {
= if ("distribution(binomial) link(logit) denominator(denominator) pql2"~="
> ") {
- local 0 , `discrete'
= local 0 , distribution(binomial) link(logit) denominator(denominator) pql
> 2
- syntax , Distribution(string) [Link(namelist min=1 max=1) DEnominator(var
> list numeric) Extra Offset(varname numeric) Proportion(varname) Basecategory(
> numlist integer min=1 max=1) MQL1 MQL2 PQL1 PQL2]
- local validdistributions normal binomial poisson nbinomial multinomial
- local checkdistribution :list distribution & validdistributions
- if "`checkdistribution'"=="" {
= if "binomial"=="" {
display as error "Invalid distribution(). Valid distributions are: normal
> , binomial, poisson, nbinomial, multinomial"
exit 198
}
- if ("`mql2'"=="" & "`pql1'"=="" & "`pql2'"=="") local linearization MQL1
= if (""=="" & ""=="" & "pql2"=="") local linearization MQL1
- if ("`mql2'"~="") local linearization MQL2
= if (""~="") local linearization MQL2
- if ("`pql1'"~="") local linearization PQL1
= if (""~="") local linearization PQL1
- if ("`pql2'"~="") local linearization PQL2
= if ("pql2"~="") local linearization PQL2
- if "`link'"=="" {
= if "logit"=="" {
if ("`distribution'"=="binomial") {
di as error "You must specify the link() function. Valid link functions f
> or the binomial distribution are: logit, probit and cloglog."
exit 198
}
if ("`distribution'"=="multinomial") {
di as error "You must specify the link() function. Valid link functions f
> or the multinomial distribution are: mlogit, ologit, oprobit, ocloglog."
exit 198
}
if ("`distribution'"=="poisson" | "`distribution'"=="nbinomial") local li
> nk log
}
- if "`link'" ~= "" {
= if "logit" ~= "" {
- local 0 , `link'
= local 0 , logit
- syntax , [Identity Logit Probit Cloglog Mlogit OLogit OProbit OCloglog LO
> G]
- if ("`distribution'"=="binomial") {
= if ("binomial"=="binomial") {
- if ~inlist("`link'","logit","probit","cloglog") {
= if ~inlist("logit","logit","probit","cloglog") {
display as error "Invalid link() function. Valid link functions for the b
> inomial distribution are: logit, probit and cloglog." _n
exit 198
}
- }
- if ("`distribution'"=="multinomial") {
= if ("binomial"=="multinomial") {
if ~inlist("`link'","mlogit","ologit","oprobit","ocloglog") {
display as error "Invalid link() function. Valid link functions for the m
> ultinomial distribution are: mlogit, ologit, oprobit, ocloglog." _n
exit 198
}
}
- if ("`distribution'"=="poisson") {
= if ("binomial"=="poisson") {
if ~inlist("`link'","log") {
display as error "Invalid link() function. Valid link functions for the p
> oisson distribution are: log." _n
exit 198
}
}
- if "`identity'" ~= "" local link identity
= if "" ~= "" local link identity
- if "`logit'" ~= "" local link logit
= if "logit" ~= "" local link logit
- if "`probit'" ~= "" local link probit
= if "" ~= "" local link probit
- if "`cloglog'" ~= "" local link cloglog
= if "" ~= "" local link cloglog
- if "`mlogit'" ~= "" local link mlogit
= if "" ~= "" local link mlogit
- if "`ologit'" ~= "" local link ologit
= if "" ~= "" local link ologit
- if "`oprobit'" ~= "" local link oprobit
= if "" ~= "" local link oprobit
- if "`ocloglog'" ~= "" local link ocloglog
= if "" ~= "" local link ocloglog
- if "`log'" ~= "" local link log
= if "" ~= "" local link log
- }
- }
- else {
local link identity
}
- tempname o
- .`o' = ._eqlist.new, eqopts(NOConstant) eqargopts(EQ) numdepvars(1) nonee
> dvarlist
= .__000002 = ._eqlist.new, eqopts(NOConstant) eqargopts(EQ) numdepvars(1)
> noneedvarlist
-class {
-instance:
- array n_depvars
- string needequal
- string noneedvarlist
- string wtypes
- string collinear
- string nocons
- string nocons_ignore
- double n_eq
- string gl_if
- string gl_in
- string gl_wgt
- string gl_options
- _optlist eq_opts_allowed
-class {
-instance:
- array options = {}
- array names = {}
-}
- array eq_list
- _optlist mark_opts
- array mark_list
- array mark_name
- _optlist rmcoll_opts
- array rmcoll_list
- array rmcoll_name
- _optlist rmdcoll_opts
- array rmdcoll_list
- array rmdcoll_name
-}
--------------------------------------------------- begin _eqlist.new ---
- version 9.2
- ._init
----------------------------------------------- begin _eqlist._init ---
- version 9.2
- .n_eq = 0
- .gl_if = ""
- .gl_in = ""
- .gl_wgt = ""
- .gl_options = ""
- .eq_list = {}
------------------------------------------------- end _eqlist._init ---
- ._setup `0'
= ._setup , eqopts(NOConstant) eqargopts(EQ) numdepvars(1) noneedvarlist
---------------------------------------------- begin _eqlist._setup ---
- version 9.2
- .mark_list = {}
- .mark_name = {}
- .mark_opts.reset
-------------------------------------------- begin _optlist.reset ---
- version 9
- .options = {}
- .names = {}
---------------------------------------------- end _optlist.reset ---
- .rmcoll_list = {}
- .rmcoll_name = {}
- .rmcoll_opts.reset
-------------------------------------------- begin _optlist.reset ---
- version 9
- .options = {}
- .names = {}
---------------------------------------------- end _optlist.reset ---
- .rmdcoll_list = {}
- .rmdcoll_name = {}
- .rmdcoll_opts.reset
-------------------------------------------- begin _optlist.reset ---
- version 9
- .options = {}
- .names = {}
---------------------------------------------- end _optlist.reset ---
- syntax [, EQopts(namelist) EQARGopts(namelist) noNEEDVARLIST COMMONop
> ts(string asis) MARKopts(namelist) RMCOLLopts(namelist) RMDCOLLopts(namelist)
> NUMDEPvars(numlist integer >=0) NEEDEQUAL WTYPES(string) IGNORENOCONS ]
- .eq_opts_allowed.reset
-------------------------------------------- begin _optlist.reset ---
- version 9
- .options = {}
- .names = {}
---------------------------------------------- end _optlist.reset ---
- foreach opt of local eqopts {
- .eq_opts_allowed.addopt `opt'
= .eq_opts_allowed.addopt NOConstant
------------------------------------------- begin _optlist.addopt ---
- version 9
- syntax name(name=optspec) [, PASSthru]
- local mname = lower("`optspec'")
= local mname = lower("NOConstant")
- if "`passthru'" != "" {
= if "" != "" {
local optspec `optspec'(passthru)
}
- .options.Arrpush "`optspec'"
= .options.Arrpush "NOConstant"
- .names.Arrpush "`mname'"
= .names.Arrpush "noconstant"
--------------------------------------------- end _optlist.addopt ---
- }
- foreach opt of local eqargopts {
- .eq_opts_allowed.addopt `opt', passthru
= .eq_opts_allowed.addopt EQ, passthru
------------------------------------------- begin _optlist.addopt ---
- version 9
- syntax name(name=optspec) [, PASSthru]
- local mname = lower("`optspec'")
= local mname = lower("EQ")
- if "`passthru'" != "" {
= if "passthru" != "" {
- local optspec `optspec'(passthru)
= local optspec EQ(passthru)
- }
- .options.Arrpush "`optspec'"
= .options.Arrpush "EQ(passthru)"
- .names.Arrpush "`mname'"
= .names.Arrpush "eq"
--------------------------------------------- end _optlist.addopt ---
- }
- local i 0
- foreach opt of local markopts {
.mark_opts.addopt `opt', passthru
}
- local i 0
- foreach opt of local rmcollopts {
.rmcoll_opts.addopt `opt', passthru
}
- local i 0
- foreach opt of local rmdcollopts {
.rmdcoll_opts.addopt `opt', passthru
}
- .n_depvars.Arrdropall
- if "`numdepvars'" != "" {
= if "1" != "" {
- foreach ndep of local numdepvars {
- .n_depvars.Arrpush `ndep'
= .n_depvars.Arrpush 1
- }
- }
- else .n_depvars.Arrpush 1
- .needequal = "`needequal'"
= .needequal = ""
- .wtypes = "`wtypes'"
= .wtypes = ""
- .noneedvarlist = "`needvarlist'"
= .noneedvarlist = "noneedvarlist"
- .nocons_ignore = "`ignorenocons'"
= .nocons_ignore = ""
------------------------------------------------ end _eqlist._setup ---
----------------------------------------------------- end _eqlist.new ---
- .`o'.parse `eqlist'
= .__000002.parse distress_cats cons
------------------------------------------------- begin _eqlist.parse ---
- version 9.2
- ._init
----------------------------------------------- begin _eqlist._init ---
- version 9.2
- .n_eq = 0
- .gl_if = ""
- .gl_in = ""
- .gl_wgt = ""
- .gl_options = ""
- .eq_list = {}
------------------------------------------------- end _eqlist._init ---
- local MARKOPTLIST `"`.mark_opts.dumpoptions'"'
---------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/0 {
local optlist `optlist' `.options[`i']'
}
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `""'
- class exit `"`optlist'"'
= class exit `""'
------------------------------------------ end _optlist.dumpoptions ---
= local MARKOPTLIST `""'
- local RMCOLLOPTLIST `"`.rmcoll_opts.dumpoptions'"'
---------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/0 {
local optlist `optlist' `.options[`i']'
}
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `""'
- class exit `"`optlist'"'
= class exit `""'
------------------------------------------ end _optlist.dumpoptions ---
= local RMCOLLOPTLIST `""'
- local RMDCOLLOPTLIST `"`.rmdcoll_opts.dumpoptions'"'
---------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/0 {
local optlist `optlist' `.options[`i']'
}
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `""'
- class exit `"`optlist'"'
= class exit `""'
------------------------------------------ end _optlist.dumpoptions ---
= local RMDCOLLOPTLIST `""'
- _parse expand EQ GL : 0, gweight common( `MARKOPTLIST' `RMCOLLOPTLIST'
> `RMDCOLLOPTLIST' COLlinear )
= _parse expand EQ GL : 0, gweight common( COLlinear )
- if `EQ_n' == 0 & "`.noneedvarlist'" == "" {
= if 1 == 0 & "noneedvarlist" == "" {
syntax varlist
}
- local rebind = `EQ_n' == 1
= local rebind = 1 == 1
- if `rebind' {
= if 1 {
- tokenize `"`0'"', parse(",()[]")
= tokenize `"distress_cats cons"', parse(",()[]")
- local rebind = `"`1'"' != "(" & `"`2'"' == "("
= local rebind = `"distress_cats cons"' != "(" & `""' == "("
- }
- if `rebind' {
= if 0 {
while `:length local 0' {
gettoken tok 0 : 0, parse(" ,") bind match(par)
if "`par'" == "(" {
local ZERO `"(`ZERO') (`tok') `0'"'
local 0
}
else if inlist("`tok'", "if", "in", ",") {
local ZERO `"(`ZERO') `tok' `0'"'
local 0
}
else {
local ZERO `"`ZERO' `tok'"'
}
}
_parse expand EQ GL : ZERO, gweight common( `MARKOPTLIST' `RMCOLLOPTLIS
> T' `RMDCOLLOPTLIST' COLlinear )
}
- forval i = 1/`EQ_n' {
= forval i = 1/1 {
- if `i' <= `.n_depvars.arrnels' {
= if 1 <= 1 {
- local ndep = `.n_depvars[`i']'
= local ndep = 1
- }
- .eq_list[`i'] = ._eqspec.new, numdepvars(`ndep') `.needequal' `.noneedv
> arlist' wtypes(`.wtypes') `.nocons_ignore'
= .eq_list[1] = ._eqspec.new, numdepvars(1) noneedvarlist wtypes()
-class {
-instance:
- double n_depvars
- double needequal
- double needvarlist
- string wtypes
- string name
- string depvars
- double hasequal
- string indepvars
- string other_markvars
- double nocons
- double nocons_ignore
- string offset
- double exposure
- double freeparm
- string if
- string in
- string wgt
- string options
-}
------------------------------------------------- begin _eqspec.new ---
- version 9.2
- syntax [, NUMDEPvars(numlist integer >=0 max=1) NEEDEQUAL noNEEDVARLI
> ST WTYPES(string) IGNORENOCONS ]
- .n_depvars = 1
- if `:list sizeof numdepvars' {
= if 1 {
- .n_depvars = `numdepvars'
= .n_depvars = 1
- }
- .needequal = ("`needequal'" != "")
= .needequal = ("" != "")
- .needvarlist = ("`needvarlist'" == "")
= .needvarlist = ("noneedvarlist" == "")
- .nocons_ignore = ("`ignorenocons'" != "")
= .nocons_ignore = ("" != "")
- .wtypes = "`wtypes'"
= .wtypes = ""
--------------------------------------------------- end _eqspec.new ---
- .eq_list[`i'].parse `.eq_opts_allowed.objkey':`EQ_`i''
= .eq_list[1].parse __key(4603c80):distress_cats cons
----------------------------------------------- begin _eqspec.parse ---
- version 9.2
- _on_colon_parse `0'
= _on_colon_parse __key(4603c80):distress_cats cons
------------------------------------------- begin _on_colon_parse ---
- version 8.2
- sreturn local before ""
- sreturn local after ""
- gettoken before after : 0, parse(":") bind match(par) quotes
- if "`par'" != "" {
= if "" != "" {
local before `"(`before')"'
}
- if `"`before'"' == ":" {
= if `"__key(4603c80)"' == ":" {
sreturn local after `"`after'"'
exit
}
- while `"`COLON'"' != ":" & `"`after'"' != "" {
= while `""' != ":" & `":distress_cats cons"' != "" {
- gettoken COLON after : after, parse(":") bind match(par) quotes
- if "`par'" != "" {
= if "" != "" {
local before `before' (`COLON')
local COLON
}
- else if `"`COLON'"' != ":" {
= else if `":"' != ":" {
local before `"`before' `COLON'"'
local COLON
}
- }
- while `"`COLON'"' != ":" & `"`after'"' != "" {
= while `":"' != ":" & `"distress_cats cons"' != "" {
gettoken COLON after : after, parse(":") bind match(par) quotes
if "`par'" != "" {
local before `before' (`COLON')
local COLON
}
else if `"`COLON'"' != ":" {
local before `"`before' `COLON'"'
local COLON
}
}
- if `"`COLON'"' != ":" {
= if `":"' != ":" {
di as err "'' found where ':' expected"
exit 198
}
- sreturn local before `"`before'"'
= sreturn local before `"__key(4603c80)"'
- sreturn local after `"`after'"'
= sreturn local after `"distress_cats cons"'
--------------------------------------------- end _on_colon_parse ---
- local ol `s(before)'
= local ol __key(4603c80)
- if `:list sizeof ol' {
= if 1 {
- local OPTLIST `"`.`ol'.dumpoptions'"'
-------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/2 {
- local optlist `optlist' `.options[`i']'
= local optlist NOConstant
- }
- local optlist `optlist' `.options[`i']'
= local optlist NOConstant EQ(passthru)
- }
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `"NOConstant EQ(passthru)"'
- class exit `"`optlist'"'
= class exit `"NOConstant EQ(passthru)"'
---------------------------------------- end _optlist.dumpoptions ---
= local OPTLIST `"NOConstant EQ(passthru)"'
- local OPTNAMES `"`.`ol'.dumpnames'"'
---------------------------------------- begin _optlist.dumpnames ---
- version 9
- forval i = 1/`.names.arrnels' {
= forval i = 1/2 {
- local namelist `namelist' `.names[`i']'
= local namelist noconstant
- }
- local namelist `namelist' `.names[`i']'
= local namelist noconstant eq
- }
- local namelist : list uniq namelist
- sreturn local namelist `"`namelist'"'
= sreturn local namelist `"noconstant eq"'
- class exit `"`namelist'"'
= class exit `"noconstant eq"'
------------------------------------------ end _optlist.dumpnames ---
= local OPTNAMES `"noconstant eq"'
- local NOCONS constant noconstant
- if `"`:list NOCONS & OPTNAMES'"' == "" {
= if `"noconstant"' == "" {
local NOCONS noCONStant
}
- else local NOCONS
- }
- local 0 `"`s(after)'"'
= local 0 `"distress_cats cons"'
- if `"`.wtypes'"' != "" {
= if `""' != "" {
local wgt "[`.wtypes']"
}
- syntax [anything(equalok)] [if] [in] `wgt' [, `OPTLIST' `NOCONS' *]
= syntax [anything(equalok)] [if] [in] [, NOConstant EQ(passthru) *]
- local HOLDIF `"`if'"'
= local HOLDIF `""'
- local HOLDIN `"`in'"'
= local HOLDIN `""'
- if "`wgt'" != "" & "`weight'" != "" {
= if "" != "" & "" != "" {
local HOLDWGT `"[`weight'`exp']"'
}
- gettoken NAME REST : anything, parse(":")
- if trim("`NAME'") == ":" {
= if trim("distress_cats cons") == ":" {
di as err "nothing found where equation name expected"
exit 198
}
- if `:list sizeof REST' {
= if 0 {
._confirm_eqname `NAME'
local NAME : list retok NAME
gettoken COLON anything : REST, parse(":")
}
- else {
- local NAME
- }
- gettoken DEPVARS REST : anything, parse("=") bind
- if "`DEPVARS'" == "=" {
= if "distress_cats cons" == "=" {
local REST : copy local anything
local DEPVARS
}
- if (`:length local DEPVARS' == 0 & `.n_depvars') {
= if (18 == 0 & 1) {
di as err "nothing found where depvar expected"
exit 198
}
- if `"`REST'"' == "" {
= if `""' == "" {
- if 0`.needequal' {
= if 00 {
if `.needvarlist' | (`:length local DEPVARS' != 0 & `.n_depvars') {
di as err "equal sign required to separate depvars from indepvars"
exit 198
}
}
- local DEPVARS
- local n_deps : list sizeof anything
- if `n_deps' != 0 | `.needvarlist' {
= if 2 != 0 | 0 {
- if `n_deps' < `.n_depvars' {
= if 2 < 1 {
error 102
}
- forval j = 1/`.n_depvars' {
= forval j = 1/1 {
- gettoken YY anything : anything
- local DEPVARS `DEPVARS' `YY'
= local DEPVARS distress_cats
- }
- local INDEPVARS : list retok anything
- }
- loca hasequal 0
- }
- else {
gettoken EQ INDEPVARS : REST, parse("=") bind
local hasequal 1
}
- if `:list sizeof DEPVARS' {
= if 1 {
- _fv_check_depvar `DEPVARS'
= _fv_check_depvar distress_cats
- tsunab DEPVARS : `DEPVARS'
= tsunab DEPVARS : distress_cats
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

part 2:

---------------------------------------------------- begin tsunab ---
- version 6
- gettoken user 0: 0, parse(" :")
- gettoken colon 0: 0, parse(" :")
- if `"`colon'"' != ":" { error 198 }
= if `":"' != ":" { error 198 }
- syntax [varlist(ts default=empty)] [, MIN(integer 1) MAX(integer 32
> 000) NAME(string)]
- c_local `user' `varlist'
= c_local DEPVARS distress_cats
- local n : word count `varlist'
= local n : word count distress_cats
- if `n'>=`min' & `n'<=`max' { exit }
= if 1>=1 & 1<=32000 { exit }
------------------------------------------------------ end tsunab ---
- }
- if `:list sizeof INDEPVARS' {
= if 1 {
- fvunab INDEPVARS : `INDEPVARS'
= fvunab INDEPVARS : cons
---------------------------------------------------- begin fvunab ---
- version 11
- _on_colon_parse `0'
= _on_colon_parse INDEPVARS : cons
----------------------------------------- begin _on_colon_parse ---
- version 8.2
- sreturn local before ""
- sreturn local after ""
- gettoken before after : 0, parse(":") bind match(par) quotes
- if "`par'" != "" {
= if "" != "" {
local before `"(`before')"'
}
- if `"`before'"' == ":" {
= if `"INDEPVARS "' == ":" {
sreturn local after `"`after'"'
exit
}
- while `"`COLON'"' != ":" & `"`after'"' != "" {
= while `""' != ":" & `": cons"' != "" {
- gettoken COLON after : after, parse(":") bind match(par) quotes
- if "`par'" != "" {
= if "" != "" {
local before `before' (`COLON')
local COLON
}
- else if `"`COLON'"' != ":" {
= else if `":"' != ":" {
local before `"`before' `COLON'"'
local COLON
}
- }
- while `"`COLON'"' != ":" & `"`after'"' != "" {
= while `":"' != ":" & `" cons"' != "" {
gettoken COLON after : after, parse(":") bind match(par) quotes
if "`par'" != "" {
local before `before' (`COLON')
local COLON
}
else if `"`COLON'"' != ":" {
local before `"`before' `COLON'"'
local COLON
}
}
- if `"`COLON'"' != ":" {
= if `":"' != ":" {
di as err "'' found where ':' expected"
exit 198
}
- sreturn local before `"`before'"'
= sreturn local before `"INDEPVARS "'
- sreturn local after `"`after'"'
= sreturn local after `" cons"'
------------------------------------------- end _on_colon_parse ---
- local 0 `"`s(before)'"'
= local 0 `"INDEPVARS "'
- syntax name(id="macro name" name=user)
- local 0 `"`s(after)'"'
= local 0 `" cons"'
- syntax [varlist(ts fv default=none)] [, MIN(integer 1) MAX(integer
> 32000) NAME(string) ]
- c_local `user' `varlist'
= c_local INDEPVARS cons
- local n : list sizeof varlist
- if (`min' <= `n' & `n' <= `max') exit
= if (1 <= 1 & 1 <= 32000) exit
------------------------------------------------------ end fvunab ---
- }
- if inlist("noconstant", "`noconstant'", "`constant'") {
= if inlist("noconstant", "", "") {
if "`INDEPVARS'" == "" & ! `.nocons_ignore' {
di as err "independent variables are required when option noconstant
> is specified"
exit 102
}
if "`NOCONS'" != "" {
local options `options' noconstant
}
local NOCONS 1
}
- else local NOCONS 0
- if `"`offset'`exposure'"' != "" {
= if `""' != "" {
._check_offset, `offset' `exposure'
local OFFSET "`s(offset)'"
local EXPOSURE = ("`exposure'" != "")
local OTHER `s(offset)'
}
- else local EXPOSURE 0
- local FREEPARM = `"`freeparm'"' != ""
= local FREEPARM = `""' != ""
- local OPTIONS
- local SPACE
- foreach OPTNAME of local OPTNAMES {
- if `"``OPTNAME''"' != "" {
= if `""' != "" {
local OPTIONS `"`OPTIONS'`SPACE'``OPTNAME''"'
local SPACE " "
}
- }
- if `"``OPTNAME''"' != "" {
= if `""' != "" {
local OPTIONS `"`OPTIONS'`SPACE'``OPTNAME''"'
local SPACE " "
}
- }
- if `"`options'"' != "" {
= if `""' != "" {
local OPTIONS `"`OPTIONS'`SPACE'`options'"'
}
- .name = `"`NAME'"'
= .name = `""'
- .depvars = `"`DEPVARS'"'
= .depvars = `"distress_cats"'
- .hasequal = `hasequal'
= .hasequal = 0
- .indepvars = `"`:list retok INDEPVARS'"'
= .indepvars = `"cons"'
- .other_markvars = `"`:list retok OTHER'"'
= .other_markvars = `""'
- .nocons = `NOCONS'
= .nocons = 0
- .if = `"`HOLDIF'"'
= .if = `""'
- .in = `"`HOLDIN'"'
= .in = `""'
- .wgt = `"`HOLDWGT'"'
= .wgt = `""'
- .offset = `"`OFFSET'"'
= .offset = `""'
- .exposure = `EXPOSURE'
= .exposure = 0
- .freeparm = `FREEPARM'
= .freeparm = 0
- .options = `"`OPTIONS'"'
= .options = `""'
------------------------------------------------- end _eqspec.parse ---
- }
- local MARKOPTLIST `"`.mark_opts.dumpoptions'"'
---------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/0 {
local optlist `optlist' `.options[`i']'
}
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `""'
- class exit `"`optlist'"'
= class exit `""'
------------------------------------------ end _optlist.dumpoptions ---
= local MARKOPTLIST `""'
- local MARKOPTNAMES `"`.mark_opts.dumpnames'"'
------------------------------------------ begin _optlist.dumpnames ---
- version 9
- forval i = 1/`.names.arrnels' {
= forval i = 1/0 {
local namelist `namelist' `.names[`i']'
}
- local namelist : list uniq namelist
- sreturn local namelist `"`namelist'"'
= sreturn local namelist `""'
- class exit `"`namelist'"'
= class exit `""'
-------------------------------------------- end _optlist.dumpnames ---
= local MARKOPTNAMES `""'
- local OPTLIST1 : subinstr local MARKOPTLIST "(passthru)" "(string asis)
> ", all
- local RMCOLLOPTLIST `"`.rmcoll_opts.dumpoptions'"'
---------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/0 {
local optlist `optlist' `.options[`i']'
}
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `""'
- class exit `"`optlist'"'
= class exit `""'
------------------------------------------ end _optlist.dumpoptions ---
= local RMCOLLOPTLIST `""'
- local RMCOLLOPTNAMES `"`.rmcoll_opts.dumpnames'"'
------------------------------------------ begin _optlist.dumpnames ---
- version 9
- forval i = 1/`.names.arrnels' {
= forval i = 1/0 {
local namelist `namelist' `.names[`i']'
}
- local namelist : list uniq namelist
- sreturn local namelist `"`namelist'"'
= sreturn local namelist `""'
- class exit `"`namelist'"'
= class exit `""'
-------------------------------------------- end _optlist.dumpnames ---
= local RMCOLLOPTNAMES `""'
- local OPTLIST2 : subinstr local RMCOLLOPTLIST "(passthru)" "(string asi
> s)", all
- local RMDCOLLOPTLIST `"`.rmdcoll_opts.dumpoptions'"'
---------------------------------------- begin _optlist.dumpoptions ---
- version 9
- forval i = 1/`.options.arrnels' {
= forval i = 1/0 {
local optlist `optlist' `.options[`i']'
}
- local optlist : list uniq optlist
- sreturn local optlist `"`optlist'"'
= sreturn local optlist `""'
- class exit `"`optlist'"'
= class exit `""'
------------------------------------------ end _optlist.dumpoptions ---
= local RMDCOLLOPTLIST `""'
- local RMDCOLLOPTNAMES `"`.rmdcoll_opts.dumpnames'"'
------------------------------------------ begin _optlist.dumpnames ---
- version 9
- forval i = 1/`.names.arrnels' {
= forval i = 1/0 {
local namelist `namelist' `.names[`i']'
}
- local namelist : list uniq namelist
- sreturn local namelist `"`namelist'"'
= sreturn local namelist `""'
- class exit `"`namelist'"'
= class exit `""'
-------------------------------------------- end _optlist.dumpnames ---
= local RMDCOLLOPTNAMES `""'
- local OPTLIST3 : subinstr local RMDCOLLOPTLIST "(passthru)" "(string as
> is)", all
- local 0 `", `GL_op'"'
= local 0 `", "'
- syntax [, `OPTLIST1' `OPTLIST2' `OPTLIST3' COLlinear noCONStant *]
= syntax [, COLlinear noCONStant *]
- local GL_op `"`options'"'
= local GL_op `""'
- if `"`collinear'"' != "" {
= if `""' != "" {
local GL_op `"`GL_op' `collinear'"'
.collinear = "`collinear'"
}
- if `"`constant'"' != "" {
= if `""' != "" {
local GL_op `"`GL_op' `constant'"'
.nocons = "`constant'"
}
- local I 0
- foreach OPT of local MARKOPTNAMES {
if `:list sizeof `OPT'' {
.mark_list[`++I'] = ._eqspec.new, numdep(0) wtypes(`.wtypes')
.mark_list[`I'].parse "" : ``OPT''
.mark_name.Arrpush "`OPT'"
}
}
- local I 0
- foreach OPT of local RMCOLLOPTNAMES {
if `:list sizeof `OPT'' {
.rmcoll_list[`++I'] = ._eqspec.new, numdep(0) wtypes(`.wtypes')
.rmcoll_list[`I'].parse "" : ``OPT''
.rmcoll_name.Arrpush "`OPT'"
}
}
- local I 0
- foreach OPT of local RMDCOLLOPTNAMES {
if `:list sizeof `OPT'' {
.rmdcoll_list[`++I'] = ._eqspec.new, wtypes(`.wtypes')
.rmdcoll_list[`I'].parse "" : ``OPT''
.rmdcoll_name.Arrpush "`OPT'"
}
}
- .n_eq = `EQ_n'
= .n_eq = 1
- .gl_if = `"`GL_if'"'
= .gl_if = `""'
- .gl_in = `"`GL_in'"'
= .gl_in = `""'
- .gl_wgt = `"`GL_wt'"'
= .gl_wgt = `""'
- .gl_options = `"`:list retok GL_op'"'
= .gl_options = `""'
--------------------------------------------------- end _eqlist.parse ---
- local numstataeqns = `.`o'.eq count'
---------------------------------------------------- begin _eqlist.eq ---
- version 9.2
- args item idx
- if "`item'" == "count" {
= if "count" == "count" {
- sreturn local value `"`.n_eq'"'
= sreturn local value `"1"'
- class exit `"`s(value)'"'
= class exit `"1"'
------------------------------------------------------ end _eqlist.eq ---
= local numstataeqns = 1
- if ("`verbose'"~="") display as text "number of eqns: `numstataeqns'"
= if (""~="") display as text "number of eqns: 1"
- if (`numstataeqns'==1 & "`distribution'" ~= "multinomial") local mtype un
> ivariate
= if (1==1 & "binomial" ~= "multinomial") local mtype univariate
- if ("`distribution'" == "multinomial") local mtype multinomial
= if ("binomial" == "multinomial") local mtype multinomial
- if (`numstataeqns'>1 & "`distribution'" ~= "multinomial") local mtype mul
> tivariate
= if (1>1 & "binomial" ~= "multinomial") local mtype multivariate
- assert"`mtype'"~=""
= assert"univariate"~=""
- local response
- local fp
- if "`mtype'"=="multivariate" {
= if "univariate"=="multivariate" {
local nummlwineqns = 0
local valideqns
forvalues e = 1/`numstataeqns' {
local 0 , `.`o'.eq options `e''
syntax [, EQuation(numlist integer)]
local eq `equation'
if `:list sizeof eq' == 1 {
local valideqns `valideqns' `eq'
local name`eq' `.`o'.eq name `e''
local response`eq' `.`o'.eq depvars `e''
local response `response' `response`eq''
local ++nummlwineqns
}
}
local numfpbrackets = `nummlwineqns'
forvalues e = 1/`numstataeqns' {
local 0 , `.`o'.eq options `e''
syntax [, EQuation(numlist integer)]
local eq `equation'
if "`eq'" == "" {
display as error "equation option not set for `e'"
exit 198
}
if `:list sizeof eq' == 1 {
if ("`verbose'"~="") display as text "Separate coefficients"
local fp`eq' `.`o'.eq indepvars `e''
local numfpvars`eq' :list sizeof fp`e'
local dups :list dups fp`eq'
if "`dups'" ~= "" {
display as error "`dups' are duplicated in the fixed part equation `eq'"
exit 198
}
foreach var of local fp`eq' {
local fpname`eq' `fpname`eq'' `var'.`eq'
}
local pat
forvalues a = 1/`nummlwineqns' {
if `:list a in eq' local pat `pat' 1
else local pat `pat' 0
}
local rpat`eq' `pat'
}
else {
if ("`verbose'"~="") display as text "Common coefficients"
if "`:list eq - valideqns'" ~= "" {
display as error "invalid equation(s) specified"
exit 198
}
local ++numfpbrackets
local fp`numfpbrackets' `.`o'.eq depvars `e'' `.`o'.eq indepvars `e''
local numfpvars`numfpbrackets' :list sizeof fp`e'
local dups :list dups fp`numfpbrackets'
if "`dups'" ~= "" {
display as error "`dups' are duplicated in the fixed part equation `eq'"
exit 198
}
foreach var of local fp`e' {
local fpname`numfpbrackets' `fpname`numfpbrackets'' `var'.`=subinstr("`eq
> '", " ", "", .)'
}
local pat
forvalues a = 1/`nummlwineqns' {
if `:list a in eq' local pat `pat' 1
else local pat `pat' 0
}
local rpat`numfpbrackets' `pat'
}
}
forvalues e = 1/`numfpbrackets' {
local fp `fp' `fp`e''
}
local numfpvars :list sizeof fp
}
- if "`mtype'"=="multinomial" {
= if "univariate"=="multinomial" {
local response1 `.`o'.eq depvars 1'
capture tab `response1'
local nummlwineqns `=`r(r)' - 1'
local numfpbrackets = `nummlwineqns'
local valideqns
forvalues e = 1/`nummlwineqns' {
local valideqns `valideqns' `e'
}
if ("`verbose'"~="") display as text "Valid Equations: `valideqns'"
forvalues e = 2/`numstataeqns' {
local 0 , `.`o'.eq options `e''
syntax [, CONtrast(numlist integer)]
local cat `contrast'
if ("`verbose'"~="") display as text "`cat'"
if "`cat'" == "" {
display as error "cat option not set for `e'"
exit 198
}
if "`:list cat - valideqns'" ~= "" {
display as error "Invalid contrast(s) specified. The contrast(s) specifie
> d in contrasts() must tally with the contrast(s) in the model, in this case:
> 1,2,...,`nummlwineqns'" _n
exit 198
}
if `:list sizeof cat' == 1 {
if ("`verbose'"~="") display as text "Separate coefficients"
local fp`cat' `.`o'.eq depvars `e'' `.`o'.eq indepvars `e''
local dups :list dups fp`cat'
if "`dups'" ~= "" {
display as error "`dups' are duplicated in the fixed part contrast `contr
> ast'"
exit 198
}
}
else {
if ("`verbose'"~="") display as text "Common coefficients"
local ++numfpbrackets
local fp`numfpbrackets' `.`o'.eq depvars `e'' `.`o'.eq indepvars `e''
local numfpvars`numfpbrackets' :list sizeof fp`numfpbrackets'
local fpname`numfpbrackets'
local dups :list dups fp`numfpbrackets'
if "`dups'" ~= "" {
display as error "`dups' are duplicated in the fixed part contrast `contr
> ast'"
exit 198
}
capture levelsof `response1', local(responsecats)
local catvals
local respnum = 1
foreach catn of local responsecats {
if "`catn'" ~= "`basecategory'" {
if `:list respnum in cat' local catvals `catvals' `catn'
local ++respnum
}
}
foreach var of local fp`numfpbrackets' {
local fpname`numfpbrackets' `fpname`numfpbrackets'' `var'.`=subinstr("`ca
> tvals'", " ", "", .)'
}
local pat
forvalues a = 1/`nummlwineqns' {
if `:list a in cat' local pat `pat' 1
else local pat `pat' 0
}
local rpat`numfpbrackets' `pat'
}
}
capture levelsof `response1', local(responsecats)
local e = 1
foreach cat of local responsecats {
if "`cat'" ~= "`basecategory'" {
local response`e' `response1'
local response `response' `response`e''
local fp`e' `.`o'.eq indepvars 1' `fp`e''
local numfpvars`e' :list sizeof fp`e'
local dups :list dups fp`e'
if "`dups'" ~= "" {
display as error "`dups' are duplicated in the fixed part"
exit 198
}
local fpname`e'
foreach var of local fp`e' {
local fpname`e' `fpname`e'' `var'.`cat'
}
local pat
forvalues a = 1/`nummlwineqns' {
if `:list a in e' local pat `pat' 1
else local pat `pat' 0
}
local rpat`e' `pat'
local ++e
}
}
forvalues e = 1/`numfpbrackets' {
local fp `fp' `fp`e''
}
local numfpvars :list sizeof fp
}
- if "`mtype'" == "univariate" {
= if "univariate" == "univariate" {
- local numfpbrackets = `numstataeqns'
= local numfpbrackets = 1
- local nummlwineqns = `numstataeqns'
= local nummlwineqns = 1
- forvalues e = 1/`numfpbrackets' {
= forvalues e = 1/1 {
- local name`e' `.`o'.eq name `e''
---------------------------------------------------- begin _eqlist.eq ---
- version 9.2
- args item idx
- if "`item'" == "count" {
= if "name" == "count" {
sreturn local value `"`.n_eq'"'
class exit `"`s(value)'"'
}
- else if 0 < `idx' & `idx' <= `.n_eq' {
= else if 0 < 1 & 1 <= 1 {
- .eq_list[`idx'].item `item'
= .eq_list[1].item name
------------------------------------------------ begin _eqspec.item ---
- version 9.2
- args item
- ._check_eq_item_name item, `item'
= ._check_eq_item_name item, name
------------------------------- begin _eqspec._check_eq_item_name ---
- version 9.2
- capture syntax name(name=c_item) [, NAME DEPvars INDEPvars IF IN WG
> T OTHER NOCONS OFFset EXPosure FREEParm OPTions ]
- if c(rc) error 198
- if `:list sizeof other' {
= if 0 {
local other other_markvars
}
- local item `name' `depvars' `indepvars' `if' `in' `wgt' `other' `no
> cons' `offset' `exposure' `freeparm' `options'
= local item name
- if `:list sizeof item' != 1 {
= if 1 != 1 {
error 198
}
- c_local `c_item' `item'
= c_local item name
--------------------------------- end _eqspec._check_eq_item_name ---
- local value `"`.`item''"'
= local value `""'
- sreturn local value `"`value'"'
= sreturn local value `""'
- class exit `"`value'"'
= class exit `""'
-------------------------------------------------- end _eqspec.item ---
- class exit `"`s(value)'"'
= class exit `""'
------------------------------------------------------ end _eqlist.eq ---
= local name1
- local response`e' `.`o'.eq depvars `e''
---------------------------------------------------- begin _eqlist.eq ---
- version 9.2
- args item idx
- if "`item'" == "count" {
= if "depvars" == "count" {
sreturn local value `"`.n_eq'"'
class exit `"`s(value)'"'
}
- else if 0 < `idx' & `idx' <= `.n_eq' {
= else if 0 < 1 & 1 <= 1 {
- .eq_list[`idx'].item `item'
= .eq_list[1].item depvars
------------------------------------------------ begin _eqspec.item ---
- version 9.2
- args item
- ._check_eq_item_name item, `item'
= ._check_eq_item_name item, depvars
------------------------------- begin _eqspec._check_eq_item_name ---
- version 9.2
- capture syntax name(name=c_item) [, NAME DEPvars INDEPvars IF IN WG
> T OTHER NOCONS OFFset EXPosure FREEParm OPTions ]
- if c(rc) error 198
- if `:list sizeof other' {
= if 0 {
local other other_markvars
}
- local item `name' `depvars' `indepvars' `if' `in' `wgt' `other' `no
> cons' `offset' `exposure' `freeparm' `options'
= local item depvars
- if `:list sizeof item' != 1 {
= if 1 != 1 {
error 198
}
- c_local `c_item' `item'
= c_local item depvars
--------------------------------- end _eqspec._check_eq_item_name ---
- local value `"`.`item''"'
= local value `"distress_cats"'
- sreturn local value `"`value'"'
= sreturn local value `"distress_cats"'
- class exit `"`value'"'
= class exit `"distress_cats"'
-------------------------------------------------- end _eqspec.item ---
- class exit `"`s(value)'"'
= class exit `"distress_cats"'
------------------------------------------------------ end _eqlist.eq ---
= local response1 distress_cats
- if _caller() >= 11 {
- local 0 `.`o'.eq indepvars `e''
---------------------------------------------------- begin _eqlist.eq ---
- version 9.2
- args item idx
- if "`item'" == "count" {
= if "indepvars" == "count" {
sreturn local value `"`.n_eq'"'
class exit `"`s(value)'"'
}
- else if 0 < `idx' & `idx' <= `.n_eq' {
= else if 0 < 1 & 1 <= 1 {
- .eq_list[`idx'].item `item'
= .eq_list[1].item indepvars
------------------------------------------------ begin _eqspec.item ---
- version 9.2
- args item
- ._check_eq_item_name item, `item'
= ._check_eq_item_name item, indepvars
------------------------------- begin _eqspec._check_eq_item_name ---
- version 9.2
- capture syntax name(name=c_item) [, NAME DEPvars INDEPvars IF IN WG
> T OTHER NOCONS OFFset EXPosure FREEParm OPTions ]
- if c(rc) error 198
- if `:list sizeof other' {
= if 0 {
local other other_markvars
}
- local item `name' `depvars' `indepvars' `if' `in' `wgt' `other' `no
> cons' `offset' `exposure' `freeparm' `options'
= local item indepvars
- if `:list sizeof item' != 1 {
= if 1 != 1 {
error 198
}
- c_local `c_item' `item'
= c_local item indepvars
--------------------------------- end _eqspec._check_eq_item_name ---
- local value `"`.`item''"'
= local value `"cons"'
- sreturn local value `"`value'"'
= sreturn local value `"cons"'
- class exit `"`value'"'
= class exit `"cons"'
-------------------------------------------------- end _eqspec.item ---
- class exit `"`s(value)'"'
= class exit `"cons"'
------------------------------------------------------ end _eqlist.eq ---
= local 0 cons
- syntax varlist(fv)
- fvexpand `varlist'
= fvexpand cons
- local fpname`e' `r(varlist)'
= local fpname1 cons
- fvrevar `r(varlist)'
= fvrevar cons
- local fp`e' `r(varlist)'
= local fp1 cons
- local newvars :list fp`e' - varlist
= local newvars :list fp1 - varlist
- capture _rmcoll `fp`e'', noconstant
= capture _rmcoll cons, noconstant
- local fp`e' `r(varlist)'
= local fp1 cons
- if "`newvars'" ~= "" {
= if "" ~= "" {
quietly compress `newvars'
}
- local i = 1
- foreach x in `fp`e'' {
= foreach x in cons {
- local xname :word `i' of `fpname`e''
= local xname :word 1 of cons
- if substr("`x'", 1, 2) == "o." {
= if substr("cons", 1, 2) == "o." {
local fp`e' : list fp`e' - x
local fpname`e' : list fpname`e' - xname
display as text "note: `xname' omitted because of collinearity"
}
- else {
- if "`:type `x''" == "double" & `:list x in newvars' & `doublevar' == 0{
= if "float" == "double" & 0 & 1 == 0{
quietly recast float `x', force
display as error "`xname' has more precision that MLwiN can handle, forci
> ng to float"
}
- local ++i
- }
- }
- }
- else {
local fpname`e' `.`o'.eq indepvars `e''
local fp`e' `.`o'.eq indepvars `e''
}
- local dups :list dups fp`e'
= local dups :list dups fp1
- if "`dups'" ~= "" {
= if "" ~= "" {
display as error "`dups' are duplicated in the fixed part"
exit 198
}
- local numfpvars`e' :list sizeof fp`e'
= local numfpvars1 :list sizeof fp1
- local response `response' `response`e''
= local response distress_cats
- local fp `fp' `fp`e''
= local fp cons
- }
- local numfpvars :list sizeof fp
- }
- local fpname
- forvalues e = 1/`numfpbrackets' {
= forvalues e = 1/1 {
- local fpname `fpname' `fpname`e''
= local fpname cons
- }
- forvalues e = 1/`numfpbrackets' {
= forvalues e = 1/1 {
- if ("`=word("`distribution'", `e')'"=="binomial") {
= if ("binomial"=="binomial") {
- if ("`extra'" ~= "") {
= if ("" ~= "") {
capture assert (`denominator' == 1) & (`response' == 1 | `response' == 0)
if ~_rc {
display as error "Extra option applies to binomial responses, not binary"
exit 198
}
}
- }
- }
- if ("`verbose'"~="") {
= if (""~="") {
display _n as result "MODEL " as text "Num. of responses: `numfpbrackets
> ' " as text "Model type: `mtype'" _n
forvalues e = 1/`numfpbrackets' {
display as result "FP EQUATION `e' " as text "Name: `name`e'', Response:
> `response`e'', Predictors: `fp`e'', Num. of predictors: `numfpvars`e'', Optio
> ns: `opts`e''" _n
}
}
- local residualsall
- local factorson = 0
- local numrpvars = 0
- local emptylevels
- forvalues l = `maxlevels'(-1)1 {
= forvalues l = 2(-1)1 {
- if "`level`l''"~="" {
= if "group: cons"~="" {
- gettoken lev`l'id 0 : level`l', parse(":")
= gettoken lev2id 0 : level2, parse(":")
- if `:list sizeof lev`l'id' > 1 {
= if 1 > 1 {
display as error "Only one level `l' ID is allowed; a colon should appear
> after the level `l' ID and before the variable list" _n
exit 198
}
- gettoken colon rp`l': 0, parse(":")
= gettoken colon rp2: 0, parse(":")
- if strpos("`rp`l''", ",") > 0 {
= if strpos(" cons", ",") > 0 {
gettoken rp`l' options : rp`l', parse(",") bind
if "`rp`l''" == "," local rp`l' ""
else gettoken comma options: options, parse(",")
}
- local 0 `rp`l'', lev`l'id(`lev`l'id') `options'
= local 0 cons, lev2id(group)
- if "`l'" ~= "1" {
= if "2" ~= "1" {
- syntax [anything(name=rpeqlist id="equations" equalok)], [LEV`l'id(varnam
> e)] [Diagonal] [ELements(namelist min=1 max=1)] [DESIGN(string)] [RESET(namel
> ist min=1 max=1)] [Residuals(string)] [Weightvar(varname)] [MMIds(varlist)] [
> MMWeights(varlist)] [CARIds(varlist)] [CARWeights(varlist)] [PAREXpansion] [F
> LInits(string)] [FLConstraints(string)] [FVInits(string)] [FVConstraints(stri
> ng)] [FScores(string)]
= syntax [anything(name=rpeqlist id="equations" equalok)], [LEV2id(varname)
> ] [Diagonal] [ELements(namelist min=1 max=1)] [DESIGN(string)] [RESET(namelis
> t min=1 max=1)] [Residuals(string)] [Weightvar(varname)] [MMIds(varlist)] [MM
> Weights(varlist)] [CARIds(varlist)] [CARWeights(varlist)] [PAREXpansion] [FLI
> nits(string)] [FLConstraints(string)] [FVInits(string)] [FVConstraints(string
> )] [FScores(string)]
- }
- else {
syntax [anything(name=rpeqlist id="equations" equalok)], LEV`l'id(varname
> ) [Diagonal] [ELements(namelist min=1 max=1)] [DESIGN(string)] [RESET(namelis
> t min=1 max=1)] [Residuals(string)] [Weightvar(varname)] [MMIds(varlist)] [MM
> Weights(varlist)] [CARIds(varlist)] [CARWeights(varlist)] [FLInits(string)] [
> FLConstraints(string)] [FVInits(string)] [FVConstraints(string)] [FScores(str
> ing)]
}
- tempname o
- .`o' = ._eqlist.new, eqopts(NOConstant) eqargopts(EQ) numdepvars(1) nonee
> dvarlist
= .__000003 = ._eqlist.new, eqopts(NOConstant) eqargopts(EQ) numdepvars(1)
> noneedvarlist
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

hmmmm this is actually quite long ... let me see if I can attach this in an easier format.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

For future reference it is possible to attach text files to messages on this board.

I would suggest that the first thing to check is that the mlnscript command is working as expected. To do this I would create a simple script (named for example test.mac) containing something like the following:

Code: Select all

INIT
You could then see whether it is possible to run this with the following console command:

Code: Select all

/udd/nkabe/ado/personal/mlnscript /run "test.mac"
This should display the default MLwiN settings, if not then either resolve any errors that it gives, or post their contents here.
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

Hi Chris,

Oh yes, I see now where I can attach a file. Thanks!
I created the script as you suggested, and got the following error:

Code: Select all

./mlnscript: error while loading shared libraries: libmln.so: cannot open shared object file: No such file or directory
However, that file (libmln.so) is in the same folder as mlnscript and the test.mac file ... Is this an error with the download perhaps?
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

I suspect that the directory where you have put the .so file is not on the library path (see https://unix.stackexchange.com/question ... at-runtime). To get it working you would either need to move it somewhere that is (the easiest way would be to install the relevant MLwiN installation package file for your distribution), add the path with the library to the LD_LIBRARY_PATH (which may be a security risk), or use the chrpath command to set the location in the mlnscript file (see https://stackoverflow.com/questions/137 ... led-binary).
janna
Posts: 9
Joined: Thu Jun 03, 2010 5:53 pm

Re: using runmlwin in batch mode on Unix

Post by janna »

Hi,
since updating MacOS, I cannot run mlnscript script / runmlwin.ado anymore, I get the ".. invalid name" error in Stata. I just downloaded the latest version of the mlnscript, the error remains. Thanks very much for any advice here!
Janna
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

Could you please try replacing your version of the file "runmlwin.ado" with the development version from:

https://bitbucket.org/cmm_stata/runmlwin/src/master/

and let me know if that fixes the problem?
janna
Posts: 9
Joined: Thu Jun 03, 2010 5:53 pm

Re: using runmlwin in batch mode on Unix

Post by janna »

Dear Chris,
thank you very much, your version of the runmlwin.ado seems to fix it. After it worked again, I accidentally updated the runmlwin.ado with the ssc-version and the same error occurred.
Thanks, Janna
Post Reply