consistency
asymptotic bounds
cook's distance
https://en.wikipedia.org/wiki/Cook%27s_distance
M-estimator
Influence function and sensitivity curves
This site is to serve as my note-book and to effectively communicate with my students and collaborators. Every now and then, a blog may be of interest to other researchers or teachers. Views in this blog are my own. All rights of research results and findings on this blog are reserved. See also http://youtube.com/c/hongqin @hongqin
Showing posts with label Weibull. Show all posts
Showing posts with label Weibull. Show all posts
Sunday, October 23, 2016
Saturday, July 12, 2014
Gompertz versus Weibull, semilog versus log-log plot
Gompertz m = R exp(Gt)
so, ln(m) = Gt semi-log is linear.
Weibull m = A t^(B)
so, ln(m) = lnA + B ln(t) log-log is linear.
Because Weibull takes an extra log-transformation, it 'suppresses' nosies in the data, therefore naturally fits bettern than Gomeprtz model.
so, ln(m) = Gt semi-log is linear.
Weibull m = A t^(B)
so, ln(m) = lnA + B ln(t) log-log is linear.
Because Weibull takes an extra log-transformation, it 'suppresses' nosies in the data, therefore naturally fits bettern than Gomeprtz model.
Friday, July 11, 2014
Compare binomial, gompertz, and weibull model, fitting with simulated binomial-aging-model lifespan
# ~/0.network.aging.prj/0a.network.fitting/_binomial_aging20140711.r
#test binomial aging model
rm(list=ls());
source("lifespan.20131221.r")
require(flexsurv)
##### log likelihood function, 3-parameter binomial mortality rate model
# http://hongqinlab.blogspot.com/2013/12/binomial-mortailty-model.html
# m = R ( 1 + t/t0)^(n-1)
# s = exp( (R t0/n)*(1 - (1+t/t0)^n ) )
llh.binomialMortality.single.run <- function( Rt0n, lifespan ) {
I = Rt0n[1]; t0 = Rt0n[2]; n=Rt0n[3];
my.data = lifespan[!is.na(lifespan)];
log_s = (I * t0 /n )*(1 - (1 + my.data/t0)^n);
log_m = log(I) + (n-1) * log(1 + my.data/t0 );
my.lh = sum(log_s) + sum(log_m);
print (Rt0n ); #trace the convergence
ret = - my.lh # because optim seems to maximize
}
#random number from binomial-aging model
rbinomial.aging <- function ( Rt0n, n){
x.uniform = runif(n)
inverse.binomialaging.CDF = function(R,t0,n,y) {t0*((1- n*log(y)/(R*t0))^(1/n) -1) }
x.binomialaging = inverse.binomialaging.CDF(Rt0n[1],Rt0n[2], Rt0n[3], x.uniform)
return(x.binomialaging)
}
set.seed(20140711)
x = rbinomial.aging( c(0.001,10, 5), 1000)
fitBinom = optim ( c(0.001,10, 3), llh.binomialMortality.single.run , lifespan=x,
method="L-BFGS-B", lower=c(1E-10,0.05,1E-1), upper=c(10,100,50) );
fitGomp = optim ( c(0.005, 0.08), llh.G.single.run , lifespan=x,
method="L-BFGS-B", lower=c(1E-10,1E-2), upper=c(10,10) );
fitWeib2 = flexsurvreg(formula = Surv(x) ~ 1, dist="weibull")
fitGomp2 = flexsurvreg(formula = Surv(x) ~ 1, dist="gompertz")
fitGomp2$coeff
c(-fitGomp$value, fitGomp2$loglik, fitWeib2$loglik, -fitBinom$value)
Flexsurv can over-fit the Gompertz with negative values, and Weibull gave the best value!!!
Even though the random number are generated by binomial aging model, its fitting gave the lowest likelihood?!
TODO: I should to provide a gradient function for optim(method='L-BFGS-B')
Or try optimx()
For binomial-aging, $n$ is under-estimated by optim(), but $m0$ is over-estimated. When the entire data is fitted with Gompertz model, $G$ is too low. How about fitting within initial stage?
set.seed(20140711)
x = round( rbinomial.aging( c(0.001,10, 4), 5000), digits=1 )#t0=10, n=4
tb = calculate.mortality.rate(x)
plot( tb$s ~ tb$t)
plot( tb$mortality.rate ~ tb$t )
plot( tb$mortality.rate ~ tb$t, log='y', main='linear for Gompertz' )
plot( tb$mortality.rate ~ tb$t, log='yx', main='linear for Weibull' )
set.seed(20140711)
x = rbinomial.aging( c(0.01,25, 4), 100) #large m0, t0=25, n=4
x = round( x + 0.5, digits=0)
fitBinom = optim ( c(0.01,25, 3.5), llh.binomialMortality.single.run , lifespan=x,
method="L-BFGS-B", lower=c(1E-10,0.05,1E-1), upper=c(10,100,50) );
fitGomp = optim ( c(0.005, 0.08), llh.G.single.run , lifespan=x,
method="L-BFGS-B", lower=c(1E-10,1E-2), upper=c(10,10) );
fitWeib2 = flexsurvreg(formula = Surv(x) ~ 1, dist="weibull")
fitGomp2 = flexsurvreg(formula = Surv(x) ~ 1, dist="gompertz")
fitGomp2$coeff
c(-fitGomp$value, fitGomp2$loglik, fitWeib2$loglik, -fitBinom$value)
Good, binomial aging model gives the best likelihood.
Plot confirmed that Gompertz looks better than Weibull.
Labels:
aging,
Binomial Aging,
flexsurv,
Gompertz,
network aging,
optim(),
R,
star,
Weibull
Friday, July 4, 2014
todo: Gomperz, Weibull variance comparison
Given the same mean lifespan, how are the variances of Gompertz and Weibull distribution? GG01 suggests that Weibull is the default model and Gompertz is the derived one. They also argue that it is the initial stage are different.
A technical problem is the tail part. Do the models comparison in practice basically differ in the tails?
We do similar study.
1. Simulate Gompertz random variables and compare AIC with Gompertz and Weibull.
2. Simulate Weibull random variables and compare AIC with Gompertz and Weibull.
3. Use linear fitting to check the initial stages.
Useful links: Weibull random number generator
http://stat.ethz.ch/R-manual/R-patched/library/stats/html/Weibull.html
A technical problem is the tail part. Do the models comparison in practice basically differ in the tails?
We do similar study.
1. Simulate Gompertz random variables and compare AIC with Gompertz and Weibull.
2. Simulate Weibull random variables and compare AIC with Gompertz and Weibull.
3. Use linear fitting to check the initial stages.
Useful links: Weibull random number generator
http://stat.ethz.ch/R-manual/R-patched/library/stats/html/Weibull.html
Monday, March 24, 2014
Network configuration on gompertz and weibull fitting (need follow up)
When p=0.6, pop=2000, original GINDIP fits much better to Gompertz with regards to Weibull, as compared to the ms02 permutated network.

I need to generate a distribution using 100 ms02 networks.
Saturday, December 21, 2013
Use simulated Gompertz random number to test flexsurv Gompertz and Weibull fitting results
Summary: I experimented the sample size. For 50 cells, the Gompertz model may be the better fit 4 out of 5 times. For 100 cells, Gompertz is better than Weibull maybe 9 out of 10 times. For 500 cells, Gompertz is always bettern than the Weibull model.
Conclusion: For most yeast life span assay, it is not always easy to tell whether Gompertz or Weibull is a better fit.
Comments: The actual results probably also depend on R and G, which determine the variance.
code: 20131221.gompertz.simulation.R
# generate gompertz random numbers
# fit with flexsurv Gompertz and weibull models
#inverse of gompertz CDF
# see http://hongqinlab.blogspot.com/2013/06/median-lifespan-of-2-parameter-gompertz.html
inverse.gomp.CDF = function(R,G,y) { (1/G)*log(1 - (G/R)*log(1-y) ) }
#see generate random number with a given distribution
# http://hongqinlab.blogspot.com/2013/12/generate-gompertz-random-numbers.html
x.uniform = runif(60)
hist(x.uniform)
x.gompertz = inverse.gomp.CDF(0.001,0.2, x.uniform)
hist(x.gompertz)
summary(x.gompertz)
source("lifespan.r")
tb = calculate.s(x.gompertz)
plot(tb$s ~ tb$t)
require(flexsurv)
require(flexsurv)
lifespan = x.gompertz
lifespanGomp = flexsurvreg(formula = Surv(lifespan) ~ 1, dist = 'gompertz')
lifespanWeib = flexsurvreg(formula = Surv(lifespan) ~ 1, dist = 'weibull')
c(lifespanWeib$AIC, lifespanGomp$AIC, lifespanWeib$AIC - lifespanGomp$AIC )
Conclusion: For most yeast life span assay, it is not always easy to tell whether Gompertz or Weibull is a better fit.
Comments: The actual results probably also depend on R and G, which determine the variance.
code: 20131221.gompertz.simulation.R
# generate gompertz random numbers
# fit with flexsurv Gompertz and weibull models
#inverse of gompertz CDF
# see http://hongqinlab.blogspot.com/2013/06/median-lifespan-of-2-parameter-gompertz.html
inverse.gomp.CDF = function(R,G,y) { (1/G)*log(1 - (G/R)*log(1-y) ) }
#see generate random number with a given distribution
# http://hongqinlab.blogspot.com/2013/12/generate-gompertz-random-numbers.html
x.uniform = runif(60)
hist(x.uniform)
x.gompertz = inverse.gomp.CDF(0.001,0.2, x.uniform)
hist(x.gompertz)
summary(x.gompertz)
source("lifespan.r")
tb = calculate.s(x.gompertz)
plot(tb$s ~ tb$t)
require(flexsurv)
require(flexsurv)
lifespan = x.gompertz
lifespanGomp = flexsurvreg(formula = Surv(lifespan) ~ 1, dist = 'gompertz')
lifespanWeib = flexsurvreg(formula = Surv(lifespan) ~ 1, dist = 'weibull')
c(lifespanWeib$AIC, lifespanGomp$AIC, lifespanWeib$AIC - lifespanGomp$AIC )
Thursday, December 19, 2013
Mixture of Weibull models
Weibull model is known as the exponential distribution because the form of its pdf. see
http://en.wikipedia.org/wiki/Weibull_distribution
Weibull mortality rate = pdf / (1- CDF) ~ t^n
Mixture Weibull distributions is studied by Nicholas Jewell, 1982
http://projecteuclid.org/DPubS/Repository/1.0/Disseminate?view=body&id=pdf_1&handle=euclid.aos/1176345789
http://en.wikipedia.org/wiki/Weibull_distribution
Weibull mortality rate = pdf / (1- CDF) ~ t^n
Mixture Weibull distributions is studied by Nicholas Jewell, 1982
http://projecteuclid.org/DPubS/Repository/1.0/Disseminate?view=body&id=pdf_1&handle=euclid.aos/1176345789
Wednesday, October 16, 2013
flexsurv, R package,
R package 'flexsurv' provides optim() based parametric fitting. Two parameter Gomertz and Weibull model are included. The 'flexsurv' use Hessian to build confidence intervals around the maximum likelihood estimate.
I did not see an obvious way to do nested model test using 'flexsurv'.
I did not see an obvious way to do nested model test using 'flexsurv'.
Subscribe to:
Posts (Atom)







