Statalist


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

st: Re: save results from the simulation


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Re: save results from the simulation
Date   Sun, 26 Oct 2008 08:09:20 -0400

< >
program drop _all
clear

program define simlogit, rclass
	version 9.2
	tempvar a b
	gen `a' = $k*invnorm(uniform())+ $m
	gen `b' = $j*invnorm(uniform())+ $n
	logit y `a' `b'
	test `a' `b'
	ret scalar chia = r(chi2)
	ret scalar pvala = r(p)
	test `a'=`b'
	ret scalar chib = r(chi2)
	ret scalar pvalb = r(p)
// mfx c : don't know what you're trying to do here, but do mfx and look at return list
end

global k=1
global j=1
global m=1
global n=2
set obs 100
gen y = (invnorm(uniform()) > 0.7)

local reps 1000

simulate chia = r(chia) pvala = r(pvala) chib = r(chib) pvalb = r(pvalb), ///
reps(`reps') nodots saving(simlogit1.dta, replace): simlogit

use simlogit1
desc
su


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


On Oct 26, 2008, at 02:33 , Anupit wrote:

I am testing a simple simulation before using it with the real data.
In the program, there are some results that I would like to save.
Would anybody please give me some suggestions of how to do this,
especially when there are 2 values of chi2.

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