R functions - Philipp-Neubauer/PopR GitHub Wiki

This is a short overview of R functions - this will likely develop into a proper R package once Julia is more stable (i.e., V>1.0).

Toy_data_creator.R

  • commented example of the package

DPM_call

DPM_call(datas=NULL,baseline=NULL,labels=NULL,learn=FALSE,iters=1000,thin=10,np=1, typeof='N',path.to.julia=getwd(),call_DPM_path=getwd())

  • implemented in (Julia_call_function.R), calls MCMC for Dirichlet process models
  • set learn=T for model with baseline
  • set appropriate path_to_julia if julia files are not in the working directory
  • typeof: 'N' for normal inference (default, and only one available for now), 'MN' for multinomial (allel frequency data) and 'Both' for a combined analysis

MM_call

MM_call(datas=NULL,baseline=NULL,labels=NULL,conditional=FALSE,iters=1000,thin=10,np=1, typeof='N',path.to.julia=getwd(),call_DPM_path=getwd())

  • implemented in (Julia_call_function.R), calls MCMC for finite mixture models
  • set conditional=T for conditional mixture analysis (e.g., Munch & Clarke 2008), set to False for unconditional (Smith & Campana 2010, Pella & Masusda references).
  • set appropriate path_to_julia if julia files are not in the working directory
  • typeof: 'N' for normal inference (default, and only one available for now), 'MN' for multinomial (allel frequency data) and 'Both' for a combined analysis

elink.call

elink.call(class.ids,path.to.julia=getwd(),elink_path=getwd())

  • implements exact linkage in Julia
  • set appropriate path_to_julia if julia files are not in the working directory
  • class.ids are the individual class.ids as output from the MCMC sampler. Would work with any other sampler as well (e.g., finite mixture models)

as.phylogg

as.phylogg(Z,N,tip.label=as.character(1:N))

  • converts output from exact linkage algorithm (Z) to ape 'phylo' format for tree visualization.
  • N is the number of tips
  • tip.label are individual sample labels