__Example data sets and results for BARS:__

Below are two examples which illustrate the use of the BARS
procedure. The first example is one in which we expect to detect a
signal, while the second example does not contain a signal.
__Example 1:__

First read in the data set (**example1.txt**). The first column in this
data set is x, and the second is y.

**barsdata =
read.table("example1.txt", header=F)
**

x = barsdata[,1]

y = barsdata[,2]

Run BARS (default value for alpha is 0.05)

**out = barsN.fun(x,y)
**

Plot the original data with the BARS fit overlayed:

**plot(x, y, xlab="", ylab="")
**

lines(x, out$postmodes)

Click **here** to see the resultant plot.

To find the location of the maximum height of the BARS curve:

**out$peaklocationmode
**

To find the confidence (credible) interval for the peak location

**out$peaklocationquantile
**

The BARS test is significant if the above credible interval is a
proper subset of the data range. To determine the data range, issue
the commands

**min(x)
**

max(x)

For this example, the data range is (1770, 92705), while the credible
interval is (15957.63, 30849.87), a proper subset of the data
range. Therefore, we conclude that the test is significant and that a
signal exists.

__Example 2:__

Click **here** for the data set, and **here** for the resultant plot (here we use
the same **R** commands as in the previous example). For this
second example in which we do not expect to detect a signal, we find
that the data range is (3, 90263), while the credible interval is
(23692.26, 90263.00). The credible interval is not s proper subset of
the data range, so we fail to reject the null hypothesis that no
signal exists.