[R-sig-teaching] Histogram for Left Censored Data

Randall Pruim rpruim at calvin.edu
Thu Dec 31 23:47:39 CET 2015


You don’t really say what you want your histogram to be like.  How do you want to deal with the left censored values?  I’d probably use bins of unequal widths (and a density scale), choosing the left-most edge to be something sensible for your data (could these values be as low as 0? is some other cut-off reasonable?)

I’d also put the data into a data frame (not a matrix), but you don’t really need the second column if you take the approach I’m suggesting.

require(mosaic)  # this makes the histogram a density histogram by default
conc <- c(1450,1800,1840,1820,1860,1780,1760,1800,1900,1770,1790,1780,1850,1760,1450,1710,1575,1475,1780,1790,1780,1450,1790,1800)
histogram( ~ conc, breaks = c(1000, seq(1450, 2000, by = 25)))  # set 1000 to whatever value makes sense for your data.

r-help is a better place for this, and typically answers to well stated questions with reproducible R code setting them up are answered pretty promptly.  But neither list should be abused.  People answering are volunteers, not customer service.  They will answer if/when they choose to do so.

—rjp


> On Dec 31, 2015, at 1:31 PM, Steven Stoline <sstoline at gmail.com> wrote:
> 
> Dear All:
> 
> 
> *P.S.* I submitted this request to r-help at r-project.org , but did not get
> any response. I am not sure, what is wrong. I already subscribe to this
> list too.
> 
> 
> I need helps with creating histograms for data that include left censored
> observations.
> 
> Here is an example of left censored data
> 
> 
> 
> *Sulfate.Concentration*
> <-matrix(c(1450,1800,1840,1820,1860,1780,1760,1800,1900,1770,1790,1780,1850,1760,1450,1710,1575,1475,1780,1790,1780,1450,1790,1800,
> 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0),24,2)
> 
> 
> *Column 2* is an indicator for censoring "*1*" for left censored
> observations and "*0*" for non-censored (fully measured) observations.
> 
> 
> 
> 
> 
> 
> with many thanks
> steve
> 
> -- 
> Steven M. Stoline
> 1123 Forest Avenue
> Portland, ME 04112
> sstoline at gmail.com
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-teaching at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching



More information about the R-sig-teaching mailing list