Linear Statistical Models: Regression

Stata Simple Linear Regression Session


use http://www.ats.ucla.edu/stat/data/crime, clear

describe

summarize murder poverty
graph box poverty
graph box murder
stem poverty
stem murder
kdensity poverty
kdensity murder
twoway (scatter murder poverty, jitter(2))(lfit murder poverty)

/* 
It is clear that the murder rate for one of
the states is very different from any of the
others.  
*/

list if murder>30

/* Drop DC and repeat above analyses */

drop if state=="dc" /* or drop if sid==51 */
summarize murder poverty
graph box poverty
graph box murder
stem poverty
stem murder
kdensity poverty
kdensity murder
scatter murder poverty, jitter(2)
twoway (scatter murder poverty, jitter(2))(lfit murder poverty)

correlate murder poverty

regress murder poverty
  predict p
  predict rstu, rstu
  scatter p murder, jitter(2)
  scatter p poverty, jitter(2)
  rvfplot, yline(0) 
  rvfplot2, rstu yline(0 2.5 -2.5) ylabel(-3(1)3)
  rvpplot poverty, yline(0)
  rvfplot2, rstu yline(-2.5 2.5) ylabel(-3(1)3) mlabel(sid)
  rvfplot2, rstu yline(-2.5 2.5) ylabel(-3(1)3) mlabel(sid) msymbol(i)
  list sid state murder poverty if sid==20
  scatter rstu poverty, jitter(2) yline(-2.5 2.5) ylabel(-3(1)3)


Linear Statistical Models Course

Phil Ender, 19jan04