Redian新闻
>
我遇到的最不舒服的语言是Stata
avatar
我遇到的最不舒服的语言是Stata# Programming - 葵花宝典
t*s
1
我们家目前的情况是我在赚钱养家,老公在家带女儿,女儿今年五岁,在上幼儿园,老
公不是找不到工作,他是为了我,才甘心在家当家庭主男的。我做的是广告策划,我非
常爱我的这份事业,所以老公就放弃了他的工作,专心照顾女儿。
可是最近我一直在想,我是不是错了,因为我觉得老公离我越来越远了。我每天工作完
回家都很累,回家就很晚了,一般情况下都是倒头就睡,有时候老公想跟我亲热一番,
可我真的是没心情。然后的然后,他也就没心情了。
老公多次提过要找一个保姆照顾女儿,然后他就可以找一份工作,我们看了很多保姆,
可是都不是特别满意,我和老公都认为孩子要父母亲自带,不能随随便便交给保姆。一
来二去老公找工作的事也就耽误了。
前几天女儿幼儿园亲子活动,正好那天我有空,就让老公出去和朋友放松一天,打打球
什么的,我带女儿去参加活动。去了见了其他小朋友的妈妈,她们都是家庭主妇,她们
酸溜溜的跟我说,拼事业是男人的事,女人就该把家庭照顾好,还非常含蓄的说我老公
很没出息,不出去工作,靠老婆养。我想老公心里应该也是很难受的,可他为了我,很
少抱怨这些。每晚都把饭菜微波了一遍又一遍等我回来,可我经常动都不动一口,就去
卧室倒头大睡。
我现在想,我到底应不应该辞职,在家带孩子,然后让老公去实现他的梦想。
avatar
B*g
2
俺就是要咸带鱼
avatar
d*a
3
其次是SAS
相比之下,R Python Matlab要靠谱的多
cap program drop pvarirf
program define pvarirf, sortpreserve rclass // ----------------
version 11.0
#delimit ;
syntax [,
STep(integer 10)
IMPulse(varlist)
RESponse(varlist)
POrder(varlist)
OIRF
DM
CUMulative
MC(integer 0)
TABle
Level(cilevel)
DOTS
SAVE(string)
BYOPtion(string)
NODRAW
*
] ;
#delimit cr
// Capture pvar arguments
local maxlag = e(mlag)
local vars = e(depvar)
local varsn = wordcount(e(depvar))
local N = e(N)


// Pass arguments if dynamic multiplier
if "`dm'" == "dm" {
pvarirf_dm `*'

return local porder "."
return scalar step = `step'
return scalar iter = `mc'
exit
}

// Assert impulse and response variable are in e(depvar)
if "`impulse' `response'" != " " {
foreach word in `impulse' `response' {
if regexm(" `vars' ", " `word' ") == 0 {
di as err "`word' not in e(depvar)"
exit 147
}
}
}


// Assert iterations > 1 with option level
if "`level'" != "`c(level)'" & `mc' < 2 {
di as err "{bf:level} can only be specified with {bf:mc}(#)>1"
exit 198
}


// Order
if "`porder'" != "" {
cap assert wordcount("`porder'") == wordcount("`vars'")
if _rc != 0 {
di as err "porder(varlist) does not match pvar varlist"
exit 198
}

else {
local vars = "`porder'"
}
}

tempname shock
mat `shock' = I(`varsn')
mat colname `shock' = `vars'
mat rowname `shock' = `vars'

// For IRF simulation
* For AR(p) estimates simulation
tempname b b_ P
if `mc' > 0 {
mat `P' = cholesky(e(V))
}

* For Cholesky decomposition simulation
if "`oirf'" == "oirf" {
tempname C_ C E Pe L D Dp
mat `C_' = e(Sigma)
mat `C' = J(`varsn', `varsn', .)
mat colname `C' = `vars'
mat rowname `C' = `vars'
foreach imp in `vars' {
foreach res in `vars' {
mat `C'[rownumb(`C', "`imp'"), colnumb(`C', "`res'")] ///
= `C_'["`imp'", "`res'"]
}
}
mata: st_matrix("`L'", Lmatrix(`varsn'))
mata: st_matrix("`D'", Dmatrix(`varsn'))
mata: st_matrix("`Dp'", pinv(Dmatrix(`varsn')))

mat `E' = `L' * vec(`C')
mat `Pe' = cholesky((2/`N') * `Dp' * (`C'#`C') * `Dp'')
}

// Simulation
set more off
local iter = 0

while `iter' <= `mc' {

if `iter' == 0 {
mat `b' = e(b)
}

else {
mat `b_' = J(1, colsof(e(b)), .)

local bbb = colsof(`b')
forval xxx = 1/`bbb' {
mat `b_'[1,`xxx'] = invnorm(uniform())
}

mat `b' = e(b) + (`P' * `b_'')'
}


// Re-order AR(p) matrix
forval p = 1/ `maxlag' {
local coln
foreach var in `vars' {
local coln "`coln' L`p'.`var'"
}

tempname A`p'
mat `A`p'' = J(`varsn', `varsn', .)
mat rowname `A`p'' = `vars'
mat colname `A`p'' = `coln'

foreach vareq in `vars' {
foreach varex in `vars' {
mat `A`p''[rownumb(`A`p'',"`vareq'"), colnumb(`A`p'',"L`p'.`varex'"
)] ///
= `b'[1, "`vareq':L`p'.`varex'"]
}
}

}


// Estimate IRF
* IRF
tempname irf0
mat `irf0' = `shock'
forval iii = 1/`step' {
tempname irf`iii'
mat `irf`iii'' = J(`varsn', `varsn', 0)
forval jjj = 1/`maxlag' {
if `iii' >= `jjj' {
local i_j = `iii' - `jjj'
tempname irf_`jjj'
mat `irf_`jjj'' = `irf`i_j'' * `A`jjj''
mat `irf`iii'' = `irf`iii'' + `irf_`jjj''
}
}
}


* OIRF
if "`oirf'" == "oirf" {
tempname Pc
if `iter' == 0 {
mat `Pc' = cholesky(`C')
}
else {
cap drop mat `C'
tempname C_ C

mat `C_' = J(1, colsof(`Pe'), .)
local ccc = colsof(`Pe')
forval xxx = 1/`ccc' {
mat `C_'[1,`xxx'] = invnorm(uniform())
}
mat `C_' = `D'*(`E' + (`Pe' * `C_''))

local _s
local _t
forval xxx = 1/`varsn' {
local _s = `_t' + 1
local _t = `_s' + `varsn' - 1

mat `C' = nullmat(`C'), `C_'[`_s'..`_t', 1]
}

mat rowname `C' = `vars'
mat colname `C' = `vars'
cap mat `Pc' = cholesky(`C')
if _rc == 506 {
mat `Pc' = J(`varsn', `varsn', .)
local _errcount = `_errcount' + 1
}
}


forval iii = 0/`step' {
mat `irf`iii'' = `irf`iii'' * `Pc'
}
}


* Assemble IRF
local steps
tempname pirf addenda
forval ttt = 0/`step' {
mat `addenda' = `ttt', `iter'
mat colname `addenda' = step iter

local steps = "`steps' `ttt' "
if `ttt' == 0 {
mat colname `irf0' = `vars'
mat rowname `irf0' = `vars'
mat `pirf' = `addenda', vec(`irf0')'
}
else {
mat `pirf' = `pirf' `addenda', vec(`irf`ttt'')'
}
}
mat rowname `pirf' = `steps'


if `iter' == 0 {
qui {
tempfile error0 error1
preserve
clear
svmat `pirf', names(eqcol)

save `error0', replace
save `error1', replace
restore
}
}
else {
qui {
preserve
clear
svmat `pirf', names(eqcol)
append using `error1'
save `error1', replace
restore
}
}

// Dots
if "`dots'" != "" & `mc' > 0 {
if _rc != 0 {
_dots `iter' 1
}
else {
_dots `iter' 0
}
}

// Counter
local iter = `iter' + 1

}
set more on

// Display non-positive definite error covariance matrix error, if any
if "`_errcount'" != "" {
if ("`dots'" != "") & (mod(`mc',50) != 0) {
di _n(1) as err "Warning: at least one simulated error covariance
matrix not positive definite"
}
else {
di as err "Warning: at least one simulated error covariance matrix
not positive definite"
}
}

// Return output
if "`oirf'" != "" {
return local porder "`vars'"
}
else {
return local porder .
}
return scalar step = `step'
return scalar iter = `mc'


// Cumulative IRF
preserve
if "`cumulative'" != "" {
qui {
use `error0', clear
sort _step
foreach imp in `vars' {
foreach res in `vars' {
replace `imp'`res' = sum(`imp'`res')
}
}
save `error0', replace

use `error1', clear
sort _iter _step
foreach imp in `vars' {
foreach res in `vars' {
by _iter: replace `imp'`res' = sum(`imp'`res')
}
}
save `error1', replace

}
}


// Graph IRF
* Identify impulse and response variables for graphing
if "`impulse'" == "" {
local impulse `vars'
}
if "`response'" == "" {
local response `vars'
}
* Compute Gaussian approximation confidence band; Assemble IRF for graph

foreach imp in `impulse' {
foreach res in `response' {
local se "`se' se`imp'`res' =`imp'`res' "
}
}
qui {
use `error1', clear
collapse (sd) `se', by(_step)
merge 1:1 _step using `error0', nogen

foreach imp in `impulse' {
foreach res in `response' {
ren `imp'`res' irf`imp'_`res'
ren se`imp'`res' se`imp'_`res'
}
}

reshape long irf se, i(_step) j(vars) string

gen impres = .
label val impres impres
local i = `varsn'^2 + 1
foreach res in `response' {
foreach imp in `impulse' {
local i = `i' - 1
replace impres = `i' if vars == "`imp'_`res'"
label def impres `i' "`imp' : `res'", modify
}
}
gen ul = irf + invnormal(1 - (1 - `level'/100)/2)*se
gen ll = irf - invnormal(1 - (1 - `level'/100)/2)*se
}
* Save IRF file if requested
if "`save'" != "" {
order _step impres irf ll ul
label var _step "Forecast horizon"
label var impres "Impulse : Response"
label var irf "Impulse-response, mean"
label var se "Impulse-response, standard error"
label var ll "Impulse-response, `level'% CI, lower bound"
label var ul "Impulse-response, `level'% CI, upper bound"
if `mc' > 1 {
keep _step impres irf se ll ul
label data "Confidence intervals are based on `mc' Monte Carlo
simulations"
}
else {
keep _step impres irf
}
save `save'
}

* Draw IRF
if "`nodraw'" == "" {
if "`cumulative'" != "" {
local cu "Cumulative "
}
if "`oirf'" != "" {
local oi "Orthogonalized "
}

if `mc' == 0 {
graph twoway ///
(line irf _step, lcolor(dknavy)) ///
, by(impres, colfirst note("impulse : response") iscale(*0.8)
`byoption') ///
xtitle("step") ///
ytitle("`cu'`oi'IRF") ylabel(, angle(horizontal)) ///
`options'
}
else {
graph twoway ///
(rarea ul ll _step, color(gs10)) ///
(line irf _step, lcolor(dknavy)) ///
, by(impres, colfirst note("impulse : response") iscale(*0.8)
`byoption') ///
xtitle("step") ylabel(, angle(horizontal)) ///
legend(order(1 "`level'% CI" 2 "`cu'`oi'IRF")) ///
`options'
}
}



// Tabulate IRF
if "`table'" != "" {
label var _step "Forecast horizon"
qui gen impvar = ""
label var impvar "Impulse variable"
qui gen resvar = ""
label var resvar "Response variable"
local i = `varsn'^2 + 1
foreach res in `response' {
foreach imp in `impulse' {
local i = `i' - 1
qui replace impvar = "`imp'" if impres == `i'
qui replace resvar = "`res'" if impres == `i'
}
}
di _n(1) as txt "`cu'`oi'IRF"
tabdisp _step impvar, cellvar(irf) by(resvar)
}
restore

end //-------------------------------------------------------------
avatar
s*y
4
机器人需要带孩子么?
avatar
f*u
5
蹲着等
avatar
s*a
6
看着像史前语言cobol
avatar
S*6
7
我也怀疑是机器人瞎写。就一个孩子,都5岁了,至于要父母一人不工作全职带吗?
看来机器人没有经验。

【在 s*********y 的大作中提到】
: 机器人需要带孩子么?
avatar
a*e
9
大哥,stata就是用来跑跑regression的。
没人把它当语言吧。
avatar
m*3
10
只有中国搞亲子活动。

【在 S******6 的大作中提到】
: 我也怀疑是机器人瞎写。就一个孩子,都5岁了,至于要父母一人不工作全职带吗?
: 看来机器人没有经验。

avatar
a*x
11
淡水鱼呢?

【在 B*****g 的大作中提到】
: 俺就是要咸带鱼
avatar
m*r
12
这就好比是说, 我想抓个蚊子。 最不舒服的工具就是高射炮, 其次是机枪, 靠谱的
还是苍蝇拍子。
有的工具适合搞加减乘除, 有的工具适合搞算法研究。
avatar
M*s
13
广告策划,在美?你丫喝机油去!

【在 t****s 的大作中提到】
: 我们家目前的情况是我在赚钱养家,老公在家带女儿,女儿今年五岁,在上幼儿园,老
: 公不是找不到工作,他是为了我,才甘心在家当家庭主男的。我做的是广告策划,我非
: 常爱我的这份事业,所以老公就放弃了他的工作,专心照顾女儿。
: 可是最近我一直在想,我是不是错了,因为我觉得老公离我越来越远了。我每天工作完
: 回家都很累,回家就很晚了,一般情况下都是倒头就睡,有时候老公想跟我亲热一番,
: 可我真的是没心情。然后的然后,他也就没心情了。
: 老公多次提过要找一个保姆照顾女儿,然后他就可以找一份工作,我们看了很多保姆,
: 可是都不是特别满意,我和老公都认为孩子要父母亲自带,不能随随便便交给保姆。一
: 来二去老公找工作的事也就耽误了。
: 前几天女儿幼儿园亲子活动,正好那天我有空,就让老公出去和朋友放松一天,打打球

avatar
a*g
14
机器人有生育能力了?

★ 发自iPhone App: ChineseWeb 1.0.6

【在 t****s 的大作中提到】
: 我们家目前的情况是我在赚钱养家,老公在家带女儿,女儿今年五岁,在上幼儿园,老
: 公不是找不到工作,他是为了我,才甘心在家当家庭主男的。我做的是广告策划,我非
: 常爱我的这份事业,所以老公就放弃了他的工作,专心照顾女儿。
: 可是最近我一直在想,我是不是错了,因为我觉得老公离我越来越远了。我每天工作完
: 回家都很累,回家就很晚了,一般情况下都是倒头就睡,有时候老公想跟我亲热一番,
: 可我真的是没心情。然后的然后,他也就没心情了。
: 老公多次提过要找一个保姆照顾女儿,然后他就可以找一份工作,我们看了很多保姆,
: 可是都不是特别满意,我和老公都认为孩子要父母亲自带,不能随随便便交给保姆。一
: 来二去老公找工作的事也就耽误了。
: 前几天女儿幼儿园亲子活动,正好那天我有空,就让老公出去和朋友放松一天,打打球

avatar
b*c
15
老邢新一代的机器人亲戚朋友齐全,别说孩子了,法律爹妈都会来友情客串。

【在 a********g 的大作中提到】
: 机器人有生育能力了?
:
: ★ 发自iPhone App: ChineseWeb 1.0.6

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。