Simulating Multivariate Normal Data

Size: px
Start display at page:

Download "Simulating Multivariate Normal Data"

Transcription

1 Simulating Multivariate Normal Data You have a population correlation matrix and wish to simulate a set of data randomly sampled from a population with that structure. I shall present here code and examples for doing this with SAS and with R. SAS The code below will simulate data for a matrix of correlations between variables Y1, Y2, Y3, X1, X2, and X3. The user enters the number of subjects (NS), population correlation matrix, number of X variables, number of Y variables, and number of XY correlations. The code was obtained from a document authored by Ali A. Al-Subaihi. I made two minor modifications one to correct a malformed do loop and one to print out the raw data. OPTIONS ls=100 ps=60 nodate nonumber; proc iml; /********* The Parameters **************/ NS=20; /* No. of subjects */ PopCor={ , , , , , }; %Let NY=3; /* No. of the y's */ %Let NX=3; /* No. of the x's */ %Let NPC=9; /* No. of yx correlations = NY*NX */ /***************************************************/ NV=&NY+&NX; /* No. of Variables */ CorY= PopCor[1:&NY,1:&NY]; /* Corr. among the y's */ CorX= PopCor[&NY+1:NV,&NY+1:NV]; /* Corr. among the x's */ CorYX= PopCor[&NY+1:NV,1:&NY]; /* Corr. betw. the y's & the x's */ do i=1 to ncol(coryx); /* Corr. betw. the y's & the x's as a column*/ CorYXs=CorYXs//CorYX[,i]; end; %macro loop(npc); %Do i=1 %to &NPC; /* Bi's Correlation matrices */ Cryx&i=I(2); Cryx&i[1,2]=CorYXs[&i,1]; Cryx&i[2,1]=CorYXs[&i,1]; %end; %mend loop; %loop (&npc); X=Rannor(Repeat(0,NS,&NX))*root(CorX); /* The X data matrix */ y=rannor(repeat(0,ns,&ny))*root(cory); /* The Y data matrix */ DaXs=0*j(ns,&NX); %macro loop2 (NY); %Let k=0; %do j= 1 %to &NY; %do i=1 %to &NX; %Let c=%eval(&i+&k); %put c=&c; dat=(y[,&j] X[,&i])*(root(CrYX&c)); dat2=dat2 dat[,2]; %end; %Let k=&c;

2 daxs=daxs+dat2; free dat2; %end; %mend loop2; %loop2 (&NY ); daxs=daxs*(1/&ny); data=y daxs; /* The final data matrix */ eg=eigval(corr(daxs)); CXs=(eg[<>,1]-1)/(&NX-1); /* The average Correlations among all x's */ eg=eigval(corr(y)); CYs=(eg[<>,1]-1)/(&NY-1); /* The average Correlations among all y's */ Call=corr(data); /* Correlations among all data */ ca=call[1:&ny,(&ny+1):(&ny+&nx)]; print 'The Correlations between Xs and Ys',ca, 'The average Correlations among all Xs = ' CXs, 'The average Correlations among all Xs = 'CYs, 'The total correlation matrix of the data', call; Print Y DaXs; quit; Here is the output The SAS System The Correlations between Xs and Ys ca X1 X2 X3 Y Y Y CXs The average Correlations among all Xs = CYs The average Correlations among all Xs = The total correlation matrix of the data Call Y1 Y2 Y3 X1 X2 X3 Y Y Y X X X

3 One can bring this correlation matrix into SAS and then conduct whatever analysis is desired. You should add to the input correlation matrix the Ns, the means, and the standard deviations. See Type=Corr Data Sets in SAS. Here are the simulated raw scores for the 20 cases. The sample correlation matrix would be closer to the population correlation matrix were we to have set NS to a larger value. These scores can be simply copied and pasted into a plain text file to input into SAS or another stat pack later. Y1 y Y2 Y3 X1 DaXs X2 X Here I illustrate doing an analysis with these simulated data. data duh; input y1 y2 y3 x1 x2 x3; cards;

4 proc corr; run; Here is the output: The SAS System The CORR Procedure 6 Variables: y1 y2 y3 x1 x2 x3 Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum y y y x x x Pearson Correlation Coefficients, N = 20 Prob > r under H0: Rho=0 y1 y2 y3 x1 x2 x3 y y y x x x

5 R Generating Multivariate Random Associated Data shows how to generate random data from a specified correlation matrix. I made minor modifications in the code, including code to write the raw data to a csv file. The user provides the population correlation matrix, number of rows in that matrix, and number of observations to be generated. R <- matrix(cbind( 1,.80,.2,.80,1,.7,.2,.7,1), nrow=3); U <- t(chol(r)); nvars <- dim(u)[1]; numobs <- 100; set.seed(1); random.normal <- matrix(rnorm(nvars*numobs,0,1), nrow=nvars, ncol=numobs); X <- U %*% random.normal; newx <- t(x); raw <- as.data.frame(newx); orig.raw <- as.data.frame(t(random.normal)); names(raw) <- c("response","predictor1","predictor2"); cor(raw); write.csv(raw, file = "priapus.csv") The sample correlation matrix will be output, like this: Response predictor1 predictor2 response predictor predictor This sample correlation matrix can be input into SAS, or you can use the raw data that was written to the csv file. When you open the csv file, it will look like that shown below. Before importing it into a stat pack, you should either delete the leftmost column or name it ID, Case, Subject, or other appropriate term. You may also wish to save it as an xlsx file rather than a csv file. Karl L. Wuensch, 9-November-2015 Return to Wuensch s Stats Lessons

6 Here I imported the raw data into SAS and played with it a bit: Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum Label response response predictor predictor1 predictor predictor2 Pearson Correlation Coefficients, N = 100 Prob > r under H0: Rho=0 response predictor1 predictor2 response response predictor1 predictor predictor predictor

7 The SAS System The REG Procedure Model: MODEL1 Dependent Variable: response response Number of Observations Read 100 Number of Observations Used 100 Analysis of Variance Source DF Sum of Squares Mean Square F Value Pr > F Model Error Corrected Total Root MSE R-Square Dependent Mean Adj R-Sq Coeff Var Variable Label DF Parameter Estimate Parameter Estimates Standard Error t Value Pr > t Standardized Estimate Intercept Intercept predictor1 predictor predictor2 predictor Do notice that predictor2 is suppressing irrelevant variance in predictor1. As written, the R code provided above will produce the same sample correlation matrix every time you run it. To get a different matrix randomly obtained from the same population matrix, all you need do is change the seed number. Here is the output when I changed the see from 1 to 27858: response predictor1 predictor2 response predictor predictor

Simulating Correlated Multivariate Pseudorandom Numbers

Simulating Correlated Multivariate Pseudorandom Numbers Simulating Correlated ultivariate Pseudorandom Numbers Ali A. Al-Subaihi Institute of Public Administration Riadh 4, Saudi Arabia subaihia@ipa.edu.sa Abstract A modification of the Kaiser and Dichman (96)

More information

CH5: CORR & SIMPLE LINEAR REFRESSION =======================================

CH5: CORR & SIMPLE LINEAR REFRESSION ======================================= STAT 430 SAS Examples SAS5 ===================== ssh xyz@glue.umd.edu, tap sas913 (old sas82), sas https://www.statlab.umd.edu/sasdoc/sashtml/onldoc.htm CH5: CORR & SIMPLE LINEAR REFRESSION =======================================

More information

ST512. Fall Quarter, Exam 1. Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false.

ST512. Fall Quarter, Exam 1. Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false. ST512 Fall Quarter, 2005 Exam 1 Name: Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false. 1. (42 points) A random sample of n = 30 NBA basketball

More information

Stat 5100 Handout #6 SAS: Linear Regression Remedial Measures

Stat 5100 Handout #6 SAS: Linear Regression Remedial Measures Stat 5100 Handout #6 SAS: Linear Regression Remedial Measures Example: Age and plasma level for 25 healthy children in a study are reported. Of interest is how plasma level depends on age. (Text Table

More information

Conditional and Unconditional Regression with No Measurement Error

Conditional and Unconditional Regression with No Measurement Error Conditional and with No Measurement Error /* reg2ways.sas */ %include 'readsenic.sas'; title2 ''; proc reg; title3 'Conditional Regression'; model infrisk = stay census; proc calis cov; /* Analyze the

More information

Factorial ANOVA. Skipping... Page 1 of 18

Factorial ANOVA. Skipping... Page 1 of 18 Factorial ANOVA The potato data: Batches of potatoes randomly assigned to to be stored at either cool or warm temperature, infected with one of three bacterial types. Then wait a set period. The dependent

More information

Within-Cases: Multivariate approach part one

Within-Cases: Multivariate approach part one Within-Cases: Multivariate approach part one /* sleep2.sas */ options linesize=79 noovp formdlim=' '; title "Student's Sleep data: Matched t-tests with proc reg"; data bedtime; infile 'studentsleep.data'

More information

Stat 5100 Handout #19 SAS: Influential Observations and Outliers

Stat 5100 Handout #19 SAS: Influential Observations and Outliers Stat 5100 Handout #19 SAS: Influential Observations and Outliers Example: Data collected on 50 countries relevant to a cross-sectional study of a lifecycle savings hypothesis, which states that the response

More information

THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL. STOR 455 Midterm 1 September 28, 2010

THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL. STOR 455 Midterm 1 September 28, 2010 THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL STOR 455 Midterm September 8, INSTRUCTIONS: BOTH THE EXAM AND THE BUBBLE SHEET WILL BE COLLECTED. YOU MUST PRINT YOUR NAME AND SIGN THE HONOR PLEDGE

More information

Centering and Interactions: The Training Data

Centering and Interactions: The Training Data Centering and Interactions: The Training Data A random sample of 150 technical support workers were first given a test of their technical skill and knowledge, and then randomly assigned to one of three

More information

Factorial ANOVA with SAS

Factorial ANOVA with SAS Factorial ANOVA with SAS /* potato305.sas */ options linesize=79 noovp formdlim='_' ; title 'Rotten potatoes'; title2 ''; proc format; value tfmt 1 = 'Cool' 2 = 'Warm'; data spud; infile 'potato2.data'

More information

Bivariate (Simple) Regression Analysis

Bivariate (Simple) Regression Analysis Revised July 2018 Bivariate (Simple) Regression Analysis This set of notes shows how to use Stata to estimate a simple (two-variable) regression equation. It assumes that you have set Stata up on your

More information

1 Downloading files and accessing SAS. 2 Sorting, scatterplots, correlation and regression

1 Downloading files and accessing SAS. 2 Sorting, scatterplots, correlation and regression Statistical Methods and Computing, 22S:30/105 Instructor: Cowles Lab 2 Feb. 6, 2015 1 Downloading files and accessing SAS. We will be using the billion.dat dataset again today, as well as the OECD dataset

More information

THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533. Time: 50 minutes 40 Marks FRST Marks FRST 533 (extra questions)

THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533. Time: 50 minutes 40 Marks FRST Marks FRST 533 (extra questions) THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533 MIDTERM EXAMINATION: October 14, 2005 Instructor: Val LeMay Time: 50 minutes 40 Marks FRST 430 50 Marks FRST 533 (extra questions) This examination

More information

CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening

CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening Variables Entered/Removed b Variables Entered GPA in other high school, test, Math test, GPA, High school math GPA a Variables Removed

More information

Cell means coding and effect coding

Cell means coding and effect coding Cell means coding and effect coding /* mathregr_3.sas */ %include 'readmath.sas'; title2 ''; /* The data step continues */ if ethnic ne 6; /* Otherwise, throw the case out */ /* Indicator dummy variables

More information

STAT:5201 Applied Statistic II

STAT:5201 Applied Statistic II STAT:5201 Applied Statistic II Two-Factor Experiment (one fixed blocking factor, one fixed factor of interest) Randomized complete block design (RCBD) Primary Factor: Day length (short or long) Blocking

More information

STAT 2607 REVIEW PROBLEMS Word problems must be answered in words of the problem.

STAT 2607 REVIEW PROBLEMS Word problems must be answered in words of the problem. STAT 2607 REVIEW PROBLEMS 1 REMINDER: On the final exam 1. Word problems must be answered in words of the problem. 2. "Test" means that you must carry out a formal hypothesis testing procedure with H0,

More information

6:1 LAB RESULTS -WITHIN-S ANOVA

6:1 LAB RESULTS -WITHIN-S ANOVA 6:1 LAB RESULTS -WITHIN-S ANOVA T1/T2/T3/T4. SStotal =(1-12) 2 + + (18-12) 2 = 306.00 = SSpill + SSsubj + SSpxs df = 9-1 = 8 P1 P2 P3 Ms Ms-Mg 1 8 15 8.0-4.0 SSsubj= 3x(-4 2 + ) 4 17 15 12.0 0 = 96.0 13

More information

Intermediate SAS: Statistics

Intermediate SAS: Statistics Intermediate SAS: Statistics OIT TSS 293-4444 oithelp@mail.wvu.edu oit.wvu.edu/training/classmat/sas/ Table of Contents Procedures... 2 Two-sample t-test:... 2 Paired differences t-test:... 2 Chi Square

More information

Week 5: Multiple Linear Regression II

Week 5: Multiple Linear Regression II Week 5: Multiple Linear Regression II Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ARR 1 Outline Adjusted R

More information

SAS/STAT 13.1 User s Guide. The NESTED Procedure

SAS/STAT 13.1 User s Guide. The NESTED Procedure SAS/STAT 13.1 User s Guide The NESTED Procedure This document is an individual chapter from SAS/STAT 13.1 User s Guide. The correct bibliographic citation for the complete manual is as follows: SAS Institute

More information

Introduction to SAS proc calis

Introduction to SAS proc calis Introduction to SAS proc calis /* path1.sas */ %include 'SenicRead.sas'; title2 ''; /************************************************************************ * * * Cases are hospitals * * * * stay Average

More information

SAS/STAT 13.1 User s Guide. The SCORE Procedure

SAS/STAT 13.1 User s Guide. The SCORE Procedure SAS/STAT 13.1 User s Guide The SCORE Procedure This document is an individual chapter from SAS/STAT 13.1 User s Guide. The correct bibliographic citation for the complete manual is as follows: SAS Institute

More information

CSC 328/428 Summer Session I 2002 Data Analysis for the Experimenter FINAL EXAM

CSC 328/428 Summer Session I 2002 Data Analysis for the Experimenter FINAL EXAM options pagesize=53 linesize=76 pageno=1 nodate; proc format; value $stcktyp "1"="Growth" "2"="Combined" "3"="Income"; data invstmnt; input stcktyp $ perform; label stkctyp="type of Stock" perform="overall

More information

Repeated Measures Part 4: Blood Flow data

Repeated Measures Part 4: Blood Flow data Repeated Measures Part 4: Blood Flow data /* bloodflow.sas */ options linesize=79 pagesize=100 noovp formdlim='_'; title 'Two within-subjecs factors: Blood flow data (NWK p. 1181)'; proc format; value

More information

Cut Out The Cut And Paste: SAS Macros For Presenting Statistical Output ABSTRACT INTRODUCTION

Cut Out The Cut And Paste: SAS Macros For Presenting Statistical Output ABSTRACT INTRODUCTION Cut Out The Cut And Paste: SAS Macros For Presenting Statistical Output Myungshin Oh, UCLA Department of Biostatistics Mel Widawski, UCLA School of Nursing ABSTRACT We, as statisticians, often spend more

More information

Week 4: Simple Linear Regression III

Week 4: Simple Linear Regression III Week 4: Simple Linear Regression III Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ARR 1 Outline Goodness of

More information

Stat 500 lab notes c Philip M. Dixon, Week 10: Autocorrelated errors

Stat 500 lab notes c Philip M. Dixon, Week 10: Autocorrelated errors Week 10: Autocorrelated errors This week, I have done one possible analysis and provided lots of output for you to consider. Case study: predicting body fat Body fat is an important health measure, but

More information

5.5 Regression Estimation

5.5 Regression Estimation 5.5 Regression Estimation Assume a SRS of n pairs (x, y ),..., (x n, y n ) is selected from a population of N pairs of (x, y) data. The goal of regression estimation is to take advantage of a linear relationship

More information

The NESTED Procedure (Chapter)

The NESTED Procedure (Chapter) SAS/STAT 9.3 User s Guide The NESTED Procedure (Chapter) SAS Documentation This document is an individual chapter from SAS/STAT 9.3 User s Guide. The correct bibliographic citation for the complete manual

More information

Outline. Topic 16 - Other Remedies. Ridge Regression. Ridge Regression. Ridge Regression. Robust Regression. Regression Trees. Piecewise Linear Model

Outline. Topic 16 - Other Remedies. Ridge Regression. Ridge Regression. Ridge Regression. Robust Regression. Regression Trees. Piecewise Linear Model Topic 16 - Other Remedies Ridge Regression Robust Regression Regression Trees Outline - Fall 2013 Piecewise Linear Model Bootstrapping Topic 16 2 Ridge Regression Modification of least squares that addresses

More information

1 The SAS System 23:01 Friday, November 9, 2012

1 The SAS System 23:01 Friday, November 9, 2012 2101f12HW9chickwts.log Saved: Wednesday, November 14, 2012 6:50:49 PM Page 1 of 3 1 The SAS System 23:01 Friday, November 9, 2012 NOTE: Copyright (c) 2002-2010 by SAS Institute Inc., Cary, NC, USA. NOTE:

More information

Paper CC-016. METHODOLOGY Suppose the data structure with m missing values for the row indices i=n-m+1,,n can be re-expressed by

Paper CC-016. METHODOLOGY Suppose the data structure with m missing values for the row indices i=n-m+1,,n can be re-expressed by Paper CC-016 A macro for nearest neighbor Lung-Chang Chien, University of North Carolina at Chapel Hill, Chapel Hill, NC Mark Weaver, Family Health International, Research Triangle Park, NC ABSTRACT SAS

More information

Section 2.2: Covariance, Correlation, and Least Squares

Section 2.2: Covariance, Correlation, and Least Squares Section 2.2: Covariance, Correlation, and Least Squares Jared S. Murray The University of Texas at Austin McCombs School of Business Suggested reading: OpenIntro Statistics, Chapter 7.1, 7.2 1 A Deeper

More information

Conducting a Path Analysis With SPSS/AMOS

Conducting a Path Analysis With SPSS/AMOS Conducting a Path Analysis With SPSS/AMOS Download the PATH-INGRAM.sav data file from my SPSS data page and then bring it into SPSS. The data are those from the research that led to this publication: Ingram,

More information

Rapid Rolling Window Regressions via Home Made Sum of Squares and Cross Products. Mark Keintz Wharton Research Data Services PhilaSUG March 19, 2019

Rapid Rolling Window Regressions via Home Made Sum of Squares and Cross Products. Mark Keintz Wharton Research Data Services PhilaSUG March 19, 2019 Rapid Rolling Window Regressions via Home Made Sum of Squares and Cross Products Mark Keintz Wharton Research Data Services PhilaSUG March 19, 2019 The Object: Efficient Rolling Window Regressions Explore

More information

Baruch College STA Senem Acet Coskun

Baruch College STA Senem Acet Coskun Baruch College STA 9750 BOOK BUY A Predictive Mode Senem Acet Coskun Table of Contents Summary 3 Why this topic? 4 Data Sources 6 Variable Definitions 7 Descriptive Statistics 8 Univariate Analysis 9 Two-Sample

More information

Getting Correct Results from PROC REG

Getting Correct Results from PROC REG Getting Correct Results from PROC REG Nate Derby Stakana Analytics Seattle, WA, USA SUCCESS 3/12/15 Nate Derby Getting Correct Results from PROC REG 1 / 29 Outline PROC REG 1 PROC REG 2 Nate Derby Getting

More information

Confirmatory Factor Analysis on the Twin Data: Try One

Confirmatory Factor Analysis on the Twin Data: Try One Confirmatory Factor Analysis on the Twin Data: Try One /************ twinfac2.sas ********************/ TITLE2 'Confirmatory Factor Analysis'; %include 'twinread.sas'; proc calis corr; /* Analyze the correlation

More information

Withdrawn Equity Offerings: Event Study and Cross-Sectional Regression Analysis Using Eventus Software

Withdrawn Equity Offerings: Event Study and Cross-Sectional Regression Analysis Using Eventus Software Withdrawn Equity Offerings: Event Study and Cross-Sectional Regression Analysis Using Eventus Software Copyright 1998-2001 Cowan Research, L.C. This note demonstrates the use of Eventus software to conduct

More information

EXST3201 Mousefeed01 Page 1

EXST3201 Mousefeed01 Page 1 EXST3201 Mousefeed01 Page 1 3 /* 4 Examine differences among the following 6 treatments 5 N/N85 fed normally before weaning and 85 kcal/wk after 6 N/R40 fed normally before weaning and 40 kcal/wk after

More information

Chapter 6: Linear Model Selection and Regularization

Chapter 6: Linear Model Selection and Regularization Chapter 6: Linear Model Selection and Regularization As p (the number of predictors) comes close to or exceeds n (the sample size) standard linear regression is faced with problems. The variance of the

More information

STAT 5200 Handout #25. R-Square & Design Matrix in Mixed Models

STAT 5200 Handout #25. R-Square & Design Matrix in Mixed Models STAT 5200 Handout #25 R-Square & Design Matrix in Mixed Models I. R-Square in Mixed Models (with Example from Handout #20): For mixed models, the concept of R 2 is a little complicated (and neither PROC

More information

STAT 503 Fall Introduction to SAS

STAT 503 Fall Introduction to SAS Getting Started Introduction to SAS 1) Download all of the files, sas programs (.sas) and data files (.dat) into one of your directories. I would suggest using your H: drive if you are using a computer

More information

APPLICATION OF FUZZY REGRESSION METHODOLOGY IN AGRICULTURE USING SAS

APPLICATION OF FUZZY REGRESSION METHODOLOGY IN AGRICULTURE USING SAS APPLICATION OF FUZZY REGRESSION METHODOLOGY IN AGRICULTURE USING SAS Himadri Ghosh and Savita Wadhwa I.A.S.R.I., Library Avenue, Pusa, New Delhi 110012 him_adri@iasri.res.in, savita@iasri.res.in Multiple

More information

. predict mod1. graph mod1 ed, connect(l) xlabel ylabel l1(model1 predicted income) b1(years of education)

. predict mod1. graph mod1 ed, connect(l) xlabel ylabel l1(model1 predicted income) b1(years of education) DUMMY VARIABLES AND INTERACTIONS Let's start with an example in which we are interested in discrimination in income. We have a dataset that includes information for about 16 people on their income, their

More information

Introduction to Statistical Analyses in SAS

Introduction to Statistical Analyses in SAS Introduction to Statistical Analyses in SAS Programming Workshop Presented by the Applied Statistics Lab Sarah Janse April 5, 2017 1 Introduction Today we will go over some basic statistical analyses in

More information

Simulation of Imputation Effects Under Different Assumptions. Danny Rithy

Simulation of Imputation Effects Under Different Assumptions. Danny Rithy Simulation of Imputation Effects Under Different Assumptions Danny Rithy ABSTRACT Missing data is something that we cannot always prevent. Data can be missing due to subjects' refusing to answer a sensitive

More information

DESIGN OF EXPERIMENTS and ROBUST DESIGN

DESIGN OF EXPERIMENTS and ROBUST DESIGN DESIGN OF EXPERIMENTS and ROBUST DESIGN Problems in design and production environments often require experiments to find a solution. Design of experiments are a collection of statistical methods that,

More information

Contrasts and Multiple Comparisons

Contrasts and Multiple Comparisons Contrasts and Multiple Comparisons /* onewaymath.sas */ title2 'Oneway with contrasts and multiple comparisons (Exclude Other/DK)'; %include 'readmath.sas'; if ethnic ne 6; /* Otherwise, throw the case

More information

Stat 5100 Handout #15 SAS: Alternative Predictor Variable Types

Stat 5100 Handout #15 SAS: Alternative Predictor Variable Types Stat 5100 Handout #15 SAS: Alternative Predictor Variable Types Example 1: (Table 8.1) Study looks at the effects of the charge rate and temperature on the life of a new type of power cell. A small-scale

More information

T-test og variansanalyse i SAS. T-test og variansanalyse i SAS p.1/18

T-test og variansanalyse i SAS. T-test og variansanalyse i SAS p.1/18 T-test og variansanalyse i SAS T-test og variansanalyse i SAS p.1/18 T-test og variansanalyse i SAS T-test (Etstik, tostik, parrede observationer) Variansanalyse SAS-procedurer: PROC TTEST PROC GLM T-test

More information

SAS/STAT 14.1 User s Guide. Special SAS Data Sets

SAS/STAT 14.1 User s Guide. Special SAS Data Sets SAS/STAT 14.1 User s Guide Special SAS Data Sets This document is an individual chapter from SAS/STAT 14.1 User s Guide. The correct bibliographic citation for this manual is as follows: SAS Institute

More information

Annexes : Sorties SAS pour l'exercice 3. Code SAS. libname process 'G:\Enseignements\M2ISN-Series temp\sas\';

Annexes : Sorties SAS pour l'exercice 3. Code SAS. libname process 'G:\Enseignements\M2ISN-Series temp\sas\'; Annexes : Sorties SAS pour l'exercice 3 Code SAS libname process 'G:\Enseignements\M2ISN-Series temp\sas\'; /* Etape 1 - Création des données*/ proc iml; phi={1-1.583 0.667-0.083}; theta={1}; y=armasim(phi,

More information

CREATING THE ANALYSIS

CREATING THE ANALYSIS Chapter 14 Multiple Regression Chapter Table of Contents CREATING THE ANALYSIS...214 ModelInformation...217 SummaryofFit...217 AnalysisofVariance...217 TypeIIITests...218 ParameterEstimates...218 Residuals-by-PredictedPlot...219

More information

range: [1,20] units: 1 unique values: 20 missing.: 0/20 percentiles: 10% 25% 50% 75% 90%

range: [1,20] units: 1 unique values: 20 missing.: 0/20 percentiles: 10% 25% 50% 75% 90% ------------------ log: \Term 2\Lecture_2s\regression1a.log log type: text opened on: 22 Feb 2008, 03:29:09. cmdlog using " \Term 2\Lecture_2s\regression1a.do" (cmdlog \Term 2\Lecture_2s\regression1a.do

More information

Instructions for Using ABCalc James Alan Fox Northeastern University Updated: August 2009

Instructions for Using ABCalc James Alan Fox Northeastern University Updated: August 2009 Instructions for Using ABCalc James Alan Fox Northeastern University Updated: August 2009 Thank you for using ABCalc, a statistical calculator to accompany several introductory statistics texts published

More information

Regression Analysis and Linear Regression Models

Regression Analysis and Linear Regression Models Regression Analysis and Linear Regression Models University of Trento - FBK 2 March, 2015 (UNITN-FBK) Regression Analysis and Linear Regression Models 2 March, 2015 1 / 33 Relationship between numerical

More information

Generalized Least Squares (GLS) and Estimated Generalized Least Squares (EGLS)

Generalized Least Squares (GLS) and Estimated Generalized Least Squares (EGLS) Generalized Least Squares (GLS) and Estimated Generalized Least Squares (EGLS) Linear Model in matrix notation for the population Y = Xβ + Var ( ) = In GLS, the error covariance matrix is known In EGLS

More information

The Kenton Study. (Applied Linear Statistical Models, 5th ed., pp , Kutner et al., 2005) Page 1 of 5

The Kenton Study. (Applied Linear Statistical Models, 5th ed., pp , Kutner et al., 2005) Page 1 of 5 The Kenton Study The Kenton Food Company wished to test four different package designs for a new breakfast cereal. Twenty stores, with approximately equal sales volumes, were selected as the experimental

More information

piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 September 8, 2017

piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 September 8, 2017 piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 1 Heriot-Watt University, Edinburgh, UK Center for Energy Economics Research and Policy (CEERP) 2 The Hebrew University

More information

Evaluation Measures. Sebastian Pölsterl. April 28, Computer Aided Medical Procedures Technische Universität München

Evaluation Measures. Sebastian Pölsterl. April 28, Computer Aided Medical Procedures Technische Universität München Evaluation Measures Sebastian Pölsterl Computer Aided Medical Procedures Technische Universität München April 28, 2015 Outline 1 Classification 1. Confusion Matrix 2. Receiver operating characteristics

More information

STATISTICS FOR PSYCHOLOGISTS

STATISTICS FOR PSYCHOLOGISTS STATISTICS FOR PSYCHOLOGISTS SECTION: JAMOVI CHAPTER: USING THE SOFTWARE Section Abstract: This section provides step-by-step instructions on how to obtain basic statistical output using JAMOVI, both visually

More information

SAS/STAT 14.2 User s Guide. The SIMNORMAL Procedure

SAS/STAT 14.2 User s Guide. The SIMNORMAL Procedure SAS/STAT 14.2 User s Guide The SIMNORMAL Procedure This document is an individual chapter from SAS/STAT 14.2 User s Guide. The correct bibliographic citation for this manual is as follows: SAS Institute

More information

Resources for statistical assistance. Quantitative covariates and regression analysis. Methods for predicting continuous outcomes.

Resources for statistical assistance. Quantitative covariates and regression analysis. Methods for predicting continuous outcomes. Resources for statistical assistance Quantitative covariates and regression analysis Carolyn Taylor Applied Statistics and Data Science Group (ASDa) Department of Statistics, UBC January 24, 2017 Department

More information

Frequencies, Unequal Variance Weights, and Sampling Weights: Similarities and Differences in SAS

Frequencies, Unequal Variance Weights, and Sampling Weights: Similarities and Differences in SAS ABSTRACT Paper 1938-2018 Frequencies, Unequal Variance Weights, and Sampling Weights: Similarities and Differences in SAS Robert M. Lucas, Robert M. Lucas Consulting, Fort Collins, CO, USA There is confusion

More information

Multiple Regression White paper

Multiple Regression White paper +44 (0) 333 666 7366 Multiple Regression White paper A tool to determine the impact in analysing the effectiveness of advertising spend. Multiple Regression In order to establish if the advertising mechanisms

More information

Module 25.1: nag lin reg Regression Analysis. Contents

Module 25.1: nag lin reg Regression Analysis. Contents Correlation and Regression Analysis Module Contents Module 25.1: nag lin reg Regression Analysis nag lin reg contains procedures that perform a simple or multiple linear regression analysis. Contents Introduction...

More information

Introduction to SAS proc calis

Introduction to SAS proc calis Introduction to SAS proc calis /* path1.sas */ %include 'SenicRead.sas'; title2 'Path Analysis Example for 3 Observed Variables'; /************************************************************************

More information

Panel Data 4: Fixed Effects vs Random Effects Models

Panel Data 4: Fixed Effects vs Random Effects Models Panel Data 4: Fixed Effects vs Random Effects Models Richard Williams, University of Notre Dame, http://www3.nd.edu/~rwilliam/ Last revised April 4, 2017 These notes borrow very heavily, sometimes verbatim,

More information

Solution to Bonus Questions

Solution to Bonus Questions Solution to Bonus Questions Q2: (a) The histogram of 1000 sample means and sample variances are plotted below. Both histogram are symmetrically centered around the true lambda value 20. But the sample

More information

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian. Panel Data Analysis: Fixed Effects Models

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian. Panel Data Analysis: Fixed Effects Models SOCY776: Longitudinal Data Analysis Instructor: Natasha Sarkisian Panel Data Analysis: Fixed Effects Models Fixed effects models are similar to the first difference model we considered for two wave data

More information

Product Catalog. AcaStat. Software

Product Catalog. AcaStat. Software Product Catalog AcaStat Software AcaStat AcaStat is an inexpensive and easy-to-use data analysis tool. Easily create data files or import data from spreadsheets or delimited text files. Run crosstabulations,

More information

Lab 2: OLS regression

Lab 2: OLS regression Lab 2: OLS regression Andreas Beger February 2, 2009 1 Overview This lab covers basic OLS regression in Stata, including: multivariate OLS regression reporting coefficients with different confidence intervals

More information

STA431 Handout 9 Double Measurement Regression on the BMI Data

STA431 Handout 9 Double Measurement Regression on the BMI Data STA431 Handout 9 Double Measurement Regression on the BMI Data /********************** bmi5.sas **************************/ options linesize=79 pagesize = 500 noovp formdlim='-'; title 'BMI and Health:

More information

Handling missing values in Analysis

Handling missing values in Analysis Handling missing values in Analysis Before we analyze the data, which includes missing values, we should make sure that all the missing values have been coded as SAS missing values. There are many ways

More information

An introduction to SPSS

An introduction to SPSS An introduction to SPSS To open the SPSS software using U of Iowa Virtual Desktop... Go to https://virtualdesktop.uiowa.edu and choose SPSS 24. Contents NOTE: Save data files in a drive that is accessible

More information

Introduction to Hierarchical Linear Model. Hsueh-Sheng Wu CFDR Workshop Series January 30, 2017

Introduction to Hierarchical Linear Model. Hsueh-Sheng Wu CFDR Workshop Series January 30, 2017 Introduction to Hierarchical Linear Model Hsueh-Sheng Wu CFDR Workshop Series January 30, 2017 1 Outline What is Hierarchical Linear Model? Why do nested data create analytic problems? Graphic presentation

More information

Section 2.1: Intro to Simple Linear Regression & Least Squares

Section 2.1: Intro to Simple Linear Regression & Least Squares Section 2.1: Intro to Simple Linear Regression & Least Squares Jared S. Murray The University of Texas at Austin McCombs School of Business Suggested reading: OpenIntro Statistics, Chapter 7.1, 7.2 1 Regression:

More information

Stata Session 2. Tarjei Havnes. University of Oslo. Statistics Norway. ECON 4136, UiO, 2012

Stata Session 2. Tarjei Havnes. University of Oslo. Statistics Norway. ECON 4136, UiO, 2012 Stata Session 2 Tarjei Havnes 1 ESOP and Department of Economics University of Oslo 2 Research department Statistics Norway ECON 4136, UiO, 2012 Tarjei Havnes (University of Oslo) Stata Session 2 ECON

More information

Lab #13 - Resampling Methods Econ 224 October 23rd, 2018

Lab #13 - Resampling Methods Econ 224 October 23rd, 2018 Lab #13 - Resampling Methods Econ 224 October 23rd, 2018 Introduction In this lab you will work through Section 5.3 of ISL and record your code and results in an RMarkdown document. I have added section

More information

610 R12 Prof Colleen F. Moore Analysis of variance for Unbalanced Between Groups designs in R For Psychology 610 University of Wisconsin--Madison

610 R12 Prof Colleen F. Moore Analysis of variance for Unbalanced Between Groups designs in R For Psychology 610 University of Wisconsin--Madison 610 R12 Prof Colleen F. Moore Analysis of variance for Unbalanced Between Groups designs in R For Psychology 610 University of Wisconsin--Madison R is very touchy about unbalanced designs, partly because

More information

Subset Selection in Multiple Regression

Subset Selection in Multiple Regression Chapter 307 Subset Selection in Multiple Regression Introduction Multiple regression analysis is documented in Chapter 305 Multiple Regression, so that information will not be repeated here. Refer to that

More information

Stat 5100 Handout #11.a SAS: Variations on Ordinary Least Squares

Stat 5100 Handout #11.a SAS: Variations on Ordinary Least Squares Stat 5100 Handout #11.a SAS: Variations on Ordinary Least Squares Example 1: (Weighted Least Squares) A health researcher is interested in studying the relationship between diastolic blood pressure (bp)

More information

GRAPHING CALCULATOR REFERENCE BOOK

GRAPHING CALCULATOR REFERENCE BOOK John T. Baker Middle School GRAPHING CALCULATOR REFERENCE BOOK Name: Teacher: - 1 - To Graph an Equation: Graphing Linear Equations 1.) Press Y= and enter the equation into Y 1. 2.) To see the graph in

More information

For example, the system. 22 may be represented by the augmented matrix

For example, the system. 22 may be represented by the augmented matrix Matrix Solutions to Linear Systems A matrix is a rectangular array of elements. o An array is a systematic arrangement of numbers or symbols in rows and columns. Matrices (the plural of matrix) may be

More information

What is KNIME? workflows nodes standard data mining, data analysis data manipulation

What is KNIME? workflows nodes standard data mining, data analysis data manipulation KNIME TUTORIAL What is KNIME? KNIME = Konstanz Information Miner Developed at University of Konstanz in Germany Desktop version available free of charge (Open Source) Modular platform for building and

More information

Regression on the trees data with R

Regression on the trees data with R > trees Girth Height Volume 1 8.3 70 10.3 2 8.6 65 10.3 3 8.8 63 10.2 4 10.5 72 16.4 5 10.7 81 18.8 6 10.8 83 19.7 7 11.0 66 15.6 8 11.0 75 18.2 9 11.1 80 22.6 10 11.2 75 19.9 11 11.3 79 24.2 12 11.4 76

More information

Stat 302 Statistical Software and Its Applications SAS: Data I/O

Stat 302 Statistical Software and Its Applications SAS: Data I/O Stat 302 Statistical Software and Its Applications SAS: Data I/O Yen-Chi Chen Department of Statistics, University of Washington Autumn 2016 1 / 33 Getting Data Files Get the following data sets from the

More information

Introduction to Stata: An In-class Tutorial

Introduction to Stata: An In-class Tutorial Introduction to Stata: An I. The Basics - Stata is a command-driven statistical software program. In other words, you type in a command, and Stata executes it. You can use the drop-down menus to avoid

More information

Stat 401 B Lecture 26

Stat 401 B Lecture 26 Stat B Lecture 6 Forward Selection The Forward selection rocedure looks to add variables to the model. Once added, those variables stay in the model even if they become insignificant at a later ste. Backward

More information

Two-Stage Least Squares

Two-Stage Least Squares Chapter 316 Two-Stage Least Squares Introduction This procedure calculates the two-stage least squares (2SLS) estimate. This method is used fit models that include instrumental variables. 2SLS includes

More information

Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics

Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics Fritz Scholz Department of Statistics, University of Washington Winter Quarter 2015 February 19, 2015 2 Getting

More information

Online Supplementary Appendix for. Dziak, Nahum-Shani and Collins (2012), Multilevel Factorial Experiments for Developing Behavioral Interventions:

Online Supplementary Appendix for. Dziak, Nahum-Shani and Collins (2012), Multilevel Factorial Experiments for Developing Behavioral Interventions: Online Supplementary Appendix for Dziak, Nahum-Shani and Collins (2012), Multilevel Factorial Experiments for Developing Behavioral Interventions: Power, Sample Size, and Resource Considerations 1 Appendix

More information

Study Guide. Module 1. Key Terms

Study Guide. Module 1. Key Terms Study Guide Module 1 Key Terms general linear model dummy variable multiple regression model ANOVA model ANCOVA model confounding variable squared multiple correlation adjusted squared multiple correlation

More information

Data Analysis and Hypothesis Testing Using the Python ecosystem

Data Analysis and Hypothesis Testing Using the Python ecosystem ARISTOTLE UNIVERSITY OF THESSALONIKI Data Analysis and Hypothesis Testing Using the Python ecosystem t-test & ANOVAs Stavros Demetriadis Assc. Prof., School of Informatics, Aristotle University of Thessaloniki

More information

9.1 Random coefficients models Constructed data Consumer preference mapping of carrots... 10

9.1 Random coefficients models Constructed data Consumer preference mapping of carrots... 10 St@tmaster 02429/MIXED LINEAR MODELS PREPARED BY THE STATISTICS GROUPS AT IMM, DTU AND KU-LIFE Module 9: R 9.1 Random coefficients models...................... 1 9.1.1 Constructed data........................

More information

I. MODEL. Q3i: Check my . Q29s: I like to see films and TV programs from other countries. Q28e: I like to watch TV shows on a laptop/tablet/phone

I. MODEL. Q3i: Check my  . Q29s: I like to see films and TV programs from other countries. Q28e: I like to watch TV shows on a laptop/tablet/phone 1 Multiple Regression-FORCED-ENTRY HIERARCHICAL MODEL DORIS ACHEME COM 631/731, Spring 2017 Data: Film & TV Usage 2015 I. MODEL IV Block 1: Demographics Sex (female dummy):q30 Age: Q31 Income: Q34 Block

More information

A Step by Step Guide to Learning SAS

A Step by Step Guide to Learning SAS A Step by Step Guide to Learning SAS 1 Objective Familiarize yourselves with the SAS programming environment and language. Learn how to create and manipulate data sets in SAS and how to use existing data

More information