# R Programs Printer-friendly version

Some Helpful Resources:

 The Topic / Procedure Page R code - text data file Different chi-squared distributions chisqdistributions.R Binomial Likelihood BinLikelihood.R Simple Binomial Calculations in R 2.3.2 SimpleBinomialCalc.R Basic Poisson Calculations in R 2.3.1 PoissonCalc.R Goodness-of-Fit Test: Cell Probabilities Functions of Unknown Parameters 2.7 children.R Creates a table of one-way frequencies for observations of a die and then finds calculates a one-way chi-square test 2.5 Binomial test of proportions 2.3.2 drinking.R Poisson sampling and goodness of fit with one-way tableDatafile:  soccer2002.txt 2.3.1 Goodness of fit with X2 with G2 2.5 tomato_types.R Test of independence, and measures of associations for a 2 × 2 table 3.1.5 Test of independence, and measures of associations for an I × J table 3.2.1 4.1.1 LRstats.R pears.cor.R Gamma.f.R spear.cor.R Test of independence, and measures of associations for an I × J table; simple data visualization 3.2.3 LRstats.R pears.cor.R Gamma.f.R Enters tea tasting data and performs one-sided and two-side Fisher's exact test for count data. 3.3 Enters the voters data and performs McNemar's test for 2 × 2 tables 4.2.3 Cohen's kappa 4.2.5 MovieCritiques.R MovieCritiques.out Takes the marginal counts specified for by each parameter and using these to estitmate the contents of a specific cell. This is used to test for mutual independence. Also for other independence models. 5.3 death.R death.out breslowday.test_.R Test for various independence models in a 3-way table 5.4.1 boys.R boys.out Tests for various independence models in a 3-way table (Datafile: berkeley.txt) Loglinear models Simpson's paradox 5.4.6 Logistic Regression for 2-way tables 6.2.2 Logistic Regression for 3-way tables 6.3.1 scout.R Logistic Regression with continuous covariates 7.1.1 donner.R donner.txt ROC analysis, plot the ROC curve and a Hosmer-Lemeshow test 7.1.1 ROCandHL.R CASE STUDY: The Water Level Study Logistic Regression Analyses Water Level Study 2 (.doc) Model Selection: Backward & Stepwise Procedures  WaterStudyModelSelection.pdf Datafile: water_level.txt 7.1.1 Logistic regression 7.2.1 assay.R Baseline-category logit model 8.2.2 alligator.R Proportional-odds cumulative logit model 8.4.1 cheese.dat cheese.r Proportional-odds cumulative logit modelDatafile: abortion.txt 8.4.2 abortion.r Poisson Regression 9.2 Poisson Regression with ratesDatafile: creditcard.txt 9.3 credit_card.R CASE STUDY: The Ice Cream Study at Penn State ice_cream.R CASE STUDY: Stress and Smoking Datafile: stress.txt Loglinear models for 2 × 2 tables 10.1.2 VitaminCLoglin.R VitaminCLoglin.out Loglinear model of independence for two-way table 10.1.3 vote.R Loglinear models 3-way tables 10.2 berkeleyLoglin.R Loglinear models; model assessment and selectionDatafile: collar.txt 10.2.9 collar.R collar.out Sparse data: Sampling & Structural Zeros 11.1.1 ZerosEx.R Sparse data: Incomplete table analysis 11.1.3 health.R health3.R Ordinal data: Linear by linear association model 11.2.1 HeartDiseaseLoglin.R Dependent data: loglinear models 11.3.2 movies.R Dependent data: quasi-independence loglinear model 11.3.5 monkey.R