コード例 #1
0
def fit_gamma(samples):
    samples = [double(n) for n in samples if n > 0]#because rpy does not like longs!
    r.library('MASS')
    f = r.fitdistr(samples,'gamma')
    shap,rat = f['estimate']['shape'],f['estimate']['rate']
    qp = r.qgamma(r.ppoints(samples),shape=shap,rate=rat)
    return qp,shape,rat
コード例 #2
0
def fit_weibull(samples):
    #samples = [double(n) for n in samples if n > 0]#because rpy does not like longs!
    r.library('MASS')
    f = r.fitdistr(samples,'weibull')
    sc,sh = f['estimate']['scale'],f['estimate']['shape']
    qp = r.qweibull(r.ppoints(samples),scale=sc,shape=sh)
    return qp,sc,sh
コード例 #3
0
def fit_weibull(samples):
    #samples = [double(n) for n in samples if n > 0]#because rpy does not like longs!
    r.library('MASS')
    f = r.fitdistr(samples, 'weibull')
    sc, sh = f['estimate']['scale'], f['estimate']['shape']
    qp = r.qweibull(r.ppoints(samples), scale=sc, shape=sh)
    return qp, sc, sh
コード例 #4
0
def fit_exponential(samples):
    samples = [float(n) for n in samples]#because rpy does not like longs!
    r.library('MASS')
    f = r.fitdistr(samples,'exponential')
    rat = f['estimate']['rate']
    qp = r.qexp(r.ppoints(samples),rate=rat)

    return qp, rat
コード例 #5
0
def fit_exponential(samples):
    samples = [float(n) for n in samples]  #because rpy does not like longs!
    r.library('MASS')
    f = r.fitdistr(samples, 'exponential')
    rat = f['estimate']['rate']
    qp = r.qexp(r.ppoints(samples), rate=rat)

    return qp, rat
コード例 #6
0
def fit_gamma(samples):
    samples = [double(n) for n in samples
               if n > 0]  #because rpy does not like longs!
    r.library('MASS')
    f = r.fitdistr(samples, 'gamma')
    shap, rat = f['estimate']['shape'], f['estimate']['rate']
    qp = r.qgamma(r.ppoints(samples), shape=shap, rate=rat)
    return qp, shape, rat
コード例 #7
0
def fit_nbinom(samples):
    r.library('MASS')
    f = r.fitdistr(samples,'negative binomial')
    s,m = f['estimate']['size'],f['estimate']['mu']
    qp = r.qnbinom(r.ppoints(samples),size=s,mu=m)
    return qp,s,m
コード例 #8
0
def fit_poisson(samples):
    r.library('MASS')
    f = r.fitdistr(samples,'poisson')
    l = f['estimate']['lambda'] #predicted mean
    qp = r.qpois(r.ppoints(samples),l)
    return qp,l
コード例 #9
0
def fit_poisson(samples):
    r.library('MASS')
    f = r.fitdistr(samples, 'poisson')
    l = f['estimate']['lambda']  #predicted mean
    qp = r.qpois(r.ppoints(samples), l)
    return qp, l
コード例 #10
0
def fit_nbinom(samples):
    r.library('MASS')
    f = r.fitdistr(samples, 'negative binomial')
    s, m = f['estimate']['size'], f['estimate']['mu']
    qp = r.qnbinom(r.ppoints(samples), size=s, mu=m)
    return qp, s, m