[R] Re: OC curve in "Quality Control"
WilDscOp
wildscop at yahoo.com
Fri Dec 26 19:21:08 CET 2003
Dear All,
First of all, thanks to "Philippe Glaziou" and "Andrew C. Ward" for their
nice and very helpful e-mail. Well..
----------------- ---------------------------
For Number 1 problem: about <http://pari.math.u-bordeaux.fr/>, sorry i
didnot understand what to download or what to call! From
<http://pari.math.u-bordeaux.fr/download.html> can you please tell me what
should i download and how to use(i could not find any doc)? An exact link
for download may be helpful:)
----------------- ---------------------------
For Number 2 problem: perm function is a very nice one. And yes "choose()"
works fine for me. Also gregmisc package
<http://cran.r-project.org/bin/windows/contrib/1.9/gregmisc_0.8.7.zip> is good.
----------------- ---------------------------
For Number 3 problem: i had some problem using dhyper() because i cannot
match the parameters there. I used
> N<-5000; n<-50; D<-seq(0,500,1); d<-0 # (For d = 1 i just recalculated
it with d<-1)
> hypg <- (choose(D, d)* choose((N-D), (n-d)) / choose(N,n))
instead and it surves my purpose. Anyway, is there any better procedure? I
could not find Hypergeometric() in the base.
----------------- ---------------------------
For Number 5 problem: I did as follows:
# For type A OC curve
> N<-5000; n<-50; D<-seq(1,500,1); d1<-0; d2<-1; p<-(seq(1,500,1)/5000);
Pa<-((choose(D, d1)* choose((N-D), (n-d1)) / choose(N,n)) + (choose(D, d2)*
choose((N-D), (n-d2)) / choose(N,n))); plot(p,Pa,pch="o", main="Type A
\nOperating Characteristic Curve", sub="Using Hypergeometric Distribution",
xlab="Proportion defective", ylab="Probability of Acceptance",
xlim=c(0.00,0.10), ylim=c(0.00,1.00), type="p", axes =T, col=1) # here, p = D/N
# For type B OC curve
> N<-5000; n<-50; D<-seq(0,500,1); d1<-0; d2<-1; p<-(seq(0,500,1)/5000);
Pa1<- dpois(0, (n*p), log = FALSE); Pa2<- dpois(1, (n*p), log = FALSE);
Pa<-Pa1+Pa2; plot(p,Pa,pch="o", main="Type B \nOperating Characteristic
Curve", sub="Using Poisson as an approximation of Binomial Distribution",
xlab="Proportion defective", ylab="Probability of Acceptance",
xlim=c(0.00,0.10), ylim=c(0.00,1.00), type="p", axes =T, col=1)
And these works fine.
Thank you for your time.
_______________________
Mohammad Ehsanul Karim <wildscop at yahoo.com>
Institute of Statistical Research and Training
University of Dhaka, Dhaka- 1000, Bangladesh
More information about the R-help
mailing list