[R] use of predict() with confidence/prediction bands

2005-12-29 Thread Alan Arnholt


To my understanding, a confidence interval typically covers a single
valued parameter.  In contrast, a confidence band covers an entire line
with a band.  In regression, it is quite common to construct confidence
and prediction bands.  I have found that many people are connecting
individual confidence/prediction interval values produced with
predict(object,sd.fit=T,type=conf/pred) and calling the result a
confidence/prediction band.  Since there is no specific probability
statement that can be attached to these connected confidence/prediction
intervals, this does not seem reasonable to me.  This is done, for
example, in ISWR pg. 105, UsingR for Introductory Statistics pg 296, and
Linear Models with R pg. 39 (Although in this instance the intervals are
called 95% pointwise confidence bands versus simply 95% confidence
bands.)  To make a confidence/prediction band, one should  construct
simultaneous confidence/prediction intervals with say a Scheffe approach
as mentioned in the S-PLUS Guide to statistics pg 274.  If these connected
intervals were called pointwise confidence/prediction intervals with the
understanding that have no particular probability interpretation, then
they are useful in understanding where the line should fall.  However,
they are not confidence/prediction bands as such, and I think it is
misleading to name them so.  Should the intervals the authors in the
three mentioned references construct not be called something similar
to connected 95% pointwise confidence/prediction intervals versus 95%
confidence/prediction bands?  Or, have I missed the boat?  Fire away...

Alan T. Arnholt
Associate Professor
Dept. of Mathematical Sciences
Appalachian State University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Creating packages with windows (accessing data)

2005-04-17 Thread Alan Arnholt
Dear R List,

I have created a package (under Windows 2.0.1) with 300+ data sets and 20
or so functions I use in teaching.  However, to access the data, one needs
to type data(foo) once the package has been installed and loaded.  With
other packages namely MASS, after the package is installed and loaded with
library(MASS), it is possible to refer to a data set say Animals by simply
typing Animals at the command prompt.  I would like to have similar
functionality in my package.  Would someone provide some hints as to what
I need to do (read about xxx...or provide a line of code) so that the data
in the package can be accessed once it is loaded without typing data(foo)
all the time.  Currently, when I type the name of a function it shows the
code for the function.  I would like it to also show the data when I type
the name of any of the data sets.  Thanks for the pointers in advance.

Alan-

Alan T. Arnholt
Associate Professor
Dept. of Mathematical Sciences
Appalachian State University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Error Building From Source

2005-04-14 Thread Alan Arnholt
Greetings:

I am trying to build R-2.0.1 from source on windows.  My path is set to:

.;C:\RStools;C:\MinGW\bin;C:\perl\bin;C:\texmf\miktex\bin;C:\HTMLws\;C:\R201\R201\bin;%System
Root%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\
Common Files\Adaptec Shared\System;C:\LINGO9\

and Mkrules has been edited and reads

# path (possibly full path) to same version of R on the host system
R_EXE=C:/R201/R201/bin

when I type make I get the following:

-- Making package base 
  adding build stamp to DESCRIPTION
C:/R201/R201/bin: not found
make[4]: *** [frontmatter] Error 127
make[3]: *** [all] Error 2
make[2]: *** [pkg-base] Error 2
make[1]: *** [rpackage] Error 2
make: *** [all] Error 2

Any hints as to why it says it can not find C:/R201/R201/bin?  Any help
would be appreciated.

Alan

Alan T. Arnholt
Associate Professor
Dept. of Mathematical Sciences
Appalachian State University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Building Windows Package

2004-07-26 Thread Alan Arnholt
I am using R-1.9.1 with windows 2000 and trying to build a package.
However,
when I issue the command:

RCMD build --binary BSDA

I get:

  Building/Updating help pages for package 'BSDA'
 Formats: chm
hhc: not found
cp: cannot stat `C:/R191/R191/JUNK/BSDA/chm/BSDA.chm': No such file or
direc
tory
make[1]: *** [chm-BSDA] Error 1
make: *** [pkg-BSDA] Error 2
*** Installation of BSDA failed ***


My path is:

.;C:\RStools;C:\MinGW\bin;C:\perl\bin;C:\texmf\miktex\bin;C:\Rstools\zip.exe;
C:\Rstools\unzip.exe;C:\HTMLws\hhc.exe;C:\R191\R191\bin;%SystemRoot%\system32;
%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\CommonFiles\AdaptecShared\System;
C:\Program Files\ggobi;C:\Program Files\R\rw1091\library\Rggobi\libs

(HTML Help Workshop lives in- C:\HTMLws\hhc.exe)


I have the directory for HTML Help workshop in MkRules set as:

# Where does 'HTML Help Workshop' live? (unused if compiled HTML help is
# not requested. Spaces allowed.)
HHWDIR=C:/HTMLws

After I issue RCMD build --binary BSDA and get the error messages, if I go
to
`C:/R191/R191/JUNK/BSDA/chm/BSDA.hhp' and manually compile the file (with
HTML Help

workshop) then issue the command RCMD build --binary BSDA   again...the
package builds
without problems.  Any ideas what I am doing wrong?  Thanks in advance for
the help.


Alan




Alan T. Arnholt
Associate Professor
Dept. of Mathematical Sciences
Appalachian State University
2003-2004 International Exchange Scholar
Universidad Publica de Navarra - Nafarroako Unibertsitate Publikoa
Pamplona,  Spain

TEL : +34 948 169 205
CELL: +34 656 668 621

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Building Windows Package

2004-07-26 Thread Alan Arnholt
Thanks.  It works great now!

Alan

Alan T. Arnholt
Associate Professor
Dept. of Mathematical Sciences
Appalachian State University
2003-2004 International Exchange Scholar
Universidad Publica de Navarra - Nafarroako Unibertsitate Publikoa
Pamplona,  Spain

TEL : +34 948 169 205
CELL: +34 656 668 621

On Mon, 26 Jul 2004, Prof Brian Ripley wrote:

 You want the directory in your path specification, not the executables.
 As in

 .;C:\RStools;C:\MinGW\bin;C:\perl\bin;C:\texmf\miktex\bin;
 C:\HTMLws;C:\R191\R191\bin;%SystemRoot%\system32;
 %SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
 Files\CommonFiles\AdaptecShared\System;
 C:\Program Files\ggobi;C:\Program Files\R\rw1091\library\Rggobi\libs


 On Mon, 26 Jul 2004, Alan Arnholt wrote:

  I am using R-1.9.1 with windows 2000 and trying to build a package.
  However,
  when I issue the command:
 
  RCMD build --binary BSDA
 
  I get:
 
Building/Updating help pages for package 'BSDA'
   Formats: chm
  hhc: not found
  cp: cannot stat `C:/R191/R191/JUNK/BSDA/chm/BSDA.chm': No such file or
  direc
  tory
  make[1]: *** [chm-BSDA] Error 1
  make: *** [pkg-BSDA] Error 2
  *** Installation of BSDA failed ***
 
 
  My path is:
 
  .;C:\RStools;C:\MinGW\bin;C:\perl\bin;C:\texmf\miktex\bin;C:\Rstools\zip.exe;
  C:\Rstools\unzip.exe;C:\HTMLws\hhc.exe;C:\R191\R191\bin;%SystemRoot%\system32;
  %SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
  Files\CommonFiles\AdaptecShared\System;
  C:\Program Files\ggobi;C:\Program Files\R\rw1091\library\Rggobi\libs
 
  (HTML Help Workshop lives in- C:\HTMLws\hhc.exe)
 
 
  I have the directory for HTML Help workshop in MkRules set as:
 
  # Where does 'HTML Help Workshop' live? (unused if compiled HTML help is
  # not requested. Spaces allowed.)
  HHWDIR=C:/HTMLws
 
  After I issue RCMD build --binary BSDA and get the error messages, if I go
  to
  `C:/R191/R191/JUNK/BSDA/chm/BSDA.hhp' and manually compile the file (with
  HTML Help
 
  workshop) then issue the command RCMD build --binary BSDA   again...the
  package builds
  without problems.  Any ideas what I am doing wrong?  Thanks in advance for
  the help.
 
 
  Alan
 
 
 
 
  Alan T. Arnholt
  Associate Professor
  Dept. of Mathematical Sciences
  Appalachian State University
  2003-2004 International Exchange Scholar
  Universidad Publica de Navarra - Nafarroako Unibertsitate Publikoa
  Pamplona,  Spain
 
  TEL : +34 948 169 205
  CELL: +34 656 668 621
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 

 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595



__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Exact Binomial test feature or bug?

2004-04-30 Thread alan . arnholt
Dear R Users,

Is the p-value reported in a two-tailed binomial exact 
test in error or is it a feature?  
If it is a feature, could someone provide a reference 
for its two-tailed p-value computations?
Using Blaker's (2000 - Canad. J. Statist 28: 783-798) 
approach,the p-value is the minimum of the two-tailed 
probabilities $P \left(Y\geq y_{obs}\right)$ and 
$P\left(Y\leq y_{obs}\right)$ plus an attainable 
probability in the other tail that is as close as 
possible to, but not greater than that one-tailed 
probability.  Consider the following examples 
performed in R version 1.9
under windows 2000.

 binom.test(110,500,.2)

Exact binomial test

data:  110 and 500 
number of successes = 110, number of trials = 500, p-
value = 0.2636
alternative hypothesis: true probability of success is 
not equal to 0.2 
95 percent confidence interval:
 0.1844367 0.2589117 
sample estimates:
probability of success 
  0.22 

(P-value should be according to the Blaker definition 
0.2881)

 binom.test(90,500,.2)

Exact binomial test

data:  90 and 500 
number of successes = 90, number of trials = 500, p-
value = 0.2881
alternative hypothesis: true probability of success is 
not equal to 0.2 
95 percent confidence interval:
 0.1473006 0.2165364 
sample estimates:
probability of success 
  0.18 

(P-value should be according to the Blaker definition 
0.2647)


The following code (only checked on windows) reports 
the Blaker definition of the p-value. 

%%%


bino.test - 
function(x, n, p = 0.5, alternative = c
(two.sided, less, greater), conf.level = 0.95)
{
eps - sqrt(.Machine$double.eps)
if(any(is.na(x) || (x  0) || (x != round(x
stop(x must be nonnegative and 
integer)
if(length(x) == 2) {
n - sum(x)
x - x[1]
}
else if(length(x) == 1) {
if((length(n)  1) || is.na(n) || (n  
1) || (n != round(n)) || (x  n))
stop(n must be a positive 
integer = x)
}
else stop(incorrect length of x)
if(!missing(p)  (length(p)  1 || is.na(p) 
|| p  0 || p  1))
stop(p must be a single number 
between 0 and 1)
alternative - match.arg(alternative)
if(!((length(conf.level) == 1)  is.finite
(conf.level)  (conf.level  0)  

(conf.level  1)))
stop(conf.level must be a single 
number between 0 and 1)
DNAME - paste(deparse(substitute(x)), and, 
deparse(substitute(n)))
PVAL - switch(alternative,
less = pbinom(x, n, p),
greater = 1 - pbinom(x - 1, n, p),
{
pvec - pbinom(0:n, n, p)
if(x/n  p) {
pb - pbinom(x, n, p)
p2 - max((1 - pvec)
[pb - (1 - pvec) =  - eps * pb], 0)
min(1, pb + p2)
}
else {
pb - (1 - pbinom(x - 
1, n, p))
p2 - max(pvec[pb - 
pvec =  - eps * pb], 0)
min(1, pb + p2)
}
}
)
p.L - function(x, n, alpha)
{
if(x == 0)
0
else qbeta(alpha, x, n - x + 1)
}
p.U - function(x, n, alpha)
{
if(x == n)
1
else qbeta(1 - alpha, x + 1, n - x)
}
CINT - switch(alternative,
less = c(0, p.U(x, n, 1 - conf.level)),
greater = c(p.L(x, n, 1 - conf.level), 
1),
two.sided = {
alpha - (1 - conf.level)/2
c(p.L(x, n, alpha), p.U(x, n, 
alpha))
}
)
attr(CINT, conf.level) - conf.level
ESTIMATE - x/n
names(x) - number of successes
names(n) - number of trials
names(ESTIMATE) - names(p) - probability of 
success
structure(list(statistic = x, parameter = n, 
p.value = PVAL, conf.int = CINT, estimate = 

ESTIMATE,
null.value = p, alternative = 
alternative, method = Exact binomial test, 

data.name = DNAME),
class = htest)
}

%%%
%%

Thanks in advance for the responses.  I am not 
currently on the R-mailing list. So, if you could 

cc your responses to [EMAIL PROTECTED] I would 
be most thankful.

Alan Arnholt



-
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help