home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / base / weighted.mean < prev    next >
Encoding:
Text File  |  1997-04-23  |  888 b   |  36 lines

  1.     
  2.     _W_e_i_g_h_t_e_d _A_r_i_t_h_m_e_t_i_c _M_e_a_n
  3.     
  4.          weighted.mean(x, w, na.rm=FALSE)
  5.     
  6.     _A_r_g_u_m_e_n_t_s:
  7.     
  8.                x : a numeric vector containing the values whose
  9.                    mean is to be computed.
  10.     
  11.                w : a vector of weights the same length as x giv-
  12.                    ing the weights to use for each element of x.
  13.     
  14.            na.rm : a logical value indicating whether NA values
  15.                    in x should be stripped before the computa-
  16.                    tion proceeds.
  17.     
  18.     _D_e_s_c_r_i_p_t_i_o_n:
  19.     
  20.          If w is missing then all elements of x are given the
  21.          same weight.
  22.     
  23.          Missing values in w are not handled.
  24.     
  25.     _S_e_e _A_l_s_o:
  26.     
  27.          mean
  28.     
  29.     _E_x_a_m_p_l_e_s:
  30.     
  31.          #GPA from Siegel 1994
  32.          wt<- c(5/15,5/15,4/15,1/15)
  33.          x <- c(3.7,3.3,3.5,2.8)
  34.          xm <- weighted.mean(x,wt)
  35.     
  36.