View source: R/mixstock.R View source: R/RCS/turtle.R
packval | R Documentation |
Packs/unpacks source contributions and source marker frequencies into a single vector, after transforming them to an uncorrelated (and possibly unbounded) set of parameters.
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)
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
|
R |
number of sources |
H |
number of markers |
x.orig |
original data (for extracting source/marker names) |
input.only |
return only contribution parameters? |
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.
Ben Bolker
p.to.q
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.