Thomas Adams
2008-Apr-11 18:37 UTC
[R] Questions related to plotting boxplots of time series data
List, I have looked through several R books and searched the web to find answers to my questions with no results. I have a ensembles of time series data (essentially from Monte Carlo simulations) which I would like to summarize as a time series of boxplots. I don't know how to do this and I am not sure how I should structure the data to get what I want. Another related question: while doing this, can I have some of the time series shorter than others? Ideally I would prefer to depict 99%, 95%, 75%, 50%, etc. confidence intervals to show the distribution of the data. Is this possible? How can I do it? Thanks in advance? Regards, Tom -- Thomas E Adams National Weather Service Ohio River Forecast Center 1901 South State Route 134 Wilmington, OH 45177 EMAIL: thomas.adams at noaa.gov VOICE: 937-383-0528 FAX: 937-383-0033
Thomas Adams
2008-Apr-16 00:20 UTC
[R] Questions related to plotting boxplots of time series data
List, I have looked through several R books and searched the web to find answers to my questions with no results. I have an ensemble of time series data (what are essentially Monte Carlo simulations) which I would like to summarize as a time series of boxplots, by date/time at 6-hr intervals. I don't know how to do this and I am not sure how I should structure the data to get what I want. Another related question: while doing this, can I have some of the time series shorter than others? Ideally I would prefer to depict 99%, 95%, 75%, 50%, etc. confidence intervals to show the distribution of the data. Is this possible? How can I do it? Thanks in advance? Regards, Tom -- Thomas E Adams National Weather Service Ohio River Forecast Center 1901 South State Route 134 Wilmington, OH 45177 EMAIL: thomas.adams at noaa.gov VOICE: 937-383-0528 FAX: 937-383-0033
Stephan Kolassa
2008-Apr-16 13:49 UTC
[R] Questions related to plotting boxplots of time series data
Hi Thomas,> I have looked through several R books and searched the web to find > answers to my questions with no results. I have an ensemble of time > series data (what are essentially Monte Carlo simulations) which I would > like to summarize as a time series of boxplots, by date/time at 6-hr > intervals. I don't know how to do this and I am not sure how I should > structure the data to get what I want. Another related question: while > doing this, can I have some of the time series shorter than others?Once you have a (say) matrix containing the data, you can build a time series of boxplots by feeding a formula to boxplot(): times <- seq(1:20) values <- matrix(rnorm(20*100,0,1),nrow=20,ncol=100) boxplot(values~times) Of course, you would need to align the time series values and take the six-hour-slices first. And then add prettyprinted labels.> Ideally I would prefer to depict 99%, 95%, 75%, 50%, etc. confidence > intervals to show the distribution of the data. Is this possible? How > can I do it?boxplot() by default shows 25%, 50% and 75% quantiles. The whiskers and circles are calculated through the interquartile range, see http://en.wikipedia.org/wiki/Boxplot Unfortunately, I can't seem to find this info in the help file for boxplot(). Thus, you would need to roll your own graphical representations after extracting quantiles via apply(values,2,quantile,probs=c(.99,.95,.75,.5)) or some such. If you do roll your own, just please don't do "nonstandard" boxplots without telling the reader that your "whiskers" mean something different than in the ordinary boxplot... Hope that helped Stephan