pop.ecdf.dd: Draw an Ecdf plot showing the distribution of scores in each...

View source: R/pop.ecdf.dd.R

pop.ecdf.ddR Documentation

Draw an Ecdf plot showing the distribution of scores in each demographic subgroup

Description

Draws a plot using Hmisc::Ecdf(), overlaying cumulative distribution functions, one for each subgroup specified, and one for overall population. Useful to compare subgroups based on the distribution of scores among people in that subgroup using data from small places like census block groups, based on having for each place the pop total and % of pop that is in each group.

Usage

pop.ecdf.dd(
  e,
  elab,
  mydf,
  dlabs = colnames(mydf),
  mywt = rep(1, NROW(mydf)),
  main,
  mycolors,
  refcolor = "black",
  sorted = TRUE,
  log = "",
  ...
)

Arguments

e

Required numeric vector of scores (e.g., environmental indicator values) for places like block groups, one place per row

elab

Required character single element vector with text label for environmental score, used in xlab of plot

mydf

Required data.frame where each row is a place and each column is the percent of place population that is in given demographic subgroup, one subgroup per column

dlabs

Optional, charater vector that specifies text for legend, same length as number of columns in mydf

mywt

Optional, default is unweighted, but normally would specify as the population counts for places analyzed

main

Optional character specifying plot title at top of plot. Default title notes names of subgroups

mycolors

Optional vector of colors as long as number of columns in mydf, specifies colors of lines

refcolor

Optional color, default is 'black'

sorted

Optional logical, default is TRUE. Should the legend be sorted in order of population weighted mean values of e?

log

Default is ”. Passed to pop.ecdf()

...

Other optional parameters to pass to Ecdf

Value

Draws a plot

See Also

Hmisc::Ecdf() RR() pop.cdf() pop.cdf2() pop.ecdf() pop.cdf.density()

Examples

## #
## Not run: 
set.seed(99)
pctminsim=c(runif(7000,0,1), pmin(rlnorm(5000, meanlog=log(0.30), sdlog=1.7), 4)/4)
popsim= runif(12000, 500, 3000)
esim= rlnorm(12000, log(10), log(1.15)) + rnorm(12000, 1, 0.5) * pctminsim - 1

## End(Not run)

ejanalysis/ejanalysis documentation built on April 2, 2024, 10:12 a.m.