dist_prob_wrapper: Make distribution specific functions to fit distribution

Description Usage Arguments Value Examples

Description

This is a wrapper that function that uses a provided distribution to fit the negative log likelihood for a distribution of bottlenecks given a data frame of fits on a per-pair basis. This can be used with mle from the bbmle package.

Usage

1
dist_prob_wrapper(ddist, params)

Arguments

ddist

The pdf or pmf function for the distribution to test as a string.

params

The parameters to pass to the ddist function as a string with commas

Value

the negative Log likelihood weighted by the weighted data frame

Examples

1
2
3
4
5
6
7
8
require(magrittr)
require(dplyr)
fit <-trans_fit(small_trans,100,"PA",threshold = NULL,acc=NULL,pair_id)
weights<-small_trans %>% group_by(pair_id) %>%
summarize(donor_mutants = length(which(freq1>0 & freq1<0.5))) %>%
 mutate(weight_factor = max(donor_mutants)/donor_mutants)
binom_fit<-dist_prob_wrapper("dbinom","size,prob")
binom_fit(fit,weights,100,0.1)

jtmccr1/HIVEr documentation built on May 29, 2019, 1:50 a.m.