packval               package:mixstock               R Documentation

_P_a_c_k _a_n_d _u_n_p_a_c_k _c_o_n_t_r_i_b_u_t_i_o_n _a_n_d _m_a_r_k_e_r _f_r_e_q_u_e_n_c_i_e_s

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

     Packs/unpacks source contributions and source marker frequencies
     into a single vector, after transforming them to an uncorrelated
     (and possibly unbounded) set of parameters.

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

     packval(f, r, transf="part")
     packval2(x,R=2,H=3)
     unpackval(p,R=2,H=2,x.orig=NULL,transf="full",input.only=FALSE)
     unpackval2(p,R=2,H=2,transf="full",x.orig=NULL)

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

       f: Source contributions (numeric vector, all between 0 and 1,
          sum equals 1)

       r: Source marker frequencies: matrix of marker frequencies
          (row=marker, column=source)

       x: a numeric vector containing (elements 1 to R) source
          contributions and (elements R+1 to (R+R*H)) marker
          frequencies in sources

       p: a packed/transformed parameter vector

  transf: Transform to unbounded variables? ("full","part","none") (See
          'p.to.q' for description/warnings.)

       R: number of sources

       H: number of markers

  x.orig: original data (for extracting source/marker names)

input.only: return only contribution parameters?

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

     'packval' packs source contributions and marker frequencies
     specified as a separate vector and a matrix: 'packval2' packs them
     (i.e. transforms them) when they have already been run together as
     a vector. Either produces a numeric vector of the transformed
     values, with length (R-1+R*(H-1)).  'unpackval' and 'unpackval2'
     invert the operation, producing a list 

input.freq: source contributions

source.freq: marker frequencies in sources

     or a vector respectively.

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

     Ben Bolker

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

     'p.to.q'

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

     data(simex)
     sourcefreq <- sweep(simex$sourcesamp,2,apply(simex$sourcesamp,2,sum),"/")
     packval(c(0.2,0.8),sourcefreq)
     packval(c(0.2,0.8),sourcefreq,transf="full")

