[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

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

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

Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

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:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index