[R] Regression Tolerance Intervals - Dr. Young's Code

Muhuri, Pradip (SAMHSA/CBHSQ) Pradip.Muhuri at samhsa.hhs.gov
Sun Jun 9 19:16:50 CEST 2013


Uwe and Dennis - Thank you so much for your comments, tips and advice. The following reproducible code has worked and given me the desired results. 

Pradip


####################### Revised Code #################


setwd ("C:/RAPP")
require ("tolerance")
set.seed (100);x <- runif (200,0,10); y <- 20+5*x + rnorm (100,0,20); data.frame (cbind (x,y))
out <- regtol.int (reg=lm(y~x), new.x=cbind (c(3,6,12)), side=2, alpha=.05, P=.90);
plottol(out, x=cbind(1,x), y=y, side="two", x.lab="X", y.lab="Y" )



________________________________________
From: Uwe Ligges [ligges at statistik.tu-dortmund.de]
Sent: Sunday, June 09, 2013 11:54 AM
To: Muhuri, Pradip (SAMHSA/CBHSQ)
Cc: "R help ‎[r-help at r-project.org]‎"; mridulbiva at aol.com
Subject: Re: [R] Regression Tolerance Intervals - Dr. Young's Code

On 08.06.2013 05:17, Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
> Hello,
>
> Below is a reproducible example to generate the output by using Dr. Young's R code on the above subject .   As commented below, the issue is that  part of the code (regtol.int and plottol) does not seem to work.
>
> I would appreciate receiving your advice toward resolving the issue.
>
> Thanks and regards,
>
> Pradip Muhuri
>
>
> setwd ("E:/")
> require ("tolerance")
>
> d1<- "xlndur      ylnant
> 8.910797  0.33901690
> 9.001415  0.36464311
> 8.983936  0.53976194
> 8.948035  0.33901690
> 9.056784  0.39266961
> 9.018593  0.18617770
> 9.001415  0.53976194
> 8.983936 -0.11005034
> 8.966147  0.53102826
> 8.948035  0.59885086
> 6.900000  NA"
>
> xd1 <- read.table(textConnection(d1), header=TRUE, as.is=TRUE)
> print (xd1); str (xd1)
>
> #This code works
> xout1 <- regtol.int (reg=lm (formula=ylnant ~ xlndur, data=xd1),  alpha=.05, P=0.99, side=2)
> print (xout1)
>
>
> #This code does not work
> xout2 <- regtol.int (reg=lm (formula=ylnant ~ xlndur, data=xd1), new.xlndur = NULL,  alpha=.05, P=0.99, side=2)

Come on, start using your brain and replace new.xlndur by new.x?

> print (xout2)
> #This code does not work
> plottol(xout1, x=cbind(1,x), y=y, side="two", x.lab="X", y.lab="Y" )

So replace x and y appropriately?

Best,
Uwe Ligges



> #This code does not work
> plottol(xout2, x=cbind(1,x), y=y, side="two", x.lab="X", y.lab="Y" )
>
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list