Statalist


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

Re: st: Re: Returning a p-value for simulation


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   Re: st: Re: Returning a p-value for simulation
Date   Sun, 10 May 2009 10:38:07 +0200

Here is an example of what I suspect you want. The variation in the -probit-s comes from a (somewhat pointless) -if- qualifier, but I am sure you will tweak it to your needs. The output is 100 p-values for the covariate "trunk"

***

//drop it beforehand
capt prog drop sim

//define the program
program define sim // , rclass
   version 10.1
 sysuse auto, clear
 prob for rep tu tr if runiform()<0.7
end

//simulate it!
//get the p-value for "trunk" in this case, but you can
//add more covariates to this
simulate (2*normal(-abs(_b[trunk]/_se[trunk]))) ///
, reps(100): sim //, obs(100)

su,d
***

HTH
Martin
_______________
----- Original Message ----- From: "John Antonakis" <[email protected]>
To: <[email protected]>
Sent: Sunday, May 10, 2009 10:26 AM
Subject: Re: st: Re: Returning a p-value for simulation


Hi Martin:

Thanks; parmtest works nice.

Once done, I added the following:

simulate _b _se, reps(20) seed (123) : sim,
[I have a program, "sim" running before, where I manipulate certain parameters]

How do I get it to simulate the p-value?

Best,
J.

____________________________________________________

Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland

Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

Faculty page:
http://www.hec.unil.ch/people/jantonakis&cl=en

Personal page:
http://www.hec.unil.ch/jantonakis
____________________________________________________



On 10.05.2009 09:38, Martin Weiss wrote:
The easiest option for John to achieve his goal is to install -ssc inst parmest- by Roger Newson and then:

******************
sysuse auto, clear
prob for price weight trunk
parmest,saving(myfile, replace)
u myfile, clear
l
******************

If he wants to dig deeper into the calculation of the results, he can replicate them in -mata-:

******************
sysuse auto, clear
prob for price weight trunk
//for z-statistic reporting commands
mata
// suck stuff into mata
b = st_matrix("e(b)")'
V = st_matrix("e(V)")
//standard errors from varcov
se = diagonal(cholesky(diag(V)))
  z = b :/ se
//show z
z
//p-values
 2*normal(-abs(z))
// CIs
  b :- invnormal(0.975):*se, b :+ invnormal(0.975):*se
end
*********************


HTH
Martin
_______________



----- Original Message ----- From: "John Antonakis" <[email protected]>
To: <[email protected]>
Sent: Sunday, May 10, 2009 12:19 AM
Subject: st: Returning a p-value for simulation


I am running an rclass program that I wish to simulate.

After estimating a probit, I want to save the coefficients, along with the t-stats and the p-values for later simulation. I figured out the former but not the latter two. What I have so far is:

probit y x1 x2
return scalar b1 =_b[x1]
return scalar b2 =_b[x2]

Thanks,
John.

--
____________________________________________________

Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland

Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

Faculty page:
http://www.hec.unil.ch/people/jantonakis&cl=en

Personal page:
http://www.hec.unil.ch/jantonakis
____________________________________________________

*
*   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/


*
*   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/
*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index