sliding.meansd             package:Ringo             R Documentation

_C_o_m_p_u_t_e _m_e_a_n _a_n_d _s_t_a_n_d_a_r_d _d_e_v_i_a_t_i_o_n _o_f _s_c_o_r_e_s _i_n _a _s_l_i_d_i_n_g _w_i_n_d_o_w

_D_e_s_c_r_i_p_t_i_o_n:

     This functions is used to slide a window of specified size over
     scores at given positions. Computed is the mean and standard
     deviation over the scores in the window.

_U_s_a_g_e:

     sliding.meansd(positions, scores, half.width)

_A_r_g_u_m_e_n_t_s:

positions: numeric; sorted vector of (genomic) positions of scores

  scores: numeric; scores to be smoothed associated to the 'positions'

half.width: numeric, half the window size of the sliding window

_V_a_l_u_e:

     Matrix with three columns: 

    mean: means over scores in running window centered at the positions
          that were specified in argument 'positions'.

      sd: standard deviations over scores in running window centered at
          the positions that were specified in argument 'positions'.

   count: number of points that were considered for computing the mean
          and standard deviation at each position

_A_u_t_h_o_r(_s):

     Joern Toedling and Oleg Sklyar

_S_e_e _A_l_s_o:

     'sliding.quantile'

_E_x_a_m_p_l_e_s:

        set.seed(123)
        sampleSize <- 10
        ap <- cumsum(1+round(runif(sampleSize)*10))
        as <- c(rnorm(floor(sampleSize/3)),
                rnorm(ceiling(sampleSize/3),mean=1.5),
                rnorm(floor(sampleSize/3)))
        sliding.meansd(ap, as, 20)
        ap
        mean(as[1:3])
        sd(as[1:3])

