楼主: 蓝莲花开12
11750 27

[编程问题求助] stata mixlogit函数一直报错matrix __000002 not found [推广有奖]

  • 0关注
  • 0粉丝

硕士生

8%

还不是VIP/贵宾

-

威望
0
论坛币
9 个
通用积分
6.7635
学术水平
0 点
热心指数
2 点
信用等级
0 点
经验
326 点
帖子
26
精华
0
在线时间
238 小时
注册时间
2011-8-18
最后登录
2022-7-4

楼主
蓝莲花开12 发表于 2016-10-10 21:12:48 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
        有人用mixlogit函数吗,用自带数据和例子函数就可以进行运算,但是用自己的数据就一直出现这个错误。麻烦各位前辈知道的解答下,十分感谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:matrix Stata found logit tata matrix stata mixlogit

沙发
statax 发表于 2016-10-10 21:30:50
根据提示,就是matrix __000002这个矩阵没有啊,看看你是否定义了这个矩阵。

藤椅
夏目贵志 发表于 2016-10-11 07:13:27
__000002按道理说是不需要你定义的。把你用的具体命令都贴出来看看。

板凳
蓝莲花开12 发表于 2016-10-11 11:07:04
夏目贵志 发表于 2016-10-11 07:13
__000002按道理说是不需要你定义的。把你用的具体命令都贴出来看看。
mixlogit choice sex_mid sex_low, group(id)  rand(mid low)  这个是stata自带例子里面用到的命令,数据是stata自带的数据;
mixlogit choice delta, group(id)  rand(distobus area)   这个是我自己用到的命令,除了数据来源不同,样本量更大,完全已经在copy语句了,数据结构也和命令要求的一样,不论写在do file里还是窗口直接运行命令都会报错。

报纸
蓝莲花开12 发表于 2016-10-11 11:09:25
statax 发表于 2016-10-10 21:30
根据提示,就是matrix __000002这个矩阵没有啊,看看你是否定义了这个矩阵。
没有定义矩阵,感觉这个像是mixlogit的ado文件运行时生成的矩阵吧?但是我也不是特别懂,查过mixlogit的ado文件,ado里没有看到这个代码的错误啊

地板
statax 发表于 2016-10-11 20:28:43
蓝莲花开12 发表于 2016-10-11 11:09
没有定义矩阵,感觉这个像是mixlogit的ado文件运行时生成的矩阵吧?但是我也不是特别懂,查过mixlogit的a ...
可能是你的样本数太大了,试一下set matsize命令


    For Stata/MP and Stata/SE, the default value is 400, but it may be changed upward or downward.  The
    upper limit is 11,000.

    For Stata/IC, the initial value is 400, but it may be changed upward or downward.  The upper limit is
    800.

    The command may not be used with Small Stata; matsize is permanently frozen at 100.

7
夏目贵志 发表于 2016-10-11 22:29:19
蓝莲花开12 发表于 2016-10-11 11:07
mixlogit choice sex_mid sex_low, group(id)  rand(mid low)  这个是stata自带例子里面用到的命令,数据 ...
运行这个命令之前运行一下set trace on。然后把结果贴出来看看呢?

8
蓝莲花开12 发表于 2016-10-12 09:44:17
statax 发表于 2016-10-11 20:28
可能是你的样本数太大了,试一下set matsize命令
试过了,还是会报错。这个命令是设置变量个数的吗,变量个数不多,目前用的样本量也不是很大。

9
statax 发表于 2016-10-12 09:47:38
蓝莲花开12 发表于 2016-10-12 09:44
试过了,还是会报错。这个命令是设置变量个数的吗,变量个数不多,目前用的样本量也不是很大。
试一下set matsize 10000,还报不报错?

10
蓝莲花开12 发表于 2016-10-12 09:53:03
夏目贵志 发表于 2016-10-11 22:29
运行这个命令之前运行一下set trace on。然后把结果贴出来看看呢?
mixlogit choice delta, group(obs) rand(distobus area)
--------------------------------------------------------------------------------------------------------------------- begin mixlogit ---
- version 9.2
- if replay() {
  if (`"`e(cmd)'"' != "mixlogit") error 301
  Replay `0'
  }
- else Estimate `0'
= else Estimate choice delta, group(obs) rand(distobus area)
  ---------------------------------------------------------------------------------------------------------- begin mixlogit.Estimate ---
  - syntax varlist [if] [in] [fweight pweight iweight/], GRoup(varname) RAND(varlist) [ ID(varname) LN(integer 0) CORR NREP(integer 50)
> BURN(integer 15) Robust CLuster(varname) FRom(string) Level(integer `c(level)') NUMerical TRace GRADient HESSian SHOWSTEP ITERate(pass
> thru) TOLerance(passthru) LTOLerance(passthru) GTOLerance(passthru) NRTOLerance(passthru) CONSTraints(passthru) TECHnique(passthru) DI
> Fficult ]
  = syntax varlist [if] [in] [fweight pweight iweight/], GRoup(varname) RAND(varlist) [ ID(varname) LN(integer 0) CORR NREP(integer 50)
> BURN(integer 15) Robust CLuster(varname) FRom(string) Level(integer 95) NUMerical TRace GRADient HESSian SHOWSTEP ITERate(passthru) TO
> Lerance(passthru) LTOLerance(passthru) GTOLerance(passthru) NRTOLerance(passthru) CONSTraints(passthru) TECHnique(passthru) DIFficult
> ]
  - local mlopts `trace' `gradient' `hessian' `showstep' `iterate' `tolerance' `ltolerance' `gtolerance' `nrtolerance' `constraints' `te
> chnique' `difficult'
  = local mlopts            
  - if ("`technique'" == "technique(bhhh)") {
  = if ("" == "technique(bhhh)") {
    di in red "technique(bhhh) is not allowed."
    exit 498
    }
  - capture confirm numeric var `group'
  = capture confirm numeric var obs
  - if _rc != 0 {
    di in r "The group variable must be numeric"
    exit 498
    }
  - if ("`id'" != "") {
  = if ("" != "") {
    capture confirm numeric var `id'
    if _rc != 0 {
    di in r "The id variable must be numeric"
    exit 498
    }
    }
  - if ("`cluster'" != "") {
  = if ("" != "") {
    capture confirm numeric var `cluster'
    if _rc != 0 {
    di in r "The cluster variable must be numeric"
    exit 498
    }
    }
  - marksample touse
  - markout `touse' `group' `rand' `id' `cluster'
  = markout __000000 obs distobus area  
  - if ("`weight'" == "pweight" & "`robust'" == "" & "`cluster'" == "") local robust robust
  = if ("" == "pweight" & "" == "" & "" == "") local robust robust
  - if ("`weight'" != "") local wgt "[`weight' = `exp']"
  = if ("" != "") local wgt "[ = ]"
  - gettoken lhs fixed : varlist
  - local rhs `fixed' `rand'
  = local rhs  delta distobus area
  - qui clogit `lhs' `rhs' if `touse' `wgt', group(`group')
  = qui clogit choice delta distobus area if __000000 , group(obs)
    ------------------------------------------------------------------------------------------------------------------- begin clogit ---
    - if _caller() >= 11 {
      local vv : di "version " string(_caller()) ":"
      }
    - version 8.2, missing
    - if _by() {
      local by "by `_byvars'`_byrc0':"
      }
    - if _caller() < 8.2 {
      `by' _clogit `0'
      exit
      }
    - qui syntax [anything] [fw iw pw] [if] [in] , [ GRoup(varname) STrata(varname) VCE(passthru) CLuster(varname) DOOPT * ]
    - if `"`vce'"' != "" {
    = if `""' != "" {
      local k = ("`strata'" != "") + ("`group'" != "")
      if `k' == 2 {
      di as err "strata() and group() may not be " _c
      di as err "specified at the same time"
      exit 198
      }
      else if `k' == 0 {
      di as err "group() required"
      exit 198
      }
      else {
      local group `group'`strata'
      }
      local group0 `group'
      tempname id
      _vce_cluster clogit, groupvar(`group') newgroupvar(`id') groptname(group) `vce' cluster(`cluster')
      local vce `"`s(vce)'"'
      local idopt `s(idopt)'
      local clopt `s(clopt)'
      local gropt `s(gropt)'
      local bsgropt `s(bsgropt)'
      if "`weight'" != "" {
      local wgt [`weight'`exp']
      }
      local vceopts jkopts(`clopt') bootopts(`clopt' `idopt' `bsgropt') mark(GRoup OFFset CLuster)
      `by' _vce_parserun clogit, `vceopts' : `anything' `wgt' `if' `in', `gropt' `vce' `options'
      if "`s(exit)'" != "" {
      ereturn local group `group'
      ereturn local cluster `cluster'
      if "`cluster'" == "" {
      local cmd1 `"`e(command)'"'
      local cmd2 : subinstr local cmd1 "`id'" "`group'"
      ereturn local command `"`cmd2'"'
      }
      ereturn local cmdline `"clogit `0'"'
      exit
      }
      }
    - if replay() {
      if "`e(cmd)'" != "clogit" {
      error 301
      }
      if "`:colnames(e(b))'" == "" | !inlist("`e(opt)'", "ml", "moptimize") {
      _clogit `0'
      exit
      }
      if _by() {
      error 190
      }
      Display `0'
      error `e(rc)'
      exit
      }
    - `vv' `by' clogit_82 `0'
    =   clogit_82 choice delta distobus area if __000000 , group(obs)
      ------------------------------------------------------------------------------------------------------- begin clogit.clogit_82 ---
      - version 8.2, missing
      - syntax varlist(numeric ts fv) [fw iw pw] [if] [in] [, OR FROM(string) Level(cilevel) OFFset(varname numeric) GRoup(varname) STra
> ta(varname) Robust CLuster(varname) noLOg noDISPLAY noHEADer SCore(string) noNEST VCE(passthru) DOOPT* ]
      - local tsops = "`s(tsops)'" == "true"
      = local tsops = "" == "true"
      - if `tsops' {
      = if 0 {
        _xt, trequired
        local tvar `"`r(tvar)'"'
        if "`r(ivar)'" != "`group'" {
        di as err "{p 0 2 2"} "panel variable and group() option are inconsistent;{break}" "time-series operators require that the {opt
> group()} variable is also " "{helpb xtset} as the panel variable" "{p_end}"
        exit 459
        }
        }
      - local fvops = "`s(fvops)'" == "true" | _caller() >= 11
      = local fvops = "" == "true" | _caller() >= 11
      - if `fvops' {
      = if 0 {
        if _caller() < 11 {
        local vv "version 11:"
        }
        else local vv : di "version " string(_caller()) ":"
        local mm e2
        local negh negh
        local ml_method e2
        local fvexp "expand"
        }
      - else {
      - local vv "version 8.1:"
      - local mm d2
      - }
      - if `:length local vce' {
      = if 0 {
        _vce_parse, argopt(CLuster) opt(OIM Robust OPG) old : [`weight'`exp'], `vce' `robust' cluster(`cluster')
        local cluster `r(cluster)'
        local robust `r(robust)'
        if "`robust'" != "" {
        local vce
        }
        }
      - _get_diopts diopts options, `options'
      = _get_diopts diopts options,

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-5 19:06