楼主: xianyuxiaobai
1075 0

[面板数据求助] xtcsd,pes出现unknown function *sqrt() [推广有奖]

  • 0关注
  • 0粉丝

高中生

95%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0.1500
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
559 点
帖子
11
精华
0
在线时间
49 小时
注册时间
2022-10-12
最后登录
2026-2-1

楼主
xianyuxiaobai 发表于 2022-10-22 20:43:25 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
  1. - version 6
  2. - syntax, [PESaran FREes FRIedman SHOW ABS]
  3. - preserve
  4. - if "`e(cmd)'"!="xtreg" {
  5. = if "xtreg"!="xtreg" {
  6. di in red "last estimates not xtreg"
  7. exit 301
  8. }
  9. - if "`e(model)'" !="fe" & "`e(model)'" !="re" {
  10. = if "fe" !="fe" & "fe" !="re" {
  11. error 301
  12. }
  13. - if "`pesaran'"=="" & "`frees'"=="" & "`friedman'"=="" {
  14. = if "pesaran"=="" & ""=="" & ""=="" {
  15. di in red "Method option not specified"
  16. exit
  17. }
  18. - if ("`pesaran'"~="" & ("`frees'"~=""  "`friedman'"~=""))  ("`frees'"~="" & "`friedman'"~="")        {
  19. = if ("pesaran"~="" & (""~=""  ""~=""))  (""~="" & ""~="") {
  20. di in red "Too many method options specified"
  21. exit
  22. }
  23. - qui tsset
  24. - local id "`r(panelvar)'"
  25. = local id "new_company"
  26. - local time "`r(timevar)'"
  27. = local time "year"
  28. - qui predict double __e if e(sample), e
  29. - qui drop if e(sample)==0
  30. - local ng "`e(N_g)'"
  31. = local ng "6"
  32. - local tb "`e(g_min)'"
  33. = local tb "533"
  34. - tempvar id2
  35. - qui egen `id2' = group(`id') `if' `in'
  36. = qui egen __000001 = group(new_company)  
  37. - qui sum `id2'
  38. = qui sum __000001
  39. - local Mcsunit = r(max)
  40. - if `Mcsunit'/3000 > 1 {
  41. = if 1276/3000 > 1 {
  42. tempvar base
  43. qui save `base', replace
  44. local runs = int(`Mcsunit'/3000) + 1
  45. forvalues r=1/`runs' {
  46. clear
  47. qui use `base'
  48. qui keep if `id2'>=3000*(`r'-1) & `id2'<=3000*`r'
  49. qui keep __e `id2' `time'
  50. qui reshape wide __e, i(`time') j(`id2')
  51. if `r'==1 {
  52. tempvar base2
  53. sort `time'
  54. qui save `base2', replace
  55. }
  56. else {
  57. sort `time'
  58. tempvar using`r'
  59. qui save `using`r'', replace
  60. qui use `base2'
  61. qui merge `time' using `using`r''
  62. qui save `base2', replace
  63. }
  64. }
  65. }
  66. - else {
  67. - qui keep __e `id2' `time'
  68. = qui keep __e __000001 year
  69. - qui reshape wide __e, i(`time') j(`id2')
  70. = qui reshape wide __e, i(year) j(__000001)
  71. - }
  72. - if "`frees'" != ""  "`friedman'" != "" {
  73. = if "" != ""  "" != "" {
  74. forvalues c = 1/`Mcsunit' {
  75. qui drop if __e`c'==.
  76. }
  77. qui count
  78. if r(N)<=3 {
  79. di " "
  80. di in red "There are not enough common observations to perform Frees or Friedmand tests"
  81. exit
  82. }
  83. else {
  84. local minT = _N
  85. }
  86. }
  87. - local npanel = r(N)
  88. - qui query memory
  89. - if `npanel' > r(matsize) {
  90. = if 6 > r(matsize) {
  91. di in r _n "Error: inadequate matsize; must be at least `npanel'"
  92. error 908
  93. }
  94. - tempname COR E F ABS
  95. - mat `E' = J(`ng',`ng',1)
  96. = mat __000003 = J(6,6,1)
  97. - if "`friedman'" !="" {
  98. = if "" !="" {
  99. mat `F' = J(`ng',`ng',1)
  100. }
  101. - if "`abs'" !="" {
  102. = if "" !="" {
  103. mat `ABS' = J(`ng',`ng',1)
  104. }
  105. - if "`show'" !="" {
  106. = if "" !="" {
  107. mat `COR' = J(`ng',`ng',1)
  108. }
  109. - forvalues i = 1/`Mcsunit' {
  110. = forvalues i = 1/1276 {
  111. - forvalues i = 1/`Mcsunit' {
  112. - forvalues j = 1/`Mcsunit' {
  113. = forvalues j = 1/1276 {
  114. - forvalues j = 1/`Mcsunit' {
  115. - if "`frees'"=="" & "`friedman'"==""  "`pesaran'"!="" {
  116. = if ""=="" & ""==""  "pesaran"!="" {
  117. - qui cap corr __e`i' __e`j'
  118. = qui cap corr __e1 __e1
  119. - if _rc==2000  `r(N)'==2 {
  120. = if _rc==2000  6==2 {
  121. di " "
  122. di in red "Error: The panel is highly unbalanced."
  123. di in red "Not enough common observations across panel to perform Pesaran's test."
  124. error 2001
  125. }
  126. - mat `E'[`i',`j'] = `r(rho)'*sqrt(`r(N)')
  127. = mat __000003[1,1] = .9999999999999999*sqrt(6)
  128. - if "`abs'" != "" {
  129. = if "" != "" {
  130. mat `ABS'[`i',`j'] = abs(`r(rho)')
  131. }
  132. - if "`show'" != "" {
  133. = if "" != "" {
  134. mat `COR'[`i',`j'] = `r(rho)'
  135. }
  136. - }
  137. - else {
  138. qui spearman __e`i' __e`j'
  139. mat `E'[`i',`j'] = (`r(rho)')^2
  140. if "`friedman'" != "" {
  141. mat `F'[`i',`j'] = `r(rho)'
  142. }
  143. if "`show'" !=""  "`abs'"!="" {
  144. qui corr __e`i' __e`j'
  145. if "`abs'" != "" {
  146. mat `ABS'[`i',`j'] = abs(`r(rho)')
  147. }
  148. if "`show'" != "" {
  149. mat `COR'[`i',`j'] = `r(rho)'
  150. }
  151. }
  152. }
  153. - }
  154. - if "`frees'"=="" & "`friedman'"==""  "`pesaran'"!="" {
  155. = if ""=="" & ""==""  "pesaran"!="" {
  156. - qui cap corr __e`i' __e`j'
  157. = qui cap corr __e1 __e2
  158. - if _rc==2000  `r(N)'==2 {
  159. = if _rc==2000  6==2 {
  160. di " "
  161. di in red "Error: The panel is highly unbalanced."
  162. di in red "Not enough common observations across panel to perform Pesaran's test."
  163. error 2001
  164. }
  165. - mat `E'[`i',`j'] = `r(rho)'*sqrt(`r(N)')
  166. = mat __000003[1,2] = .3532654985666145*sqrt(6)
  167. - if "`abs'" != "" {
  168. = if "" != "" {
  169. mat `ABS'[`i',`j'] = abs(`r(rho)')
  170. }
  171. - if "`show'" != "" {
  172. = if "" != "" {
  173. mat `COR'[`i',`j'] = `r(rho)'
  174. }
  175. - }
  176. - else {
  177. qui spearman __e`i' __e`j'
  178. mat `E'[`i',`j'] = (`r(rho)')^2
  179. if "`friedman'" != "" {
  180. mat `F'[`i',`j'] = `r(rho)'
  181. }
  182. if "`show'" !=""  "`abs'"!="" {
  183. qui corr __e`i' __e`j'
  184. if "`abs'" != "" {
  185. mat `ABS'[`i',`j'] = abs(`r(rho)')
  186. }
  187. if "`show'" != "" {
  188. mat `COR'[`i',`j'] = `r(rho)'
  189. }
  190. }
  191. }
  192. - }
  193. - if "`frees'"=="" & "`friedman'"==""  "`pesaran'"!="" {
  194. = if ""=="" & ""==""  "pesaran"!="" {
  195. - qui cap corr __e`i' __e`j'
  196. = qui cap corr __e1 __e3
  197. - if _rc==2000  `r(N)'==2 {
  198. = if _rc==2000  0==2 {
  199. di " "
  200. di in red "Error: The panel is highly unbalanced."
  201. di in red "Not enough common observations across panel to perform Pesaran's test."
  202. error 2001
  203. }
  204. - mat `E'[`i',`j'] = `r(rho)'*sqrt(`r(N)')
  205. = mat __000003[1,3] = *sqrt(0)
  206. unknown function *sqrt()
  207. if "`abs'" != "" {
  208. mat `ABS'[`i',`j'] = abs(`r(rho)')
  209. }
  210. if "`show'" != "" {
  211. mat `COR'[`i',`j'] = `r(rho)'
  212. }
  213. }
  214. else {
  215. qui spearman __e`i' __e`j'
  216. mat `E'[`i',`j'] = (`r(rho)')^2
  217. if "`friedman'" != "" {
  218. mat `F'[`i',`j'] = `r(rho)'
  219. }
  220. if "`show'" !=""  "`abs'"!="" {
  221. qui corr __e`i' __e`j'
  222. if "`abs'" != "" {
  223. mat `ABS'[`i',`j'] = abs(`r(rho)')
  224. }
  225. if "`show'" != "" {
  226. mat `COR'[`i',`j'] = `r(rho)'
  227. }
  228. }
  229. }
  230. }
  231. }
复制代码
请问是我的数据出了什么问题呢?非常感谢!

二维码

扫码加我 拉你入群

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

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

关键词:function UNKNOWN xtcsd Known Know

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-2-9 00:45