------------------------------------------------------------------------------- help formetaparmandparmcip(Roger Newson) -------------------------------------------------------------------------------

Meta-analysis and calculating confidence intervals usingparmest-format results> sets

parmcip[if] [in] [,parmcip_opts]

metaparm[weight] [if] [in] [,metaparm_outdest_optsmetaparm_content_optsparmcip_opts]

aweights andiweights are allowed withmetaparm. See help for weights.

Description

metaparmandparmcipare resultsset-processing programs designed for use withparmestandparmbyresultssets, which have one observation per estimated parameter and data on parameter estimates. (See Newson (2006), Newson (2004), Newson (2003) and Newson (2002).)metaparminputs a dataset in memory with one observation per parameter and variables containing estimates, standard errors and (optionally) degrees of freedom, and creates an output dataset with one observation, or one observation per by-group, and data on estimates, standard errors,z- ort-statistics,P-values and confidence limits for a linear combination (weighted sum) of the input parameters, assuming that the input parameters are estimated independently (or at least are uncorrelated) for different sub-populations. The output dataset can be listed to the Stata log, saved to a disk file, or written to memory, overwriting the existing dataset.metaparmis useful for meta-analyses (where aweights are used), and can also be used with iweights for calculating confidence intervals andP-values for differences or ratios between parameters for different subpopulations.parmcipinputs a dataset in memory with one observation per parameter and variables containing parameter estimates, standard errors and (optionally) degrees of freedom, and adds new variables to the dataset, containing the confidence limits,z- ort-statistics,P-values, and (optionally) stars forP-values.parmcipis useful if the user requires confidence intervals for a Normalizing and/or variance-stabilizing transformation of the original parameters.metaparmworks by callingparmcip, and therefore should not be downloaded withoutparmcip.

Options

metaparmandparmciphave a large number of options, which fall into the following 3 groups:Option group Description --------------------------------------------------------------------------

metaparm_outdest_optsOutput-destination options formetaparmmetaparm_content_optsOutput-content options formetaparmparmcip_optsOptions formetaparmandparmcip--------------------------------------------------------------------------

Output-destination options formetaparm

optionsDescription -------------------------------------------------------------------------list(list_spec)List output dataset to Stata log and/or Results windowsaving(filename[,replace])Save output dataset to a disk filenorestoreWrite output dataset to memoryfastWrite output dataset to memory without precautionsflist(global_macro_name)Append output filename to a global macro -------------------------------------------------------------------------where

list_specis a specification of the form[

varlist] [if] [in] [ , [list_options] ]and

list_optionsis a list of options used by thelistcommand.See

metaparm_outdest_optsfor details of these options.

Output-content options formetaparm

optionsDescription -------------------------------------------------------------------------by(varlist)Variables specifying by-groupssumvar(varlist)Variables to be summed in output datasetdfcombine(combination_rule)Rule for combining degrees of freedomidnum(#)Value of numeric dataset ID variablenidnum(newvarname)Name of numeric dataset ID variableidstr(string)Value of string dataset ID variablenidstr(newvarname)Name of string dataset ID variableformat(formatting_list)Display formats for variables in the output dataset -------------------------------------------------------------------------where

combination_ruleis

satterthwaite|constantand

formatting_listis a list of form

varlist_1format_1...varlist_nformat_nSee

metaparm_content_optsfor details of these options.

Options formetaparmandparmcip

optionsDescription -------------------------------------------------------------------------notdistUse Normal ort-distributioneformEstimates and confidence limits exponentiatedfloatNumeric output variables of typefloator lessfastCalculate confidence limits without precautionsestimate(varname)Name of input estimate variablestderr(varname)Name of input standard error variabledof(varname)Name of input degrees of freedom variablezstat(newvarname)Name of outputz-statistic variabletstat(newvarname)Name of outputt-statistic variablepvalue(newvarname)Name of outputP-value variablestars(numlist)List ofP-value thresholds for starsnstars(newvarname)Name of output stars variablelevel(numlist)Confidence level(s) for calculating confidence limitsclnumber(numbering_rule)Numbering rule for naming confidence limit variablesminprefix(prefix)Prefix for lower confidence limitsmaxprefix(prefix)Prefix for upper confidence limitsreplaceReplace variables with same names as output variables -------------------------------------------------------------------------where

numbering_ruleis

level|rankSee

parmcip_optsfor details of these options.

Output datasets created bymetaparmandparmcipThese output datasets (or resultssets) are described in detail in

metaparm_resultssets.

Methods and formulas

metaparmgenerates an output dataset with one observation, or one observation per by-group, and data on estimates, standard errors and degrees of freedom for linear combinations (weighted sums) of parameters, and then usesparmcipto derive thet- orz-statistics,P-values and confidence limits. The exact method used to calculate the estimates, standard errors and degrees of freedom depends on whether thetdistoption is used, and on whether aweights or iweights are specified. In general, it is assumed that, in the input dataset (or in a by-group of the input dataset), there areNobservations, corresponding to parameterstheta_1, ..., theta_N, with corresponding standard errorsse_1, ...,se_N, corresponding coefficientsa_1, ..., a_N, and corresponding degrees of freedondf_1, ..., df_Nif thetdistoption is used. We wish to calculate an estimate for the linear combination

Theta = Sum ( a_j * theta_j )and a corresponding standard error

SE = sqrt( Sum (a_j * se_j)^2)and degrees of freedom (if

tdistis specified) calculated from thedf_jand these_jby the Satterthwaite formula (Satterthwaite, 1946), unless the user specifies the optiondfcombine(constant), in which casemetaparmchecks that the input degrees of freedomdf_jare all equal, and then sets the output degrees of freedom to the input degrees of freedom. The definition of thea_jdepends on whether iweights or aweights are specified. If iweights are specified, then thea_jare given by the result of the weight expression, which may be positive, zero or negative. If aweights are specified, then the result of the weight expression must be non-negative, and is divided by its total within the input dataset or by-group to give thea_j. If no weights are specified, then aweights are assumed, and are set to 1, so that thea_jare equal to1/N, and their sum in the dataset or by-group is equal to 1. aweights are typically specified if the user wishes to carry out a meta-analysis, whereas iweights are typically specified if the user wishes to estimate a difference between two parameterstheta_1andtheta_2in each by-group.

RemarksMore information about

parmestandparmbyresultssets can be found in Newson (2006), Newson (2004), Newson (2003) and Newson (2002). Other programs are available in the Stata community for carrying out meta-analyses, includingmeta, written by Stephen Sharp and Jonathan Sterne. (See[R] metafor details.)metaparmis complementary to these, and is designed specifically for use withparmestresultssets. Note, however, that the input resultsset does not have to be produced byparmest. It need only contain an estimate variable, a standard error variable, and a degrees of freedom variable (iftdistis specified). Linear combinations of parameters for the same model can be estimated using the official Stata commandlincom, or by thelincomestpackage, downloadable from SSC.metaparmis complementary to these, and is designed for use when parameters are estimated by sampling independently from distinct subpopulations.

parmcipmay be used for defining additional confidence limits in aparmestresultsset, with different confidence levels from those originally calculated byparmbyorparmest. However,parmcipis also useful for calculating confidence limits for transformed parameters, using standard errors calculated using the delta method.The confidence limits calculated by

metaparmorparmcipcan be plotted using theeclplotcommand, which is downloadable from SSC, and which can be used to calculate Cochrane forest plots for meta-analyses.

Examples. metaparm, list(,)

. metaparm [awei=studynum], sumvar(studynum) list(,)

. parmcip

. parmcip, replace

The following example uses the

autodata. A variablemod4is defined, equal to 0, 1, 2 or 3 for approximately equal numbers of cars. We then useparmbyto fit a regression model, comparing mileage in non-American and American cars, for cars with each value ofmod4, and to store the parameters in aparmbyresultsset in memory, which is listed. Finally, we carry out a meta-analysis on the differences between the non-American and American cars in the 4mod4groups, weighting the differences by numbers of cars to produce a weighted mean difference, which is listed, together with its 95% confidence limits andP-value.. sysuse auto, clear . gene byte mod4=mod(_n,4) . parmby "regress mpg foreign", by(mod4) norestore escal(N) rename(es_1 N) format(estimate min* max* %8.2f p %-8.2g) . bysort mod4 (N parmseq): list . metaparm [awei=N] if parm=="foreign", sumvar(N) list(,)

The following example uses the

autodata. A variableoddis defined, equal to 0 for even-numbered cars and 1 for odd-numbered cars in the order in the dataset. We then demonstrate thatmetaparm(with iweights) produces the same results asttestwith theunequaloption when comparing the weights of American and non-American cars within the odd-numbered and even-numbered categories.metaparmhas the advantage that it can store the confidence intervals in a resultsset on disk or memory, which can later be plotted usingeclplot, although this is not done here.. sysuse auto, clear . gene byte odd=mod(_n,2) . bysort odd: ttest weight, by(foreign) unequal . parmby "regress weight", by(odd foreign) norestore format(estimate min* max* %8.2f p %-8.2g) . list . metaparm [iwei=!foreign-foreign], by(odd) norestore . list odd estimate min* max* p dof

The following example uses the

autodata to demonstrate the use ofmetaparm, with the optiondfcombine(constant), to carry out an equal-variancet-test between weights of US and non-US cars. This is done using aparmbyoutput dataset, in which the commandfactext(downloadable from SSC) has been used to reconstruct the variableforeign. Again, the use ofmetaparmallows the user to save confidence intervals to be plotted and/or tabulated, although this is not done here.. sysuse auto, clear . ttest weight, by(foreign) . parmby "xi, noomit: regress weight i.foreign, noconst", norestore label format(estimate min* max* %8.2f p %-8.2g) . factext . list . metaparm [iwei=!foreign-foreign], dfcombine(constant) list(,)

The following example uses the

svysetandsvy: tabulatecommands, and the SSC packagexcontract, in theautodata to demonstrate the use ofparmcipfor calculating transformed confidence intervals. It usesxcontractto calculate counts and proportions and save them to a file on disk, usessvy: tabulateto calculate confidence intervals for the proportions of cars with each combination of the values of the variablesrep78andforeign, and usesparmestto save the estimates and standard errors of these proportions in a resultsset in memory. We then replace the estimates and standard errors of the proportions with the estimates and standard errors of the corresponding logged odds, drop the existingt-statistics,P-values and confidence limits, useparmcipto calculatet-statistics,P-values and confidence limits for the logged odds, and then calculate new estimates and confidence limits for the proportions by back-transforming the estimates and confidence limits for the logged odds. These confidence limits are listed, and are identical to those displayed bysvy: tabulate, but have the advantage that they may then be plotted usingeclplot, or listed using formats chosen by the user. (This is an example of the delta method. See[SVY] svy: tabulate twowayfor details of the formulas.). sysuse auto, clear . tempfile tf1 . xcontract rep78 foreign, zero saving(`tf1', replace) . gene byte pwt=1 . version 8: svyset [pweight=pwt] . svy: tabulate rep78 foreign, ci . parmest, norestore . list . replace stderr=stderr/(estimate*(1-estimate)) . replace estimate=log(estimate/(1-estimate)) . drop t p min* max* . parmcip . gene estimate_2=exp(estimate)/(1+exp(estimate)) . gene min95_2=exp(min95)/(1+exp(min95)) . gene max95_2=exp(max95)/(1+exp(max95)) . merge using `tf1' . sort rep78 foreign . list rep78 foreign _freq estimate_2 min95_2 max95_2, sepby(rep78)

AcknowledgementsI would like to thank Jill Starkes and Lee Sieswerda of Thunder Bay District Health Unit for drawing my attention to the example of the delta method used to calculate the confidence intervals displayed by

svy:tabulate.

AuthorRoger Newson, Imperial College London, UK. Email: r.newson@imperial.ac.uk

ReferencesNewson, R. 2006. Resultssets, resultsspreadsheets, and resultsplots in Stata. Presented at the 4th German Stata Users' Group Meeting, Mannheim, 31 March, 2006. Also downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.

Newson, R. 2004. From datasets to resultssets in Stata. Presented at the 10th United Kingdom Stata Users' Group Meeting, London, 29 June, 2004. Also downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.

Newson, R. 2003. Confidence intervals and

p-values for delivery to the end user.The Stata Journal3(3): 245-269. Pre-publication draft downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.Newson, R. 2002. Creating plots and tables of estimation results using

parmestand friends. Presented at the 8th UK Stata Users' Group Meeting, 20-21 May, 2002. Also downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.Satterthwaite, F. E. 1946. An approximate distribution of estimates of variance components.

Biometrics Bulletin2(6): 110-114.

Also seeManual:

[U] 20 Estimation and postestimation commands,[D] append,[R] lincom,[R] meta,[SVY] svyset,[SVY] svy:tabulate oneway,[SVY] svy: tabulate twoway. On-line: help forappend,lincom,svyset,svy tabulate oneway,svytabulate twowayhelp forparmest,parmby,metaparm_outdest_opts,metaparm_content_opts,parmcip_opts,metaparm_resultssets,parmest_resultssetshelp formeta,dsconcat,factext,lincomest,xcontractif installed