Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: st: record a set of values when conditions are satisfied


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Re: st: record a set of values when conditions are satisfied
Date   Tue, 5 Jul 2011 18:31:48 -0400

Zhi Su <su.zh@husky.neu.edu>:
I maintain that the problem is ill-defined, but here is one path
forward, illustrated:

clear all
drawnorm x1 x2 x3 x4 z1 z2 z3 z4 e, n(900) seed(1)
forv i=1/4 {
 g v`i'=(x`i'+z`i')/2
 }
g y=(x1+x2+x3+x4)/10+e
putmata x? v? y
mata
void i_crit(todo,b,crit,g,H)
{
external y,X,v,xx1
real matrix beta
real matrix res
real matrix s
real matrix se
real matrix t
real matrix tb
real matrix p
tb=invlogit(b')
beta=xx1*quadcross(X,y-v*tb)
res=y-v*tb-X*beta
s=mean(res:^2)*rows(X)/(rows(X)-cols(X))
se=diagonal(sqrt(s:*xx1))
t=beta:/se
p=2*ttail((rows(X)-cols(X)),abs(t))
crit=(max(p[1..4,1])-.05)^2
}
X=x1,x2,x3,x4,J(rows(x1),1,1)
xx1=invsym(quadcross(X,X))
v=v1,v2,v3,v4
init=J(1,cols(v),0)
S=optimize_init()
optimize_init_evaluator(S, &i_crit())
optimize_init_which(S,"min")
optimize_init_evaluatortype(S,"d0")
optimize_init_params(S,init)
p=optimize(S)
tp=invlogit(p')
end
getmata tp, force
g y2=y-v1*tp[1]-v2*tp[2]-v3*tp[3]-v4*tp[4]
reg y x?, nohe
reg y2 x?, nohe


On Tue, Jul 5, 2011 at 3:13 PM, Zhi Su <su.zh@husky.neu.edu> wrote:
> Hi, Austin,
>  Thanks for pointing out the problems. The goal of the sensitivity
> test is to see how change of the ratios r1, r2, r3, r4 can change
> magnititudes and significance of b1, b2, b3, b4. To be more specific,
> I want to see what value of r1, r2, r3, r4 make effects of any of x1,
> x2, x3, x4 become 0, that is, any of  the estimates of b1, b2, b3, b4
> is not significant from 0 at significance level of 0.05. It is not
> about  joint test of significance. v1, v2, v3, v4 are normal
> distribution with mean of 0 and variance and covariance of V. I might
> consider Bootstrap VCE. Any suggestion for the sensitivity test.
>  Thanks!
>
>  Su

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index