-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsampstat.hlp
84 lines (60 loc) · 2.93 KB
/
sampstat.hlp
1
.-Help for ^sampstat^ Bill Rising.-Getting sampling statistics from a dataset------------------------------------------ ^sampstat^ varlist [^if^ exp] [^in^ range]^, me^an ^std^dev ^size(^#^)^ [^samp^les^(^#^)^] [^seed(^#^)^] [^saving(^filename^)^] [^replace^]Description-----------^sampstat^ is made to pull samples without replacement from a dataset, and postsummary statistics to another dataset which can be saved automatically. Rightnow, the only statistics which can be posted are the sample mean and samplestandard deviation. This program should be contrasted with @bstrap@, whichsamples with replacement.Options-------^mean^ should be specified if the sample means are wanted. The variablescontaining the sample means will have the letter m prepended to the oldvariable names. No error checking is done for duplicate variable names!^stddev^ should be specified if the sample standard deviations are wanted. Notethat at least one of ^mean^ and ^stddev^ needs to be specified. Both may bespecified if so desired. The variables containing the sample standarddeviations will have the letter s prepended to the old variable names. No errorchecking is done for duplicate variable names!^size^ gives the number of observations to be pulled as a sample. This must begreater than 0 and less than the number of observations left after applicationof the (optional) ^if^ and ^in^ clauses.^samples^ is the number of samples to pull. This defaults to 100.^seed^ allows the user to set the seed for the random number generator.^saving^ allows the new dataset to be saved as the filename after all thesamples have been pulled. Stata will complain if the file already exists,unless^replace^ is specified, since replace allows the saving file to be overwritten.Examples-------- ^sampstat bling aid, mean stddev size(20) samples(100)^ will make a new data set consisting of the sample means and standard deviations of the variables ^bling^ and ^aid^ (both existing in the present dataset) coming from 100 random samples of size 20 from the present dataset. The new dataset will have variables named ^mbling sbling maid^ and ^said^. ^sampstat aid if aid<100, mean stddev size(40) saving(sampaid) replace^ will make a new dataset, name it ^sampaid^, and save it, overwriting any already existing ^sampaid^ file. The new dataset will contain the variables ^maid^ and ^said^, which will contain sample means and standard deviations from the original dataset for samples of size 40 coming from those observations where ^aid^ is less than 100.Notes----- This is a rough implementation which undoubtedly can be easily tricked.References----------See @bstrap@ for bootstrapping, and @postfile@ for information about making such postfiles.Author------Bill RisingDepartment of BiostatisticsJohns Hopkins Universitybrising@@jhsph.edu(410) 955-2468