Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: sample partition issue & programming

From   "Maarten Buis" <>
To   <>
Subject   st: RE: sample partition issue & programming
Date   Wed, 30 Nov 2005 16:44:12 +0100

Yang Li:

To sample approx. 80% you could make a selection variable by: -gen select = uniform()>.2- and than -regress price mpg foreign if select==1- to run a regression on the selected part only, and use for instance -predict yhat if select == 0- to get to the statistics you want. Have a look at the -simulate- command to repeat the procedure and store estimates.


Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214 

+31 20 5986715

-----Original Message-----
From: []On Behalf Of Yang Li
Sent: woensdag 30 juni 2004 18:29
Subject: st: sample partition issue & programming

Dear statalists,

I am required to randomly partition my sample into two groups with 80% and
20% split, and run the normal OLS regression on the 80% set (report R
square, Parameters, significance indicators, MSE/(var expected)). Then for
each of the observation in my 20% set, I need to use the parameters
calculated (from the 80% set) to produce and report the estimation error
(for the dependent variable).  This process is required to run 100 times.

I encountered the following difficulties:
1. how to keep both (80% and 20%) partitioned sample for further estimation
(I can only find the command "sample", but it drops the observations and
does not allow to maintain the rest 20% for further test).
2. how to output the specific estimation results (e.g. R square of 'reg')
into a spreadsheet (e.g. Excel) (I can assess the estimated results stored
in e( ), but how can I output it automatically to a Excel for report purpose).
3. how to do it automatically 100 times (How could I store the each
partitioned sample (for 100 times) separately? Is a do-file enough to
handle this?)

Best Regards,
Yang Li

School of Accounting
University of Technology, Sydney

UTS +61 2 95143684, fax +61 2 95143669

The information contained in this e-mail is confidential. It is intended
soly for the addressee. If you receive this e-mail by mistake please
promptly inform us by reply e-mail and then delete the e-mail and destroy
any printed copy. You must not disclose or use in any way the information
in the e-mail. There is no warranty that this email is error or virus free.
If it is a private communication, care should be taken in opening it to
ensure that undue offence is not given.

UTS CRICOS Provider Code:  00099F
DISCLAIMER: This email message and any accompanying attachments may contain
confidential information.  If you are not the intended recipient, do not
read, use, disseminate, distribute or copy this message or attachments.  If
you have received this message in error, please notify the sender immediately
and delete this message. Any views expressed in this message are those of the
individual sender, except where the sender expressly, and with authority,
states them to be the views the University of Technology Sydney. Before
opening any attachments, please check them for viruses and defects.
*   For searches and help try:

*   For searches and help try:

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