Dear Statalisters
here is a do-file relevant to my problem
//test of Stata tip 47: Quantile-quantile plots without programming
version 15.1
//checked and revised 02-10-2023 by Søren Nielsen
//Purpose - to create a qqplot as in Cleveland: Visualizing Data (1994) fig 2.3 p 22
. use http://www.stata-press.com/data/r9/auto, replace
. gen gpm = 100 / mpg
. label var gpm "gallons / 100 miles"
by foreign, sort: egen rank = rank(gpm)
by foreign: egen n = count(gpm)
gen pp = (rank - 0.5) / n
. gen gpmd=gpm if !foreign
. gen gpmf=gpm if foreign
. qqplot gpmd gpmf
//creates qqplot as planned - the plot seem to indicate a fairly straightforward relationship - domestic cars on average use 1 gallon more per 100 miles than foreign cars. I am unable to get to the next step - to create a figure like fig 2.4 in Cleveland(1993)
end of do-file
Any help will be greatly appreciated
Søren Nielsen
here is a do-file relevant to my problem
//test of Stata tip 47: Quantile-quantile plots without programming
version 15.1
//checked and revised 02-10-2023 by Søren Nielsen
//Purpose - to create a qqplot as in Cleveland: Visualizing Data (1994) fig 2.3 p 22
. use http://www.stata-press.com/data/r9/auto, replace
. gen gpm = 100 / mpg
. label var gpm "gallons / 100 miles"
by foreign, sort: egen rank = rank(gpm)
by foreign: egen n = count(gpm)
gen pp = (rank - 0.5) / n
. gen gpmd=gpm if !foreign
. gen gpmf=gpm if foreign
. qqplot gpmd gpmf
//creates qqplot as planned - the plot seem to indicate a fairly straightforward relationship - domestic cars on average use 1 gallon more per 100 miles than foreign cars. I am unable to get to the next step - to create a figure like fig 2.4 in Cleveland(1993)
end of do-file
Any help will be greatly appreciated
Søren Nielsen
Comment