HW3 Solution
HW3 Solution
Homework 3 Solution
a)
1000
b)
c)
d)
e)
0.1
40000
1
40000
2180 hours
50000
2
1
0.245
0.2
21551 hours
1.96
3
40000
0.004
1
100 10
114,306,819 hours
40000
0.004
2. a) Reanalyze the exact time failure data from Example 4.5 (Example on Slide # 19), this time
assuming a lognormal life distribution model applies. Compare the values of the maximized
log likelihood or the minimized negative log likelihood under the Weibull and lognormal
models. Which of the two models has better fit for these exact failure times data?
b) Repeat the analysis using the interval data (given on Slide # 24). Which model has better
fit for the interval data?
c) Now assume that the high stress is so accelerated over normal use conditions that one
second of high stress is equivalent to one day of normal use. Use both the Weibull model
estimated parameters and the lognormal estimated parameters from (a) to calculate the
cumulative percent failure total at one second. Which of the two models gives more
optimistic results? How do the projected fallouts over the first 90 days at normal use
conditions compare, when calculated by the two models (90 days at use is equivalent to 1.5
minutes at high stress)?
Solution:
a) From the R output below, we can see that the log likelihood values for the Weibull and
lognormal models are -226.7 and -227.2, respectively. The Weibull model has slightly
1
larger log likelihood value, which indicates slightly better fit. However, the two values
are very close, and hence the difference between two models are small.
>
>
>
>
>
capacitor2=read.csv(file=" capacitor2.csv",header=T)
attach(capacitor2)
library(survival)
fit.weibull=survreg(Surv(Time,Fail)~1,dist="weibull")
summary(fit.weibull)
Call:
survreg(formula = Surv(Time, Fail) ~ 1, dist = "weibull")
Value Std. Error
z
p
(Intercept) 8.533
0.360 23.7 2.29e-124
Log(scale) 0.477
0.183 2.6 9.21e-03
Scale= 1.61
Weibull distribution
Loglik(model)= -226.7
Loglik(intercept only)= -226.7
Number of Newton-Raphson Iterations: 5
n= 50
> fit.lognormal=survreg(Surv(Time,Fail)~1,dist="lognormal")
> summary(fit.lognormal)
Call:
survreg(formula = Surv(Time, Fail) ~ 1, dist = "lognormal")
Value Std. Error
z
p
(Intercept) 8.042
0.444 18.10 3.02e-73
Log(scale) 0.935
0.157 5.97 2.38e-09
Scale= 2.55
Log Normal distribution
Loglik(model)= -227.2
Loglik(intercept only)= -227.2
Number of Newton-Raphson Iterations: 4
n= 50
> detach(capacitor2)
b) From the R output below, the negative log likelihood values for the Weibull and
lognormal models are 91.414 and 90.452, respectively. For the interval data, the
lognormal model has slighter smaller negative log likelihood value, which indicates
slightly better fit. However, the difference is very small.
>
>
>
+
+
cap.readout=read.csv("capacitor_readout.csv",header=T)
attach(cap.readout)
LIK.weibull=function(theta)
{
cdf=function(t)
2
+ {
+ 1-exp(-(t/theta[1])^theta[2])
+ }
+ prob.int=cdf(End)-cdf(Start)
+ res=-sum(Failure*log(prob.int))
+ return(res)
+ }
> nlm(LIK.weibull,c(exp(8.533),1/1.61),hessian=TRUE)
$minimum
[1] 91.41438
$estimate
[1] 5079.6619849
0.6413383
$gradient
[1] 1.743536e-05 -5.684342e-08
$hessian
[,1]
[,2]
[1,] 3.925363e-07 0.002672835
[2,] 2.672835e-03 86.874126737
$code
[1] 2
$iterations
[1] 4
> LIK.logn=function(theta)
+ {
+ cdf=function(t)
+ {
+ pnorm((log(t)-theta[1])/theta[2])
+ }
+ prob.int=cdf(End)-cdf(Start)
+ res=-sum(Failure*log(prob.int))
+ return(res)
+ }
> nlm(LIK.logn,c(8.042,2.55),hessian=TRUE)
$minimum
[1] 90.45248
$estimate
[1] 7.954250 2.200689
$gradient
[1] -3.718753e-08
3.609719e-08
$hessian
[,1]
[,2]
[1,] 8.411189 -3.891015
[2,] -3.891015 9.223935
3
$code
[1] 1
$iterations
[1] 6
0.025
0.025
2.1
10 . The
projected fallout rate is about 245 times higher for the lognormal model. Therefore, the
Lognormal gives more optimistic results than the Weibull model.
3. Ten drill bits are randomly selected from a process. The times to failure (i.e., loss of
acceptable sharpness) for the bits are recorded as 37, 39, 42, 43, 49, 50, 54, 55, 59, and 63
hours. Assuming the failure times have a Weibull distribution, analyze the data using
probability plotting. Estimate the shape and scale parameters. Plot the original data versus the
CDF model corresponding to your parameter estimates. Add confidence limits.
Solution:
By using least square estimation for fitting a straight line for ln regressing on
6.35 and the
ln ln 1
, the estimated shape parameter is
.
Probability-Time Scale
0.3
0.3
0.2
0.2
0.1
0.1
^ t
F
0.7
0.6
0.5
0.4
^ t
F
0.7
0.6
0.5
0.4
0.01
0.01
35
40
t
45
50
55
60
65
35
40
45
50
55
60
65
> data=c(37,39,42,43,49,50,54,55,59,63)
> mrcdf=(seq(1,length(data))-0.3)/(10+0.4)
> mrcdf
[1] 0.06730769 0.16346154 0.25961538 0.35576923 0.45192308
0.54807692 0.64423077
[8] 0.74038462 0.83653846 0.93269231
> fit=lm(log(data)~log(-log(1-mrcdf)))
> summary(fit)
Call:
lm(formula = log(data) ~ log(-log(1 - mrcdf)))
Residuals:
Min
1Q
-0.071199 -0.023510
Median
0.004276
3Q
0.022142
Max
0.068640
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)
3.96180
0.01455 272.35 < 2e-16 ***
log(-log(1 - mrcdf)) 0.15749
0.01233
12.78 1.33e-06 ***
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 0.04123 on 8 degrees of freedom
Multiple R-squared: 0.9533,
Adjusted R-squared: 0.9474
F-statistic: 163.2 on 1 and 8 DF, p-value: 1.328e-06
> alpha=exp(fit$coef[1])
> alpha
(Intercept)
52.55196
> beta=1/fit$coef[2]
> beta
log(-log(1 - mrcdf))
6.349675
> fc=1:10
> lcl.cdf=qbeta(0.05,fc,11-fc)
> ucl.cdf=qbeta(0.95,fc,11-fc)
> lcl.time=exp(log(-log(1-lcl.cdf))*fit$coef[2]+fit$coef[1])
> ucl.time=exp(log(-log(1-ucl.cdf))*fit$coef[2]+fit$coef[1])
> par(mfrow=c(1,2),mai=c(0.9,0.9,0.6,0.2))
> # Weibull Probability Plot with CI on CDF
> plot(log(data),log(-log(1mrcdf)),ylab=expression(hat(F)(t)),xlab=expression(t),pch=16,cex=1.3
,main="Weibull Probability Plot",axes=F,ylim=c(5.28,0),xlim=c(3.13,4.23))
> #xloc=seq(min(log(lcl.time)),max(log(ucl.time)),length=6)
5
>
#axis(1,at=xloc,labels=round(exp(seq(min(log(lcl.time)),max(log(ucl.
time)),length=6)),2),las=1)
> xloc=log(c(35,40,45,50,55,60,65))
> axis(1,at=xloc,labels=c(35,40,45,50,55,60,65),las=1)
> yloc=log(-log(1-seq(min(lcl.cdf),max(ucl.cdf),length=11)))
>
axis(2,at=yloc,labels=round(seq(min(lcl.cdf),max(ucl.cdf),length=11)
,2),las=1)
> fit2=lm(log(-log(1-mrcdf))~log(data))
> abline(fit2,lty=2,col="red",lwd=2)
> points(log(data),log(-log(1-lcl.cdf)),cex=1.3)
> points(log(data),log(-log(1-ucl.cdf)),cex=1.3)
> # Weibull Probability Plot with CI on failure times
> plot(log(data),log(-log(1mrcdf)),ylab=expression(hat(F)(t)),xlab=expression(t),pch=16,cex=1.3
,main="Probability-Time Scale",axes=F,ylim=c(5.28,0),xlim=c(3.13,4.23))
> xloc=log(c(35,40,45,50,55,60,65))
> axis(1,at=xloc,labels=c(35,40,45,50,55,60,65),las=1)
> yloc=log(-log(1-seq(min(lcl.cdf),max(ucl.cdf),length=11)))
>
axis(2,at=yloc,labels=round(seq(min(lcl.cdf),max(ucl.cdf),length=11)
,2),las=1)
> #fit2=lm(log(-log(1-mrcdf))~log(data1))
> abline(fit2,lty=2,col="red",lwd=2)
> points(log(lcl.time),log(-log(1-mrcdf)),cex=1.3)
> points(log(ucl.time),log(-log(1-mrcdf)),cex=1.3)
> par(mfrow=c(1,1))
4. Simulate 15 random values from a standard normal distribution. Using these values,
and
calculate 15 values of time to failure from a lognormal distribution with parameters
by applying the equation:
, where
1.0 and
500 hours. Arrange the
failure times from smallest to largest. Assume these failure times come from a stress test that
ended at 750 hours. Thus, only those times less than 750 hours can be counted failures.
Failure times above 750 hours are censored observations. Using median ranks, plot the
and . Compare the estimates
observed failures as a lognormal probability plot. Estimate
to the original simulation values.
Solution:
The Lognormal probability plot below indicates that lognormal distribution is consistent with
the observed failure times. The estimated parameters are
488.15 and
0.77, which
are consistently smaller than the original parameter values used in simulation. This is due to
the right-censoring of the failure times.
> T50=500
6
>
>
>
>
>
sigma=1
z=rnorm(n=15,mean=0,sd=1)
t=T50*exp(sigma*z)
ts=sort(t)
ts
[1] 111.0982 178.8741 292.1074 334.9557 377.5388 378.0778
[7] 399.1003 419.2685 567.2866 593.3913 1204.9359 1445.6394
[13] 1665.0915 2013.6746 2923.5896
> nf=sum(ts<=750)
> tf=ts[ts<=750]
> tf
[1] 111.0982 178.8741 292.1074 334.9557 377.5388 378.0778 399.1003
[8] 419.2685 567.2866 593.3913
> mrcdf=(seq(1,nf)-0.3)/(15+0.4)
> mrcdf
[1] 0.04545455 0.11038961 0.17532468 0.24025974 0.30519481
0.37012987
[7] 0.43506494 0.50000000 0.56493506 0.62987013
> fit1=lm(log(tf)~qnorm(mrcdf))
> t50.hat=exp(fit1$coef[1])
> sigma.hat=fit1$coef[2]
> t50.hat
(Intercept)
488.1487
> sigma.hat
qnorm(mrcdf)
0.7692006
>
plot(log(tf),qnorm(mrcdf),ylab=expression(hat(F)(t)),xlab=expression
(t),pch=16,cex=1.3,main="Lognormal Probability
Plot",axes=F,xlim=c(4.6,6.5),ylim=c(-1.7,0.4))
> xloc=log(seq(100,600,by=100))
> axis(1,at=xloc,labels=seq(100,600,by=100),las=1)
> yloc=qnorm(seq(min(mrcdf),max(mrcdf),length=11))
>
axis(2,at=yloc,labels=round(seq(min(mrcdf),max(mrcdf),length=11),3),
las=1,line=)
> fit2=lm(qnorm(mrcdf)~log(tf))
> abline(fit2,lty=2,col="red",lwd=2)
F^t
0.338
0.279
0.221
0.162
0.104
0.045
100
200
300
400
500
600