I'm trying to plot and compare weighted histograms and I can't seem find where to start. I have data similar to this:
Miles2LAX RADAM2005Pct LAWA2005Pct 35.57 .00123 .00684 24.74 .00118 .00187 27.09 .00965 .00876 16.23 .00587 .00397 { ... 87 rows} And I'm trying to compare the weighted distribution of "Miles" using the two weightings: RADAM2005Pct and LAWA2005Pct. Where do I begin? I'd ultimately like to have the two distributions on the same plot. E.g. one cross-hatched right and the other cross-hatched left. Do I need to pretend this is a survey and the "percentages' are survey weights? How is such a svydesign formed? Thanks in advance. PS I can plot a single unweighted histogram as follows: > > SurveyData <- read.table("C:/Data/R/RADAMdata2.csv", header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE) > MyX <- c(0,5,10,15,20,30,40,50,60,120) > hist(SurveyData$Miles2LAX, breaks = MyX, + include.lowest = TRUE, right = TRUE, + angle = 45, + main = paste("Histogram of unweighted distances" ), + axes = TRUE, plot = TRUE ) > > describe(SurveyData,num.desc=c("mean","median","var","sd","valid.n"),xna me=NA,maxfac=18,show.pc=TRUE) Description of SurveyData Numeric mean median var sd valid.n RADAM.TAZ 52.17 51 766.7 27.69 87 Miles2LAX 35.31 32.74 508.1 22.54 87 RADAM2005Vol 1.2e+05 8.199e+04 2.421e+10 1.556e+05 87 RADAM2005Pct 0.01149 0.007853 0.0002221 0.0149 87 LAWA2005Vol 176 76 7.051e+04 265.5 87 LAWA2005Pct 0.01149 0.004963 0.0003007 0.01734 87 Factor 29 Palms Alhambra/San Gab Anaheim Anaheim/Disneyla Angeles Forest Baldwin Hills/US Bell Cyn Beverly Hills Big Bear/Arrowhe Brentwood Burbank Camarillo Canoga Park Castiac Chatsworth Chino Commerce Compton RADAM.Name 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Percent 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 1.15 mode = >1 mode Valid n = 87 87 categories - only first 18 shown > range(SurveyData$Miles2LAX, na.rm = TRUE) [1] 2.11 113.99 > > Robert Farley Metro 1 Gateway Plaza Mail Stop 99-23-7 Los Angeles, CA 90012-2952 Voice: (213)922-2532 Fax: (213)922-2868 www.Metro.net [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.