#LyX 2.0 created this file. For more info see http://www.lyx.org/ \lyxformat 413 \begin_document \begin_header \textclass sweavel-beamer \begin_preamble \usepackage{dcolumn} \usepackage{booktabs} % use 'handout' to produce handouts %\documentclass[handout]{beamer} \usepackage{wasysym} \usepackage{pgfpages} \newcommand{\vn}[1]{\mbox{{\it #1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}} \usepackage{graphicx} \usepackage{listings} \lstset{tabsize=2, breaklines=true,style=Rstyle,basicstyle=\small } \usetheme{Antibes} % or ... \setbeamercovered{transparent} % or whatever (possibly just delete it) %\mode %{ % \usetheme{KU} % \usecolortheme{dolphin} %dark blues %} % In document Latex options: \fvset{listparameters={\setlength{\topsep}{0em}}} \def\Sweavesize{\normalsize} \def\Rcolor{\color{black}} \def\Rbackground{\color[gray]{0.95}} \newcommand\makebeamertitle{\frame{\maketitle}}% \setbeamertemplate{frametitle continuation}[from second] \renewcommand\insertcontinuationtext{...} %\usepackage{handoutWithNotes} %\pgfpagesuselayout{3 on 1 with notes}[letterpaper, border shrink=5mm] \expandafter\def\expandafter\insertshorttitle\expandafter{% \insertshorttitle\hfill\insertframenumber\,/\,\inserttotalframenumber} \end_preamble \use_default_options false \begin_modules sweave \end_modules \maintain_unincluded_children false \language english \language_package default \inputencoding auto \fontencoding global \font_roman lmodern \font_sans lmss \font_typewriter lmtt \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default \output_sync 0 \bibtex_command default \index_command default \paperfontsize 10 \spacing single \use_hyperref false \papersize default \use_geometry true \use_amsmath 1 \use_esint 1 \use_mhchem 1 \use_mathdots 1 \cite_engine basic \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \use_refstyle 0 \branch R \selected 1 \filename_suffix 0 \color #faf0e6 \end_branch \branch effects \selected 1 \filename_suffix 0 \color #ffffff \end_branch \branch termplot \selected 1 \filename_suffix 0 \color #ffffff \end_branch \index Index \shortcut idx \color #008000 \end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \paragraph_indentation default \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false \end_header \begin_body \begin_layout Standard \begin_inset Branch R status open \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout dir.create("plots", showWarnings=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout % In document Latex options: \end_layout \begin_layout Plain Layout \backslash fvset{listparameters={ \backslash setlength{ \backslash topsep}{0em}}} \end_layout \begin_layout Plain Layout \backslash SweaveOpts{prefix.string=plots/t,split=T,ae=F,height=4,width=6} \end_layout \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash normalsize} \end_layout \begin_layout Plain Layout \backslash def \backslash Rcolor{ \backslash color{black}} \end_layout \begin_layout Plain Layout \backslash def \backslash Rbackground{ \backslash color[gray]{0.85}} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout options(device = pdf) \end_layout \begin_layout Plain Layout options(width=160, prompt=" ", continue=" ") \end_layout \begin_layout Plain Layout options(useFancyQuotes = FALSE) \end_layout \begin_layout Plain Layout #set.seed(12345) \end_layout \begin_layout Plain Layout op <- par() \end_layout \begin_layout Plain Layout pjmar <- c(5.1, 5.1, 1.5, 2.1) \end_layout \begin_layout Plain Layout #pjmar <- par("mar") \end_layout \begin_layout Plain Layout options(SweaveHooks=list(fig=function() par(mar=pjmar, ps=12))) \end_layout \begin_layout Plain Layout pdf.options(onefile=F,family="Times",pointsize=12) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Title Categorical Predictors 1 \begin_inset Argument status collapsed \begin_layout Plain Layout Categorical 1 \end_layout \end_inset \end_layout \begin_layout Author Paul E. Johnson \begin_inset Flex InstituteMark status open \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash and \end_layout \end_inset \begin_inset Flex InstituteMark status collapsed \begin_layout Plain Layout 2 \end_layout \end_inset \end_layout \begin_layout Institute \begin_inset Flex InstituteMark status collapsed \begin_layout Plain Layout 1 \end_layout \end_inset Department of Political Science \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash and \end_layout \end_inset \begin_inset Flex InstituteMark status collapsed \begin_layout Plain Layout 2 \end_layout \end_inset Center for Research Methods and Data Analysis, University of Kansas \begin_inset Argument status open \begin_layout Plain Layout K.U. \end_layout \end_inset \end_layout \begin_layout Date 2014 \begin_inset Argument status open \begin_layout Plain Layout 2014 \end_layout \end_inset \end_layout \begin_layout EndFrame \end_layout \begin_layout Standard \begin_inset Note Note status open \begin_layout Plain Layout The following causes the table of contents to be shown at the beginning of every subsection. Delete this, if you do not want it. \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash AtBeginSubsection[]{ \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \backslash frame{ \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \backslash frametitle{Outline} \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \backslash tableofcontents[currentsection,currentsubsection] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout } \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout } \end_layout \end_inset \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{Introduction} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset CommandInset toc LatexCommand tableofcontents \end_inset \end_layout \begin_layout Itemize Basics: Before I get too carried away \end_layout \begin_layout Itemize Categorical Coding: Which Dummy is Right for you? \end_layout \begin_layout Itemize Differences among approaches are Superficial \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Section Basics \end_layout \begin_layout Subsection Dichotomy \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Let's Talk About Sex} \end_layout \end_inset \end_layout \begin_layout ColumnsTopAligned \end_layout \begin_deeper \begin_layout Column 6cm \end_layout \begin_layout Itemize Sex is coded \begin_inset Quotes eld \end_inset M \begin_inset Quotes erd \end_inset for male or \begin_inset Quotes eld \end_inset F \begin_inset Quotes erd \end_inset for female \end_layout \begin_layout Itemize \begin_inset Quotes eld \end_inset manually \begin_inset Quotes erd \end_inset create two dummy variables, \begin_inset Quotes eld \end_inset femd \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset maled \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize These are numeric, 0 or 1 (or maybe -1 and 1). \end_layout \begin_layout Itemize In SAS (or Stata), one then fits a model using \begin_inset Quotes eld \end_inset femd \begin_inset Quotes erd \end_inset or \begin_inset Quotes eld \end_inset maled \begin_inset Quotes erd \end_inset as a predictor. \end_layout \begin_layout Column 6cm \end_layout \end_deeper \begin_layout ColumnsTopAligned \end_layout \begin_deeper \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout id \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout constant \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout sex \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout femd \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout maled \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout M \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 2 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout F \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 3 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout F \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 4 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout M \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \end_inset \end_layout \end_deeper \begin_layout ColumnsTopAligned \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{What will R do if...} \end_layout \end_inset \end_layout \begin_layout Itemize \begin_inset listings inline false status open \begin_layout Plain Layout lm (y ~ sex) \end_layout \end_inset fits \end_layout \begin_deeper \begin_layout Itemize (implicitly) asks for an intercept, plus \end_layout \begin_layout Itemize an \begin_inset Quotes eld \end_inset intercept shift \begin_inset Quotes erd \end_inset parameter for a contrast variable for males it calls \begin_inset Quotes eld \end_inset sexM \begin_inset Quotes erd \end_inset . \end_layout \begin_layout Itemize R automatically creates a \begin_inset Quotes eld \end_inset contrast \begin_inset Quotes erd \end_inset variable, a 0, 1 \begin_inset Quotes eld \end_inset dummy \begin_inset Quotes erd \end_inset variable for male \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Example: statusquo support in the 1988 Chile Data} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout library(car) \end_layout \begin_layout Plain Layout mod1 <- lm(statusquo ~ sex, data=Chile) \end_layout \begin_layout Plain Layout summary(mod1) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile20.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout <> \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout library(rockchalk) \end_layout \begin_layout Plain Layout outreg(mod1, tight=FALSE, showAIC=FALSE) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile22.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Sex Contrast Default and Interpretation} \end_layout \end_inset \end_layout \begin_layout Itemize R's design matrix that looks like this: \begin_inset Formula \begin{equation} X=\begin{array}{cc} constant & sexM\\ 1 & 1\\ 1 & 0\\ 1 & 0\\ & \vdots \end{array} \end{equation} \end_inset \end_layout \begin_layout Itemize Why \begin_inset Quotes eld \end_inset M \begin_inset Quotes erd \end_inset ? Female becomes \begin_inset Quotes eld \end_inset baseline \begin_inset Quotes erd \end_inset (in the intercept) because it is alphabetically first (can customize that) \end_layout \begin_layout Itemize Same effect as user-created \begin_inset Quotes eld \end_inset maled \begin_inset Quotes erd \end_inset variable. \end_layout \begin_layout Itemize fitted intercept represents the effect of \begin_inset Quotes eld \end_inset being human \begin_inset Quotes erd \end_inset (or \begin_inset Quotes eld \end_inset being in the data set \begin_inset Quotes erd \end_inset ) \end_layout \begin_layout Itemize \begin_inset Formula $\hat{b}_{1}sexM$ \end_inset ; the \begin_inset Quotes eld \end_inset difference \begin_inset Quotes erd \end_inset effect that distinguishes males from other humans \end_layout \begin_layout Itemize Model's predicted value is \begin_inset Formula $\widehat{statusquo_{i}}=\hat{b}_{0}+\hat{b}_{1}sexM$ \end_inset , so for Females predict \begin_inset Formula $\hat{b}_{0}$ \end_inset and for males predict \begin_inset Formula $\hat{b}_{0}+\hat{b}_{1}$ \end_inset . \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim,allowframebreaks] \end_layout \begin_layout Plain Layout \backslash frametitle{Regression Equivalent to a "t-test for means"} \end_layout \end_inset \end_layout \begin_layout Standard The \begin_inset Quotes eld \end_inset t test for means \begin_inset Quotes erd \end_inset calculates the averages within groups and calculates a t value for the difference. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout by(Chile$statusquo, Chile$sex, mean, na.rm = TRUE) \end_layout \begin_layout Plain Layout t.test(statusquo ~ sex, var.equal=TRUE, data=Chile) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard Note the Regression intercept and slope re-produce means as predicted values. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Subsection Multichotomy (Polychotomy?) \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Occupation in the wages data set} \end_layout \end_inset \end_layout \begin_layout Itemize As provided, wages has occupation coded as a numeric variable. \end_layout \begin_layout Itemize \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 2 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 3 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 4 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 5 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 6 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Management \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Sales \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Clerical \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Service \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Professional \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Other \end_layout \end_inset \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout library(rockchalk) \end_layout \begin_layout Plain Layout dat <- read.table("/home/pauljohn/ps/SVN-guides/stat/DataSets/wages/wages.txt", header=T, sep="") \end_layout \begin_layout Plain Layout colnames(dat) <- tolower(colnames(dat)) \end_layout \begin_layout Plain Layout dat$racef <- factor(dat$race, labels=c("Other", "Hispanic","White")) \end_layout \begin_layout Plain Layout dat$occupationf <- factor(dat$occupation, labels=c("Management", "Sales", "Clerical", "Service", "Professional", "Other")) \end_layout \begin_layout Plain Layout dat$marrf <- factor(dat$marr, levels=c("Unmarried","Married")) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{See Why it is Wrong to treat that as Numeric, Right?} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout mod1 <- lm(wage ~ occupation, data=dat) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(mod1, tight=F, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{Sinput} \end_layout \begin_layout Plain Layout mod1 <- lm(wage ~ occupation, data=dat) \end_layout \begin_layout Plain Layout \backslash end{Sinput} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-wages10B.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Interpret that Termplot} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout termplot(mod1, terms=c("occupation"), partial=T, se=T) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash includegraphics[width=10cm]{plots/t-wages10C} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Recode, Treat Occupation as A Categorical Variable} \end_layout \end_inset \end_layout \begin_layout Itemize Create a new \begin_inset Quotes eld \end_inset factor \begin_inset Quotes erd \end_inset variable occupationf, that assigns labels to the categories. \end_layout \begin_layout Itemize When there are 6 occupational categories, the usual approach creates 5 \begin_inset Quotes eld \end_inset dummy variables \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize In R, those 5 dummy variables are created automatically, called \begin_inset Quotes eld \end_inset treatment contrasts \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize \begin_inset Quotes eld \end_inset first \begin_inset Quotes erd \end_inset level of factor (or designated level) is excluded, and rest of levels are \begin_inset Quotes eld \end_inset dummied up \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{What is R Doing with "occupationf"?} \end_layout \end_inset \end_layout \begin_layout Itemize R's system of \begin_inset Quotes eld \end_inset factor \begin_inset Quotes erd \end_inset variables is intended to make this \begin_inset Quotes eld \end_inset automatic \begin_inset Quotes erd \end_inset . Regression procedures create \begin_inset Quotes eld \end_inset contrasts \begin_inset Quotes erd \end_inset \begin_inset Quotes eld \end_inset on the fly \begin_inset Quotes erd \end_inset . \end_layout \begin_layout Itemize The factor \begin_inset Quotes eld \end_inset occupationf \begin_inset Quotes erd \end_inset is converted thus \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout contrasts(dat$occupationf) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash scriptsize} \end_layout \begin_layout Plain Layout \backslash input{plots/t-wages25A} \end_layout \end_inset \end_layout \begin_layout Itemize So the fitted model for 6 categories is \begin_inset Formula \begin{equation} \widehat{wages}_{i}=\hat{b}_{0}+\hat{b}_{1}Sales_{i}+\hat{b}_{2}Clerical_{i}+\hat{b}_{3}Service_{i}+\hat{b}_{4}Professional_{_{i}}+\hat{b}_{5}Other_{i} \end{equation} \end_inset \end_layout \begin_layout Itemize Maybe I should make this easier to remember \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \widehat{wages}_{i} & = & \hat{b}_{0}+\hat{b}_{Sales}Sales_{i}+\hat{b}_{Clerical}Clerical_{i} \end{eqnarray*} \end_inset \begin_inset Formula \[ +\hat{b}_{Service}Service_{i}+\hat{b}_{Prof}Professional_{_{i}}+\hat{b}_{Other}Other_{i} \] \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{Fitted Regression Model with Categorical Predictor} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout mod2 <- lm(wage ~ occupationf, data=dat) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(mod2, tight=F, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-wages20B.tex} \end_layout \end_inset \end_layout \begin_layout Standard Management is the \begin_inset Quotes eld \end_inset baseline \begin_inset Quotes erd \end_inset . Calculate Predicted Values: \end_layout \begin_layout Standard \begin_inset Formula $\hat{y}_{Management}=\hat{b}_{0}=12.704$ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Formula $\hat{y}_{Sales}=\hat{b}_{0}+\hat{b}_{Sales}=12.704-5.11=7.59$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\hat{y}_{Service}=12.704-6.167=6.537$ \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Interpret that Termplot} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout termplot(mod2, terms=c("occupationf"), partial=T, se=T) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash includegraphics[width=10cm]{plots/t-wages20C} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim, allowframebreaks] \end_layout \begin_layout Plain Layout \backslash frametitle{Contrasts: } \end_layout \end_inset \end_layout \begin_layout Itemize The default treats the \begin_inset Quotes eld \end_inset lowest \begin_inset Quotes erd \end_inset score--the first \begin_inset Quotes eld \end_inset level \begin_inset Quotes erd \end_inset --as a \begin_inset Quotes eld \end_inset baseline \begin_inset Quotes erd \end_inset category. \end_layout \begin_deeper \begin_layout Itemize Meaning: There is no \begin_inset Quotes eld \end_inset dummy \begin_inset Quotes erd \end_inset variable for that. It is \begin_inset Quotes eld \end_inset in \begin_inset Quotes erd \end_inset the intercept. \end_layout \end_deeper \begin_layout Itemize All other categories are compared against that one. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout levels(dat$occupationf) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim, allowframebreaks] \end_layout \begin_layout Plain Layout \backslash frametitle{Does the occupationf "Belong" in the Model} \end_layout \end_inset \end_layout \begin_layout Itemize Obviously Yes: \begin_inset Quotes eld \end_inset occupationf \begin_inset Quotes erd \end_inset makes a difference--some categories matter \end_layout \begin_layout Itemize Formally test with F test, where null is that none of the differences are non-zero. \begin_inset Formula \begin{equation} H_{0}:\hat{b}_{Sales\,}=\hat{b}_{Clerical}=\hat{b}_{Service}=\hat{b}_{Professional}=\hat{b}_{Other}=0 \end{equation} \end_inset \end_layout \begin_layout Itemize Compare the fitted model against a model that has only the intercept \end_layout \begin_layout Itemize That's the F test that is reported with most regression models. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout summary(mod2) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash scriptsize} \end_layout \begin_layout Plain Layout \backslash input{plots/t-wages25C} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Does the occupationf "Belong" in the Model} \end_layout \end_inset \end_layout \begin_layout Itemize R's anova function provides a conventional \begin_inset Quotes eld \end_inset analysis of variance table \begin_inset Quotes erd \end_inset . \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout anova(mod2, test="F") \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash scriptsize} \end_layout \begin_layout Plain Layout \backslash input{plots/t-wages25D} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Subsection Simplify the Coding \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{But Do We Really Need All Those Parameters?} \end_layout \end_inset \end_layout \begin_layout Itemize Glance at the estimated slope coefficients. \end_layout \begin_layout Itemize I suspect the middle 3 categories have \begin_inset Quotes eld \end_inset about the same \begin_inset Quotes erd \end_inset effect \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Hypothesis Testing Procedure} \end_layout \end_inset \end_layout \begin_layout Itemize F test \end_layout \begin_layout Itemize \begin_inset Formula $H_{0}:$ \end_inset \begin_inset Formula $b_{sales}=b_{service}=b_{clerical}$ \end_inset \end_layout \begin_layout Itemize Estimate \begin_inset Quotes eld \end_inset full \begin_inset Quotes erd \end_inset or \begin_inset Quotes eld \end_inset unrestricted \begin_inset Quotes erd \end_inset model with all of the category dummies included \end_layout \begin_layout Itemize Estimate \begin_inset Quotes eld \end_inset partial \begin_inset Quotes erd \end_inset or \begin_inset Quotes eld \end_inset restricted \begin_inset Quotes erd \end_inset model with restriction imposed. \end_layout \begin_layout Itemize Compare the fit, F test indicates whether estimates \begin_inset Formula $\hat{b}_{sales},$ \end_inset \begin_inset Formula $\hat{b}_{service}$ \end_inset , \begin_inset Formula $\hat{b}_{clerical},$ \end_inset are \begin_inset Quotes eld \end_inset statistically significantly different \begin_inset Quotes erd \end_inset from one another. \end_layout \begin_layout Itemize Slang: is \begin_inset Quotes eld \end_inset predictive power \begin_inset Quotes erd \end_inset lost by restriction? \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim, allowframebreaks] \end_layout \begin_layout Plain Layout \backslash frametitle{Test $ \backslash hat{b}_{Sales}= \backslash hat{b}_{Clerical}= \backslash hat{b}_{Service}$} \end_layout \end_inset \end_layout \begin_layout Itemize Testing the restriction that the wage effect for three groups is achieved by recoding occupationf variable \end_layout \begin_layout Itemize All \begin_inset Quotes eld \end_inset Sales \begin_inset Quotes erd \end_inset \begin_inset Quotes eld \end_inset Clerical \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset Service \begin_inset Quotes erd \end_inset observations re-coded 1 on new category \begin_inset Quotes eld \end_inset sales/clerical/service \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout occlev <- levels(dat$occupationf) \end_layout \begin_layout Plain Layout dat$occupationf2 <- dat$occupationf \end_layout \begin_layout Plain Layout dat$occupationf2[dat$occupationf2 %in% occlev[2:4]] <- occlev[2] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout levels(dat$occupationf2)[2] <- "sales/clerk/serv" \end_layout \begin_layout Plain Layout with(dat, table(occupationf2, occupationf)) \end_layout \begin_layout Plain Layout mod3 <- lm(wage ~ occupationf2, data=dat) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(mod3, tight=F, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-wages30B.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{And the F test result is (drumroll please)} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout anova(mod3, mod2, test="F") \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-wages30D.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{What if I merge "Management" and "Professional"?} \end_layout \end_inset \end_layout \begin_layout Itemize Appears to me \begin_inset Formula $\hat{y}_{Professional}$ \end_inset and \begin_inset Formula $\hat{y}_{Management}$ \end_inset are not all that different. \end_layout \begin_layout Itemize Suppose \begin_inset Formula $H_{o}:$ \end_inset \begin_inset Formula $b_{Professional}=0$ \end_inset and \begin_inset Formula $b_{sales}=b_{service}=b_{clerical}$ \end_inset \end_layout \begin_layout Itemize Then we create an even simpler variable, which leads to 2 \begin_inset Quotes eld \end_inset dummy \begin_inset Quotes erd \end_inset variables \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout dat$occupationf2[dat$occupationf2 %in% occlev[5]] <- occlev[1] \end_layout \begin_layout Plain Layout levels(dat$occupationf2)[1] <- "manag/prof" \end_layout \begin_layout Plain Layout dat$occupationf2 <- dat$occupationf2[, drop=T] \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout contrasts(dat$occupationf2) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \begin_inset ERT status open \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash scriptsize} \end_layout \begin_layout Plain Layout \backslash input{plots/t-wages40A} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{And the Regression on that Simpler Set of Contrasts is} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout mod4 <- lm(wage ~ occupationf2, data=dat) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(mod4, tight=F, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-wages40C.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{And The F Test says} \end_layout \end_inset \end_layout \begin_layout Itemize Compare the \begin_inset Quotes eld \end_inset full \begin_inset Quotes erd \end_inset fitted model with all 5 category differences estimated \end_layout \begin_layout Itemize With the restricted model \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout anova( mod4, mod2, test="F") \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-wages40D.tex} \end_layout \end_inset \end_layout \begin_layout Standard Conclusion: Does not appear the model with 3 categories (intercept + 2 group contrasts) has a worse statistical fit. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Section Coding Schemes \end_layout \begin_layout Subsection G-1 is Over-rated \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{What To Do with a G-Category Nominal Variable?} \end_layout \end_inset \end_layout \begin_layout Itemize If there are G categories, \end_layout \begin_layout Itemize Texts usually say \begin_inset Quotes eld \end_inset regression can provide parameter estimates for G-1 categories \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize Strinctly Speaking, that's wrong. \end_layout \begin_deeper \begin_layout Itemize It is only true if you include an Intercept in your regression \end_layout \begin_layout Itemize Drop the intercept, you can have G category estimates! \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{Lets Talk About Sex (again!)} \end_layout \end_inset \end_layout \begin_layout Itemize Recall, the data has a categorical \begin_inset Quotes eld \end_inset sex \begin_inset Quotes erd \end_inset (M or F) and we can create \begin_inset Quotes eld \end_inset dummy \begin_inset Quotes erd \end_inset variables for females and males. \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout id \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout constant \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout sex \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout femd \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout maled \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout M \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 2 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout F \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 3 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout F \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 4 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout M \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \end_inset \end_layout \begin_layout Itemize You agree, don't you, that: \end_layout \begin_deeper \begin_layout Itemize We get essentially the same model if we fit a dummy variable for \begin_inset Quotes eld \end_inset female \begin_inset Quotes erd \end_inset or for \begin_inset Quotes eld \end_inset male \begin_inset Quotes erd \end_inset , right? \end_layout \begin_layout Itemize \begin_inset Formula $\hat{y}_{i}=\hat{b}_{0}+\hat{b}_{1}\cdot femd_{i}$ \end_inset treats \begin_inset Quotes eld \end_inset male \begin_inset Quotes erd \end_inset as baseline and \begin_inset Formula $\hat{b}_{1}$ \end_inset is the difference for females \end_layout \begin_layout Itemize \begin_inset Formula $\hat{y}_{i}=\hat{b}_{0}+\hat{b}_{1}\cdot maled_{i}$ \end_inset treats \begin_inset Quotes eld \end_inset female \begin_inset Quotes erd \end_inset as baseline and \begin_inset Formula $\hat{b}_{1}$ \end_inset is the difference for males \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Subsection You Want G Parameters? You Got It! \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{Drop the Intercept? Intriguing!} \end_layout \end_inset \end_layout \begin_layout Itemize Drop the intercept? G categories -> G parameter estimates \end_layout \begin_layout Itemize lm(y ~ -1 + sex) : fits no intercept, estimates parameters for both males and females \begin_inset Formula \begin{equation} \begin{array}{cc} sexF & sexM\\ 0 & 1\\ 1 & 0 \end{array} \end{equation} \end_inset \end_layout \begin_layout Itemize And that is \begin_inset Quotes eld \end_inset essentially the same model \begin_inset Quotes erd \end_inset as either of the others. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Problem comes back to Multicollinearity} \end_layout \end_inset \end_layout \begin_layout ColumnsTopAligned \end_layout \begin_deeper \begin_layout Column 6cm \end_layout \begin_layout Itemize See why you can't estimate this: \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout lm(y~femd+maled) \end_layout \end_inset \end_layout \begin_layout Itemize R automatically inserts an \begin_inset Quotes eld \end_inset intercept \begin_inset Quotes erd \end_inset coefficient for you, so this is really \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout lm(y~1+femd+maled) \end_layout \end_inset \end_layout \begin_layout Itemize Leading to the design matrix on right: perfect collinearity between constant, femd and maled \end_layout \begin_layout Column 6cm \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout constant \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout femd \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout maled \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \end_inset \end_layout \end_deeper \begin_layout Itemize Your options: \end_layout \begin_deeper \begin_layout Itemize include a constant and either femd or maled \end_layout \begin_layout Itemize remove the constant and estimate femd and maled \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Better Check that with the Chile Data} \end_layout \end_inset \end_layout \begin_layout Itemize Traditional model, sexM \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout chile1M <- lm(statusquo ~ sex, data=Chile) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile30M} \end_layout \end_inset \end_layout \begin_layout Itemize Traditional model, sexF \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout Chile$sex <- relevel(Chile$sex, ref="M") \end_layout \begin_layout Plain Layout chile1F <- lm(statusquo ~ sex, data=Chile) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile30F} \end_layout \end_inset \end_layout \begin_layout Itemize No Intercept Model \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout chile1NI <- lm(statusquo ~ -1 + sex, data=Chile) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile30NI.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout <> \end_layout \begin_layout Plain Layout <> \end_layout \begin_layout Plain Layout <> \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{3 Fits Side By Side} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(list(chile1M, chile1F, chile1NI), modelLabels=c("M","F","No Int."), tight=TRUE, showAIC=FALSE) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile32.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Vital: The Predicted Values Are IDENTICAL!} \end_layout \end_inset \end_layout \begin_layout ColumnsTopAligned \end_layout \begin_deeper \begin_layout Column 6cm \end_layout \end_deeper \begin_layout ColumnsTopAligned \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout termplot(chile1F, partial.resid=TRUE, se=TRUE, ylabs="Statusquo Support") \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \begin_inset listings inline false status open \begin_layout Plain Layout chile1F <- lm(statusquo ~ sex, data=Chile) \end_layout \end_inset \end_layout \begin_layout ColumnsTopAligned \begin_inset ERT status open \begin_layout Plain Layout \backslash includegraphics[width=5cm]{plots/t-chile40} \end_layout \end_inset \end_layout \begin_deeper \begin_layout Column 6cm \end_layout \end_deeper \begin_layout ColumnsTopAligned \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout termplot(chile1NI, partial.resid=TRUE, se=TRUE, ylabs=c("Statusquo Support")) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \begin_inset listings inline false status open \begin_layout Plain Layout chile1NI <- lm(statusquo ~ -1 + sex, data=Chile) \end_layout \end_inset \end_layout \begin_layout ColumnsTopAligned \begin_inset ERT status open \begin_layout Plain Layout \backslash includegraphics[width=5cm]{plots/t-chile45} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{I mean Predictions are Completely IDENTICAL! Check the first few cases} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout head(predict(chile1F)) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile50} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout head(predict(chile1NI)) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile51} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Subsection Same True With G Categories \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{So, if a Categorical IV has 5 "levels" (as R would call them)} \end_layout \end_inset \end_layout \begin_layout Itemize We can estimate 4 parameters for levels and 1 for intercept \end_layout \begin_layout Itemize Or we can suppress intercept and estimate 5 parameters for 5 levels \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Treatment Contrasts=="dummy" codes} \end_layout \end_inset \end_layout \begin_layout Itemize Colloquial: Dummy Variable Coding \end_layout \begin_layout Itemize R calls this \begin_inset Quotes eld \end_inset treatment contrasts \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout id \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Religion \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Cath \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Prot \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Musl \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Hindu \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Other \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Cath \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 2 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Prot \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 3 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Musl \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 4 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Hindu \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 5 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Other \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 6 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Regression with Treatment Contrasts} \end_layout \end_inset \end_layout \begin_layout Itemize \begin_inset Formula $\hat{y}_{i}\sim\hat{b}_{0}+\hat{b}_{1}Rel.Prot_{i}+\hat{b}_{2}Rel.Musl_{i}+\hat{b}_{3}Rel.Hindu_{i}+\hat{b}_{4}Rel.Other_{i}$ \end_inset \end_layout \begin_layout Itemize \begin_inset Quotes eld \end_inset Catholic \begin_inset Quotes erd \end_inset is \begin_inset Quotes eld \end_inset left out? \begin_inset Quotes erd \end_inset Not really \end_layout \begin_layout Itemize Predicted value for members of \end_layout \begin_deeper \begin_layout Itemize Catholic is \begin_inset Formula $\hat{b}_{0}$ \end_inset \end_layout \begin_layout Itemize Protestant is \begin_inset Formula $\hat{b}_{0}+\hat{b}_{1}$ \end_inset \end_layout \begin_layout Itemize Muslim is \begin_inset Formula $\hat{b}_{0}+\hat{b}_{2}$ \end_inset \end_layout \begin_layout Itemize Hindu is \begin_inset Formula $\hat{b}_{0}+\hat{b}_{3}$ \end_inset \end_layout \begin_layout Itemize Other is \begin_inset Formula $\hat{b}_{0}+\hat{b}_{4}$ \end_inset \end_layout \end_deeper \begin_layout Itemize Interpret individual coefficients \end_layout \begin_deeper \begin_layout Itemize \begin_inset Formula $\hat{b}_{1}$ \end_inset : difference in predicted value for Protestant (as opposed to Catholic). \end_layout \begin_layout Itemize \begin_inset Formula $\hat{b}_{2}$ \end_inset : difference in predicted value for Muslim (as compared against Catholic) \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Any Group Can Serve as the Baseline} \end_layout \end_inset \end_layout \begin_layout Itemize Can make \begin_inset Quotes eld \end_inset Hindu \begin_inset Quotes erd \end_inset the baseline group. \end_layout \begin_layout Itemize All estimates treat Hindu as \begin_inset Quotes eld \end_inset baseline \begin_inset Quotes erd \end_inset and other estimates are differences in prediction against Hindu category \end_layout \begin_layout Itemize Model predictions and fit indices are still IDENTICAL to other \begin_inset Quotes eld \end_inset Catholic baseline \begin_inset Quotes erd \end_inset model. \end_layout \begin_layout Itemize If there are no other predictors in the model, the \begin_inset Formula $\hat{b}_{j}'s$ \end_inset are simply related to the observed group means (since predicted value is \begin_inset Quotes eld \end_inset mean \begin_inset Quotes erd \end_inset of \begin_inset Formula $y$ \end_inset for category members). \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Remember $ \backslash hat{y}$ is the same, no matter how you code these Predictor Contrasts} \end_layout \end_inset \end_layout \begin_layout Itemize Changing \begin_inset Quotes eld \end_inset dummy codes \begin_inset Quotes erd \end_inset or \begin_inset Quotes eld \end_inset baseline group \begin_inset Quotes erd \end_inset alters the \begin_inset Formula $\hat{b}$ \end_inset estimates \end_layout \begin_layout Itemize It does not alter the essential meaning of the model \end_layout \begin_layout Itemize Like saying \begin_inset Quotes eld \end_inset I am average in height \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset my height is the average plus 0 \begin_inset Quotes erd \end_inset or \begin_inset Quotes eld \end_inset my height is 36 inches plus one-half of the average \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Section Effects Coding \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Effects Coding (Unweighted)} \end_layout \end_inset \end_layout \begin_layout Itemize Terminology is \begin_inset Quotes eld \end_inset new to me \begin_inset Quotes erd \end_inset in Cohen, et al. \end_layout \begin_layout Itemize Re-code the religion variable like so (for \begin_inset Quotes eld \end_inset omitted \begin_inset Quotes erd \end_inset category, put -1 all the way across) \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout id \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Religion \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Cath \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Prot \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Musl \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Hindu \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Rel.Other \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Cath \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 2 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Prot \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 3 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Musl \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 4 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Hindu \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 5 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Other \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 6 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \end_inset \end_layout \begin_layout Itemize Called \begin_inset Quotes eld \end_inset sum-to-zero \begin_inset Quotes erd \end_inset contrasts in other contexts. \end_layout \begin_layout Itemize We will fit a regression that does not include \emph on Rel.Cath \end_layout \begin_deeper \begin_layout Standard \begin_inset Formula $\hat{y}_{i}\sim\hat{b}_{0}+\hat{b}_{1}Rel.Prot_{i}+\hat{b}_{2}Rel.Musl_{i}+\hat{b}_{3}Rel.Hindu_{i}+\hat{b}_{4}Rel.Other_{i}$ \end_inset \end_layout \end_deeper \begin_layout Itemize Still get \begin_inset Formula $\hat{b}$ \end_inset 's as comparisons, but now comparing against a different baseline. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Design Matrix} \end_layout \end_inset \end_layout \begin_layout ColumnsTopAligned \end_layout \begin_deeper \begin_layout Column 4cm \end_layout \end_deeper \begin_layout ColumnsTopAligned The \begin_inset Quotes eld \end_inset design matrix \begin_inset Quotes erd \end_inset : \end_layout \begin_layout ColumnsTopAligned \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout Const \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Cath \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout P \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout M \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout H \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout Oth \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout -1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 0 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout 1 \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\vdots$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset \end_inset \end_layout \begin_layout ColumnsTopAligned But \begin_inset Quotes eld \end_inset Cath \begin_inset Quotes erd \end_inset is omitted from the fitted report \end_layout \begin_deeper \begin_layout Column 6cm \end_layout \begin_layout Itemize Every \begin_inset Quotes eld \end_inset row \begin_inset Quotes erd \end_inset gets \end_layout \begin_deeper \begin_layout Itemize a \begin_inset Formula $1$ \end_inset for its \begin_inset Quotes eld \end_inset own \begin_inset Quotes erd \end_inset group \end_layout \begin_layout Itemize Except Catholics, who get \begin_inset Formula $-1$ \end_inset \end_layout \end_deeper \begin_layout Itemize The \begin_inset Formula $-1$ \end_inset basically \begin_inset Quotes eld \end_inset pushes \begin_inset Quotes erd \end_inset the estimated intercept \end_layout \begin_layout Itemize The other coefficients adjust accordingly to produce same predicted values. \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame} \end_layout \begin_layout Plain Layout \backslash frametitle{Where does the Intercept get pushed to?} \end_layout \end_inset \end_layout \begin_layout Itemize Answer: Intercept=mean of group means on \begin_inset Formula $y$ \end_inset \begin_inset Formula \begin{equation} \hat{b}_{0}=\frac{1}{5}\{\bar{Y}_{1}+\bar{Y}_{2}+\bar{Y}_{3}+\bar{Y}_{4}+\bar{Y}_{5}\} \end{equation} \end_inset \end_layout \begin_layout Itemize Called \begin_inset Quotes eld \end_inset unweighted effects coding \begin_inset Quotes erd \end_inset because the means of the groups are averaged, no matter how many observations there are in each group. \end_layout \begin_layout Itemize In order to believe that, I had to run some examples. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Chile Regions: First get the means} \end_layout \end_inset \end_layout \begin_layout Itemize The mean values of \begin_inset Quotes eld \end_inset statusquo \begin_inset Quotes erd \end_inset for the regions are \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout library(car) \end_layout \begin_layout Plain Layout agg1 <- aggregate(Chile$statusquo, by=list(region=Chile$region), mean, na.rm=T) \end_layout \begin_layout Plain Layout agg1 \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile110.tex} \end_layout \end_inset \end_layout \begin_layout Itemize Now calculate the \begin_inset Quotes eld \end_inset mean of the means \begin_inset Quotes erd \end_inset (no weights) \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout (munweighted <- mean(agg1$x)) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile145.tex} \end_layout \end_inset \end_layout \begin_layout Standard 0.076 is a \begin_inset Quotes eld \end_inset magic number \begin_inset Quotes erd \end_inset . Watch out for it later \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Suppress the Intercept: Estimate 5 Params for 5 Regions} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout modr1 <- lm( statusquo ~ -1 + region, data=Chile) \end_layout \begin_layout Plain Layout outreg(modr1, tight=FALSE, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile120.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Include the Intercept, Estimate (default) Treatment Contrasts} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout modr2 <- lm( statusquo ~ region, data=Chile, x=T, y=T) \end_layout \begin_layout Plain Layout outreg(modr2, tight=FALSE, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile130.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Those Default Contrasts Were } \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash scriptsize} \end_layout \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout contrasts(Chile$region) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile135A.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Ask R to use "sum-to-zero" contrasts (aka Unweighted Effects)} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash def \backslash Sweavesize{ \backslash scriptsize} \end_layout \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout options(contrasts=c("contr.sum", "contr.poly")) \end_layout \begin_layout Plain Layout contrasts(Chile$region) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile135B.tex} \end_layout \end_inset \end_layout \begin_layout Itemize Note, the default makes the \begin_inset Quotes eld \end_inset last \begin_inset Quotes erd \end_inset category, SA, the reference category. Will have to fix that later. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Fitted model with Effects Contrasts} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout modr3 <- lm( statusquo ~ region, data=Chile) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(modr3, tight=FALSE, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile140B.tex} \end_layout \end_inset \end_layout \begin_layout Itemize Unfortunately, we lose the region labels here, but they are 1=C, 2=M, 3=N, 4=S \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{I Had Trouble figuring this Out} \end_layout \end_inset \end_layout \begin_layout Itemize Some patience required :) \end_layout \begin_layout Itemize Note the Effects Coding intercept is 0.076, same as \begin_inset Quotes eld \end_inset mean of category means \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout #agg1 <- aggregate(Chile$statusquo, by=list(region=Chile$region), mean, na.rm=T) \end_layout \begin_layout Plain Layout agg1 \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile142.tex} \end_layout \end_inset \end_layout \begin_layout Itemize Calculate the difference between the observed means and 0.076 \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout agg1$diff <- agg1$x - munweighted \end_layout \begin_layout Plain Layout agg1 \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile147.tex} \end_layout \end_inset \end_layout \begin_layout Standard Note those differences exactly reproduce the \begin_inset Formula $\hat{b}$ \end_inset estimates from the unweighted effects model. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim, allowframebreaks] \end_layout \begin_layout Plain Layout \backslash frametitle{I wish C were the Omitted Category} \end_layout \end_inset \end_layout \begin_layout Itemize Create a new factor \begin_inset Quotes eld \end_inset region2 \begin_inset Quotes erd \end_inset in which levels are ordered (M, N, S, SA, C) \end_layout \begin_layout Itemize That forces values for cases in C to -1 for all contrasts \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout Chile$region2 <- factor(Chile$region, levels=c("M","N","S","SA","C")) \end_layout \begin_layout Plain Layout modr4 <- lm( statusquo ~ region2, data=Chile) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout contrasts(Chile$region2) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile140D} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Re-fit with "C" as the reference} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(modr4, tight=FALSE, showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile141D.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Interpretation benefit to the $ \backslash hat{b}$'s} \end_layout \end_inset \end_layout \begin_layout Itemize One can scan down the parameter estimates to see if one category is above the unweighted mean \end_layout \begin_layout Itemize Unclear to me why one would want to do that, but one can, if one wants to \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{But they are all Fundamentally the same} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Plain Layout \begin_inset Box Frameless position "t" hor_pos "c" has_inner_box 1 inner_pos "t" use_parbox 0 use_makebox 0 width "3.5cm" special "none" height "1in" height_special "totalheight" status open \begin_layout Plain Layout No Intercept \end_layout \begin_layout Plain Layout \begin_inset ERT status open \begin_layout Plain Layout \backslash small \end_layout \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(modr1, tight=T,showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Box Frameless position "t" hor_pos "c" has_inner_box 1 inner_pos "t" use_parbox 0 use_makebox 0 width "3.5cm" special "none" height "1in" height_special "totalheight" status open \begin_layout Plain Layout Treatment \end_layout \begin_layout Plain Layout \begin_inset ERT status open \begin_layout Plain Layout \backslash small \end_layout \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(modr2, tight=T,showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Plain Layout \begin_inset Box Frameless position "t" hor_pos "c" has_inner_box 1 inner_pos "t" use_parbox 0 use_makebox 0 width "3.5cm" special "none" height "1in" height_special "totalheight" status open \begin_layout Plain Layout Effects \end_layout \begin_layout Plain Layout \begin_inset ERT status open \begin_layout Plain Layout \backslash small \end_layout \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout outreg(modr4, tight=T,showAIC=F) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout pmr1 <- aggregate(predict(modr1), by=list(region=modr1$model$region), mean) \end_layout \begin_layout Plain Layout pmr2 <- aggregate(predict(modr2), by=list(region=modr2$model$region), mean) \end_layout \begin_layout Plain Layout pmr3 <- aggregate(predict(modr3), by=list(region=modr3$model$region), mean) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Predicted Values for all Rows are Identical. Same, Equivalent, Interchangeable} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout dat <-data.frame(pmr1,pmr2,pmr3) \end_layout \begin_layout Plain Layout dat <- dat[ ,c(1,2,4,6)] \end_layout \begin_layout Plain Layout colnames(dat) <- c("region", "NoInt", "Treatment", "Effects") \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Itemize Note predicted values for all regions are same \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout dat \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile167.6.tex} \end_layout \end_inset \end_layout \begin_layout Itemize R's \begin_inset Quotes eld \end_inset all.equal \begin_inset Quotes erd \end_inset verifies that the predictions for each row in data are same. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout <>= \end_layout \begin_layout Plain Layout all.equal(predict(modr1), predict(modr2), predict(modr3)) \end_layout \begin_layout Plain Layout @ \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash input{plots/t-chile169.tex} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{The Standard Errors of the $ \backslash hat{b}$ Only Appear to Differ} \end_layout \end_inset \end_layout \begin_layout Itemize The standard errors are different, but \end_layout \begin_layout Itemize That's only because they are estimating different things! \end_layout \begin_layout Itemize \begin_inset Formula $Std.Err.(\hat{b})$ \end_inset varies because each model reports an estimate of a different value \end_layout \begin_layout Itemize The No Intercept model estimates a \begin_inset Quotes eld \end_inset total effect \begin_inset Quotes erd \end_inset value for each region \end_layout \begin_layout Itemize The Treatment Contrast model estimates \end_layout \begin_deeper \begin_layout Itemize one \begin_inset Quotes eld \end_inset total effect \begin_inset Quotes erd \end_inset for baseline \end_layout \begin_layout Itemize difference for each region against baseline \end_layout \end_deeper \begin_layout Itemize Effects Contrasts estimate \end_layout \begin_deeper \begin_layout Itemize one unweighted mean \end_layout \begin_layout Itemize differences for each region against that \end_layout \end_deeper \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{Consider Region S} \end_layout \end_inset \end_layout \begin_layout Itemize No Intercept model \begin_inset Formula $\hat{b}_{S}=0.165$ \end_inset , \begin_inset Formula $Std.Err(\hat{b}_{S})=0.037$ \end_inset \end_layout \begin_layout Itemize Treatment Contrasts, \begin_inset Formula $\hat{b}_{S}=0.195$ \end_inset , \begin_inset Formula $Std.Err(\hat{b}_{s})=0.055$ \end_inset \end_layout \begin_layout Itemize Effects Contrasts, \begin_inset Formula $\hat{b}_{S}=0.089$ \end_inset , \begin_inset Formula $Std.Err.(\hat{b}_{S})=0.039$ \end_inset \end_layout \begin_layout Itemize From Treatment, can re-construct estimate for \begin_inset Quotes eld \end_inset total S region effect \begin_inset Quotes erd \end_inset \begin_inset Formula \begin{equation} \hat{b}_{0}+\hat{b}_{S}\, with\, Std.Err.(\sqrt{Var(\hat{b}_{0})+Var(\hat{b}_{S})+2Cov(\hat{b}_{0},\hat{b}_{S})}) \end{equation} \end_inset \end_layout \begin_deeper \begin_layout Itemize Inserting values from the Covariance of the \begin_inset Formula $\hat{b}$ \end_inset from Treatment gives \begin_inset Formula $0.037$ \end_inset \end_layout \end_deeper \begin_layout Itemize Do same with Effects Contrasts, get standard error of \begin_inset Formula $0.037$ \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{My "Take Away" Message} \end_layout \end_inset \end_layout \begin_layout Itemize Regression is a \begin_inset Quotes eld \end_inset vehicle \begin_inset Quotes erd \end_inset with which to calculate predicted values \end_layout \begin_layout Itemize Many equivalent \begin_inset Quotes eld \end_inset design matrices \begin_inset Quotes erd \end_inset can be used to calculate same predicted values \end_layout \begin_layout Itemize Comfort with one method or its estimates b's drives the selection of one's approach. There is no \begin_inset Quotes eld \end_inset real \begin_inset Quotes erd \end_inset methodological difference between the two. \end_layout \begin_layout Itemize Often choose approach so that \begin_inset Quotes eld \end_inset free t-tests \begin_inset Quotes erd \end_inset with regression output are testing the most meaningful questions. \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{frame}[containsverbatim] \end_layout \begin_layout Plain Layout \backslash frametitle{} \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset ERT status open \begin_layout Plain Layout \backslash end{frame} \end_layout \end_inset \end_layout \end_body \end_document