Let the input file where you have the data be called input.txt.

We will call the first column containing the marker information x and the second column containing the test statistic y. This file can include in its top row the characters x y. This is called a header. The choice is up to the user to put the header in or not.

For entering R on the Linux machine on prompt type:

R

Once you are in R the steps for using BARS are as follows:

1) Load the shared object library:

    dyn.load("barsN.so",now = F)

2) Source the R wrapper file:

     source("barsN_R_wrapper")

3) Read in the data file,input.txt:

     With header:

            l = read.table("input.txt",header = T)

            attach(l)

   

    Without header:

              

             l  =  read.table("input.txt")

             x =  l[,1]

             y =  l[,2]

 

4) Run BARS

       

    out  =  barsN.fun(x,y)

 

5) To view all of the BARS results (NOTE: the output may be quite lengthy, so you may want to access particular portions of the output using the $ operator - see below.):

       

    out

 

There are certain other commands which we can use for viewing the results:

 

1) To plot the x and y values.

   

        plot( x ,y , xlab = 'x values', ylab = 'yvalues')

 

2) To fit a curve using BARS data

 

        lines(x , out$postmodes)

 

3) To find the maximum height of the BARS curve

 

        out$peakheightmode

 

4) To find the location of the maximum height of the BARS curve

 

        out$peaklocationmode

 

5)  To find the confidence interval for the peak location

 

        out$peaklocationquantile

 

    The BARS test is significant if this interval is a proper subset of the range defined

    by min(x), max(x). to see what this interval is,

 

        min(x)

        max(x)

 

6) To find the distribution of the peak locations

 

        hist(out$samplpeaks)

 

7) To change the level of confidence in the test to something other than 95% say 99%,

    use the option "conf = 0.99" in the barsN.fun command

 

   

           out  =  barsN.fun(x,y,conf = 0.99)

 

Note :  Another Method to fit a curve using the smooth.spline function

 

                lines(smooth.spline( x, y, cv = T))

 

            To find the maximum height of the smooth.spline curve

 

                    ssout = smooth.spline( x , y , cv = T)

                    lm = predict(ssout)

                    max(lm$y)

   

 

 

To find more details of the parameters and options available for BARSN please

have a look at BARSN_options.