Example: confidence

A.1 SAS EXAMPLES

SAS EXAMPLESSAS is general-purpose software for a wide variety of statistical analyses. The mainprocedures (PROCs) for categorical data analyses are FREQ, GENMOD, LOGISTIC,NLMIXED, GLIMMIX, and CATMOD. PROC FREQ performs basic analyses fortwo-way and three-way contingency tables. PROC GENMOD fits generalized linearmodels using ML or Bayesian methods, cumulative link models for ordinal responses,zero-inflated Poisson regression models for count data, and GEE analyses for marginalmodels.

logistic regression model with a binary indicator as a predictor. PROC LOGISTIC uses FREQ to weight counts, serving the same purpose for which PROC FREQ uses WEIGHT. The BARNARD option in the EXACT statement provides an unconditional exact test for the di erence of proportions for 2 2 tables.

Tags:

  Corps, Example, Logistics, 1 sas examples, Proc logistic

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of A.1 SAS EXAMPLES

1 SAS EXAMPLESSAS is general-purpose software for a wide variety of statistical analyses. The mainprocedures (PROCs) for categorical data analyses are FREQ, GENMOD, LOGISTIC,NLMIXED, GLIMMIX, and CATMOD. PROC FREQ performs basic analyses fortwo-way and three-way contingency tables. PROC GENMOD fits generalized linearmodels using ML or Bayesian methods, cumulative link models for ordinal responses,zero-inflated Poisson regression models for count data, and GEE analyses for marginalmodels.

2 proc logistic gives ML fitting of binary response models, cumulative linkmodels for ordinal responses, and baseline-category logit models for nominal responses.(PROC SURVEYLOGISTIC fits binary and multi-category regression models to sur-vey data by incorporating the sample design into the analysis and using the method ofpseudo ML.) PROC CATMOD fits baseline-category logit models and can fit a varietyof other models using weighted least squares. PROC NLMIXED gives ML fitting ofgeneralized linear mixed models, using adaptive Gauss Hermite quadrature.

3 PROCGLIMMIX also fits such models with a variety of fitting EXAMPLES in this appendix show SAS code for version We focus on basicmodel fitting rather than the great variety of options. For more detail, seeStokes, Davis, and Koch (2012)Categorical Data Analysis Using SAS, 3rd , NC: SAS (2012)Logistic Regression Using SAS: Theory and Application,2nd , NC: SAS EXAMPLES of categorical data analyses with SAS for many data sets in my textAn Introduction to Categorical Data Analysis, see the useful up by the UCLA Statistical Computing Center.

4 A useful SAS site on-line withdetails about the options as well as many EXAMPLES for each PROC is the SAS code below, The @@ symbol in an input line indicates that each lineof data contains more than one observation. Input of a variable as characters ratherthan numbers requires an accompanying $ label in the INPUT statement. (But, ofcourse, if you are already a SAS user, you know this and much more!)Chapter 1: IntroductionWith PROC FREQ for a 1 2 table of counts of successes and failures for a bi-nomial variate, confidence limits for the binomial proportion include Agresti Coull,Jeffreys ( , Bayes with beta( , ) prior), score (Wilson), and Clopper Pearsonexact method and its mid-P adaptation.

5 The keyword BINOMIAL and the EXACT statement yields binomial tests. Table 1 shows code for confidence intervals for theexample in the text Section about estimating the proportion of people who arevegetarians, when 0 of 25 people in a sample are vegetarian. The AC option gives theAgresti Coull interval, and the WILSON option gives the score-test-based 1:SAS Code for Confidence Intervals for a Proportion------------------------------ ---------------------------------------- data veg;input response $ count;datalines;no 25yes 0;proc freq data=veg; weight count;tables response / binomial(ac wilson exact midp jeffreys) alpha=.

6 05;run;--------------------------------- --------------------------------------Ch apters 2 3: Two-Way Contingency TablesTable 2 uses SAS to analyze Table inCategorical Data Analysis, on education andbelief in God. PROC FREQ forms the table with the TABLES statement, orderingrow and column categories alphanumerically. To use instead the order in which thecategories appear in the data set ( , to treat the variable properly in an ordinal anal-ysis), use the ORDER = DATA option in the PROC statement.

7 The WEIGHT state-ment is needed when you enter the cell counts from the contingency table instead ofsubject-level data. PROC FREQ can conduct Pearson and likelihood-ratio chi-squaredtests of independence (CHISQ option), show its estimated expected frequencies (EX-PECTED), provide a wide assortment of measures of association and their standarderrors (MEASURES), and provide ordinal statistic ( ) with a nonzero correlation test (CMH1). You can also perform chi-squared tests using PROC GENMOD (usingloglinear models discussed in Chapters 9-10), as shown.

8 Its RESIDUALS option pro-vides cell residuals. The output labeled Std Pearson Residual is the creating mosaic plots in SAS, PROC FREQ, for 2 2 tables the MEASURES option in the TABLES statement provides confidence intervals for the odds ratio and the relative risk, andthe RISKDIFF option provides intervals for the proportions and their difference. UsingRISKDIFF(CL=(MN)) gives the interval based on inverting a score test, as suggestedby Miettinen and Nurminen (1985), which is much preferred over a Wald Table 3 for an example .

9 Also available is the simple Agresti Caffo that adds oneoutcome of each type to each sample and uses the Wald confidence interval, muchimproving on its coverage tables having small cell counts, the EXACT statement can provide variousexact analyses. These include Fisher s exact test (with its two-sidedP-value based onthe sum of the probabilities that are no greater than the probability of the observedtable) and its generalization forI Jtables, treating variables as nominal, withkeyword FISHER.

10 Table 4 analyzes the tea tasting data in Table of the 4 also uses proc logistic to get a profile-likelihood confidence interval for2 Table 2:SAS Code for Chi-Squared, Measures of Association, andResiduals for Data on Education and Belief in God in Table table;input degree belief $ count @@;datalines;1 1 9 1 2 8 1 3 27 1 4 8 1 5 47 1 6 2362 1 23 2 2 39 2 3 88 2 4 49 2 5 179 2 6 7063 1 28 3 2 48 3 3 89 3 4 19 3 5 104 3 6 293;proc freq order=data; weight count;tables degree*belief / chisq expected measures cmh1;proc genmod order=data; class degree belief;model count = degree belief / dist=poi link=log residuals;run;-------------------------- ---------------------------------------- -Table 3:SAS Code for Confidence Intervals for 2 2 Table----------------------------------- --------------------------------------da ta example ;input group $ outcome $ count @@;datalines;placebo yes 2 placebo no 18 active yes 7 active no 13;proc freq order=data.


Related search queries