Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2120 > unrolled thread

Re: Error bars

Started byRobert Rosenbaum <robertr@math.uh.edu>
First post2011-05-05 09:26 +0000
Last post2011-05-05 09:26 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Error bars Robert Rosenbaum <robertr@math.uh.edu> - 2011-05-05 09:26 +0000

#2120 — Re: Error bars

FromRobert Rosenbaum <robertr@math.uh.edu>
Date2011-05-05 09:26 +0000
SubjectRe: Error bars
Message-ID<iptqfm$dfv$1@smc.vnet.net>
It's not the neatest solution and you'll need to tweak the aesthetics if you want to use it for a publication (see esp. ErrorBarFunction), but the code below should get you started.  BTW, the data you sent looks to be a bit off: there are a different number of means than intervals and the means do not all lie in their respective intervals.  Here's the code:


Needs["ErrorBarPlots`"]

means = {79.2834, 74.4719, 73.8007, 73.5467, 72.2965, 76.136, 75.1637,
    74.341, 75.7873, 75.997, 73.6585, 75.1196, 76.3168, 73.8244,
   75.4527, 76.4404, 75.0104, 76.5596, 76.2118, 75.8198};
(*,72.9094,75.9392,77.5203,73.8933};*)

intervals = {{71.5152, 75.6588}, {71.1603, 75.3777}, {72.2091,
    76.9714}, {72.4496, 77.0188}, {74.7051, 78.4491}, {72.1719,
    76.8556}, {72.2981, 77.7783}, {72.5936, 76.9063}, {74.3673,
    78.4631}, {73.9854, 78.8609}, {74.6407, 77.7396}, {73.9558,
    77.9133}, {72.2582, 76.3498}, {73.2699, 78.5874}, {71.4071,
    77.1258}, {75.7951, 80.7734}, {74.3078, 78.3051}, {71.2209,
    76.5365}, {70.7587, 76.3733}, {73.8667, 78.1864}};

errs = intervals - means;

n = Length[means];

Show[{
  BarChart[means, BarSpacing -> None],
  ErrorListPlot[
   Table[{{i - 1/2, means[[i]]}, ErrorBar[errs[[i]]]}, {i, 1, n}],
   PlotStyle -> {Thick, PointSize[.02]}]
  }]





On May 3, 2011, at 4:47 AM, Judy Price wrote:

> Hello all,
>
> I have 24 means:
>
> {79.2834, 74.4719, 73.8007, 73.5467, 72.2965, 76.136, 75.1637, 74.341,
> 75.7873, 75.997, 73.6585, 75.1196, 76.3168, 73.8244, 75.4527, 76.4404,
> 75.0104, 76.5596, 76.2118, 75.8198, 72.9094, 75.9392, 77.5203, 73.8933}
>
> with associated 90% confidence intervals:
> {{71.5152, 75.6588}, {71.1603, 75.3777}, {72.2091, 76.9714}, {72.4496,
> 77.0188}, {74.7051, 78.4491}, {72.1719, 76.8556}, {72.2981,
>  77.7783}, {72.5936, 76.9063}, {74.3673, 78.4631}, {73.9854, 78.8609},
> {74.6407, 77.7396}, {73.9558, 77.9133}, {72.2582,
>  76.3498}, {73.2699, 78.5874}, {71.4071, 77.1258}, {75.7951, 80.7734},
> {74.3078, 78.3051}, {71.2209, 76.5365}, {70.7587,
>  76.3733}, {73.8667, 78.1864}}
>
> I also have a reference mean:
>
> 75.7718
>
> I would like to plot the reference mean with a confidence interval of 80%
> and 125%, next to the 24 samples, as a bar chart with 'error bars'
> representing the confidence intervals.
>
> Does anyone know how this can be done?
>
> TIA,
> Judy
>
>
>
>


Best,
Robert




[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web