[R] Sample size calculations for one sided binomial exact test

2011-11-01 Thread Andrew Redd
I'm trying to compute sample size requirements for a binomial exact test.
 we want to show that the proportion is at least 90% assuming that it is
95%, with 80% power so any asymptotic approximations are out of the
questions.  I was planning on using binom.test to perform the simple test
against a prespecified value, but cannot find any functions for computing
sample size.  do any exist?

Thanks,
Andrew

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Dragging an .RData file into R on win-7 doesn't work?

2010-10-22 Thread Andrew Redd
NppToR is not guaranteed to work when ran as Administrator.   This is due to
the different permissions that is running.  NppToR without admin privileges
should not be able to find the running R process, or should not be able to
control it.  Although If you run NppToR as Admin it should be able to
control it, but there is no reason to except to install the R auto
completion files.

My Suggestion, create a local library to keep your packages in.  Save the
location in your Rprofile file.  Then there is no reason to ever run R as
admin.

-Andrew

On Fri, Oct 22, 2010 at 3:16 AM, Tal Galili tal.gal...@gmail.com wrote:

 Hi all,

 I sometimes drag an .RData file into an open R console so to load that data
 into the file.
 I use windows 7, and it works fine.

 But, if I open R by using:
 right click on icon - properties - compatibility - (mark the box) run
 this program as an administrator
 Then I can no longer drag the .RData into the R console.
 (also, the nppToR extension for notepadd++ stops sending the R script to
 R...)

 You probably wonder, why might I be interested in running R with
 administrator privileges - the reason is that if R is installed under
 c: directory,  I will be blocked from installing new packages to R (unless
 I either install R on d: drive, or enable admin privileges).


 I know many people here prefer linux (gnu/linux), but still some of us (for
 example, me) use windows, so help here will be valuable.
 Thanks,
 Tal




 Contact
 Details:---
 Contact me: tal.gal...@gmail.com |  972-52-7275845
 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
 www.r-statistics.com (English)

 --




[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Help request: highlighting R code on WordPress.com blogs

2010-09-09 Thread Andrew Redd
The question would be performance issues for having too many
functions. We could just limit it to the reserved keywords.  Another
option for the functions is to highlight anything that looks like a
function with the regular expression /[\w._]+(?=\()/  that is any
function name with periods and underscores that is immediately
followed by an open parentheses, or optionally by any number of spaces
then an open parentheses /[\w._]+[ \t]*(?=\()/
-Andrew


On Thu, Sep 9, 2010 at 1:01 PM, Yihui Xie x...@yihui.name wrote:
 Thanks, Tal. It does not look too difficult to write such a brush,
 which is actually a JS file. However, I have a concern that R has
 thousands of functions (in base R only), so it might not worth
 including all of them in the brush, which is the way that they
 implemented the highlighting script for Java and VB (they didn't
 define the list of functions because there are too many). Then what we
 need to do is just to insert a few keywords like TRUE/FALSE/for/while
 in the JS. I would like to contribute 10 minutes on this if nobody
 will pick up this job.

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA



 On Thu, Sep 9, 2010 at 3:02 AM, Tal Galili tal.gal...@gmail.com wrote:
 Hello dear R help members (and also Yihui and Romain),
 There are currently 28 R bloggers (out of the 117 R-bloggers I know of) that
 are using wordpress.com for publishing their R code (and I suspect this
 number will increase with time).
 WordPress.com doesn't support R syntax highlighting, nor can it
 be embedded from other services (like gist git)
 After contacting the WordPress.com vip manager, he instructed me that they
 will add R support if a relevant brush will be created according to this
 document:
 http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html
 Since this is what they use on wordpress.com (see:
 http://en.support.wordpress.com/code/posting-source-code/).
 Creating this brush is beyond my ability at this point, I am writing to ask
 if any of you can/wishes to make this brush for the community.
 Something I thought might be relevant is the code Yihui Xie recently wrote
 for creating a NPPtoR code brush
 (http://yihui.name/en/wp-content/uploads/2010/08/Npp_R_Auto_Completion.r)

 If such a brush will be created, I'll push to have it included in
 wordpress.com and to try and inform the current R bloggers using it.

 Best,
 Tal

 Contact
 Details:---
 Contact me: tal.gal...@gmail.com |  972-52-7275845
 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
 www.r-statistics.com (English)
 --




 __
 R-help@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.


__
R-help@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.


[R] predict.lda breaks when priors are specified

2010-05-16 Thread Andrew Redd
Dear R help,

What am I doing wrong here? when I don't specify the priors it works
just fine but when I specify the priors it breaks.  Does anyone know
why and how I can fix it?

 N=2
 ncontrol=ncases=50
 X - as.matrix(rnorm(N,0,1))
 eta - -5.3 + X * 1.7
 p - exp(eta)/(1+exp(eta))
 Y - rbinom(N,1,p)
 controls - sample(seq_len(N), ncontrol, prob=!Y)
 cases - sample(seq_len(N), ncases, prob=Y)
 data-rbind(
+ data.frame(Y = 0, X = cbind(1,X[controls,])),
+ data.frame(Y = 1, X = cbind(1,X[cases,])))
 head(data)
  Y X.1    X.2
1 0   1  0.6965323
2 0   1 -0.0817520
3 0   1  2.8673412
4 0   1 -0.2351386
5 0   1  0.2653452
6 0   1 -1.2437612
 m - lda(Y~X,subset=c(controls,cases),priors=c(.95,.05))
 predict(m)
Error in model.frame.default(formula = Y ~ X, priors = c(0.95, 0.05),  :
  variable lengths differ (found for '(priors)')
 predict(m,prior=c(.95,0.05))
Error in model.frame.default(formula = Y ~ X, priors = c(0.95, 0.05),  :
  variable lengths differ (found for '(priors)')
---
Thanks,
Andrew

__
R-help@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.


Re: [R] predict.lda breaks when priors are specified

2010-05-16 Thread Andrew Redd
Never mind. Stupid misplaced 's'.
-Andrew

On Sun, May 16, 2010 at 5:39 PM, Andrew Redd ar...@stat.tamu.edu wrote:
 Dear R help,

 What am I doing wrong here? when I don't specify the priors it works
 just fine but when I specify the priors it breaks.  Does anyone know
 why and how I can fix it?
 
 N=2
 ncontrol=ncases=50
 X - as.matrix(rnorm(N,0,1))
 eta - -5.3 + X * 1.7
 p - exp(eta)/(1+exp(eta))
 Y - rbinom(N,1,p)
 controls - sample(seq_len(N), ncontrol, prob=!Y)
 cases - sample(seq_len(N), ncases, prob=Y)
 data-rbind(
 + data.frame(Y = 0, X = cbind(1,X[controls,])),
 + data.frame(Y = 1, X = cbind(1,X[cases,])))
 head(data)
   Y X.1    X.2
 1 0   1  0.6965323
 2 0   1 -0.0817520
 3 0   1  2.8673412
 4 0   1 -0.2351386
 5 0   1  0.2653452
 6 0   1 -1.2437612
 m - lda(Y~X,subset=c(controls,cases),priors=c(.95,.05))
 predict(m)
 Error in model.frame.default(formula = Y ~ X, priors = c(0.95, 0.05),  :
   variable lengths differ (found for '(priors)')
 predict(m,prior=c(.95,0.05))
 Error in model.frame.default(formula = Y ~ X, priors = c(0.95, 0.05),  :
   variable lengths differ (found for '(priors)')
 ---
 Thanks,
 Andrew


__
R-help@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.


[R] Derivative of the probit

2010-05-06 Thread Andrew Redd
Is there a function to compute the derivative of the probit (qnorm) function
in R, or in any of the packages?

Thanks,
-Andrew

[[alternative HTML version deleted]]

__
R-help@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.


[R] Changing the Prompt for browser()

2010-03-05 Thread Andrew Redd
Is there a way that I can change the prompt for within a browser() call.  I
often use use code like

 with(obj1,browser())
Browse[1]

Is there a way that I can set it so that I can get something like

 with(obj1,browser(prompt=obj1))
obj1[1]

I know that prompt is not a valid option for browser, but it would be nice
if it were.   There is an option('prompt)  but that does not affect the
prompt for browser.  Can I change this and how?

Thanks,
Andrew

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] R user defined language file for NotePad++

2009-10-08 Thread Andrew Redd
HI there. nice discussion. I'm the developer for NppToR.  First NppToR
should not make any changes to your workflow in Notepad++.  It should be as
unobtrusive as possible. In fact I use it with several languages daily with
no problems.  If is does get in the way I need to know about it, and please
post on the forums on sourceforge.  If you only want the syntax highlighting
I recommend downloading the executable  version and run the
generateSyntaxFiles.exe.  The advantage there is that it will automatically
integrate the R syntax XML with any other languages that you might have.  If
you insist on having a useDefineLang.xml file here is a direct link to one
of my early versions before I created the syntax generator, which also
extracts keywords from a packages in your library.

http://www.stat.tamu.edu/~aredd/site/sites/default/files/userDefineLang_R.xml

-Andrew Redd

On Thu, Oct 8, 2009 at 8:20 PM, Jason Rupert jasonkrup...@yahoo.com wrote:

 Unfortunately, I need the ability to switch between languages within one
 editor and I like the flexibility and simplicity offered via the NotePad++
 to support other key languages within my current workflow.  Thus, I am
 attempting to limit editor switching and build up skills within one editor.

 ...I suppose the search will need to continue...

 Thank you again for your feedback and suggestions on tracking down
 previously mentioned R Language definition file for NotePad++ under my
 current operating constrains.

 Thanks again.

 --- On Thu, 10/8/09, Remko Duursma remkoduur...@gmail.com wrote:

  From: Remko Duursma remkoduur...@gmail.com
  Subject: Re: [R] R user defined language file for NotePad++
  To: Jason Rupert jasonkrup...@yahoo.com
  Cc: R-help@r-project.org
  Date: Thursday, October 8, 2009, 8:15 PM
  Jason,
 
  if you install NppToR, it generates the XML file for you, I
  think.
  That is one way to get it.
 
  Or, you could use Npptor as is, it not only gives R syntax
  highlighting, but can also send commands to the Rgui
  (simply by
  pressing F8). I have been using it for quite a while and I
  really like
  it.
 
  Remko
 
 
 
  -
  Remko Duursma
  Post-Doctoral Fellow
 
  Centre for Plants and the Environment
  University of Western Sydney
  Hawkesbury Campus
  Richmond NSW 2753
 
  Dept of Biological Science
  Macquarie University
  North Ryde NSW 2109
  Australia
 
  Mobile: +61 (0)422 096908
  www.remkoduursma.com
 
 
 
  On Fri, Oct 9, 2009 at 12:07 PM, Jason Rupert jasonkrup...@yahoo.com
  wrote:
   Thank you very much for the reply, but this doesn't
  appear to be the XML file to load into NotePad++ to use as a
  User Defined Language.
  
   It appears to be an stand-alone executable that
  interacts with NotePad++ and the R GUI.
  
   I guess I will keep looking for a bit and maybe
  breakdown and build the XML and then end up posting it for
  others.
  
   Thanks again.
  
  
  
  
  
   --- On Wed, 10/7/09, Gabor Grothendieck ggrothendi...@gmail.com
  wrote:
  
   From: Gabor Grothendieck ggrothendi...@gmail.com
   Subject: Re: [R] R user defined language file for
  NotePad++
   To: Jason Rupert jasonkrup...@yahoo.com
   Cc: R-help@r-project.org
   Date: Wednesday, October 7, 2009, 10:08 PM
   Check out:
   http://sourceforge.net/projects/npptor/
  
   On Wed, Oct 7, 2009 at 11:04 PM, Jason Rupert
  jasonkrup...@yahoo.com
   wrote:
I am a big fan of NotePad++ (
 http://notepad-plus.sourceforge.net/uk/site.htm),
  which
   allows users to develop an XML schema that allows
  NotePad++
   to be more Language aware.  Thus, I'm curious if
  there are
   any R users out there that may have developed the
  XML user
   defined language for NotePad++.
   
Just curious if there is already one out
  there.
   
Thanks again for any feedback.
   
   
  __
R-help@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.
   
  
  
  
  
  
   __
   R-help@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.
  
 




 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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

Re: [R] portable R editor

2009-03-02 Thread Andrew Redd
Thanks for the plug on NppToR.  Yes it is portable, but a few of the
features don't work. I have it on my plan to have a launcher for the
portable apps menu.  Also the website for NppToR is now
https://sourceforge.net/projects/npptor/

On my personal website I also keep, semi-up-to-date a
portableapps.comcompatible launcher for R.
http://www.stat.tamu.edu/~aredd/site/?q=node/2.  There is a full
installation and just the launcher.  If you download just the launcher you
can install the latest version of R into the bin directory and It will
work.  I think it is version 2.8.0 in the installer.  I'll update that soon.

Andrew Redd

On Mon, Mar 2, 2009 at 8:13 PM, Michael Bibo michael_b...@health.qld.gov.au
 wrote:

 Werner Wernersen pensterfuzzer at yahoo.de writes:

 
 
  Hi,
 
  I have been dreaming about a complete R environment on my USB stick for a
 long time. Now I finally want to
  realize it but what I am missing is a good, portable editor for R which
 has
 tabs and syntax highlighting, can
  execute code, has bookmarks and a little project file management facility
 pretty much like Tinn-R has
  those. I like Tinn-R but it seems like there is only a very old version
 of
 Tinn-R which works standalone.

 Hi Werner,

 Three options:

 I have previously posted about using Emacs + ESS on a USB stick:
 http://finzi.psych.upenn.edu/R/Rhelp02/archive/107419.html

 Tinn-R will work portably.  I have simply copied the installed Tinn-R
 folder
 from one machine to another on which I do not have administrator privileges
 and therefore cannot do a normal install.

 Another option is Notepad++ (http://notepad-
 plus.sourceforge.net/uk/site.htm).  There is even a portable version
 available
 fom www.portableapps.com.  Andrew Redd has created (and is continuing to
 develop) NppToR 
 (http://www.stat.tamu.edu/~aredd/site/?q=node/37http://www.stat.tamu.edu/%7Earedd/site/?q=node/37)
 which
 provides syntax highlighting, code folding and code passing to R.
  Notepad++
 has a tabbed interface as well as add-ons including a file explorer,
 windows
 manager and multiclipboard manager.  It also allows for the recording of
 macros, and the instructions found at this blog
 (http://aztecpassage.blogspot.com/2007/11/load-new-file-from-template-in-
 notepad.htmlhttp://aztecpassage.blogspot.com/2007/11/load-new-file-from-template-in-%0Anotepad.html)
 use Notepad++'s built-in capacity to run external tools to
 create new files from templates.


 Michael Bibo
 Queensland Health

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


[R] Rf_error crashes entire program.

2008-07-28 Thread Andrew Redd
I'm having a problem with the error and warning functions.  I've tried this
on multiple machine so I'm fairly sure it's not machine dependent and I've
tried it on the latest versions 2.6.0-2.7.1.  Whenever my program gets to an
error or warning it crashes the entire program rather than throwing the
error like it should.

Here are the relevant bits.

...
char const * const ExeedsMinVarianceError = PFDA ERR: Near zero
variance encountered.  Estimation Unstable. Terminating Estimation.;

if(debug){printf(Da:\n);printmat(DaOld,1,*ka);fflush(stdout);}
daxpy_(ka, mOne, Da, one, DaOld, one);
for(i=0;i*ka;i++)convergenceCriteria+=fabs(DaOld[i]);
if(Da[*ka]  MinVariance){
printf(PING);fflush(stdout);
warning(ExeedsMinVarianceError);
break;
}

and the output from running in batch mode that I get is this:
Da:
0.18034.988e-017

PING
and here the program crashes.   I've tried this in multiple places and
sometimes the error is thrown sometimes not.  Does anyone have an idea of
what is going on.  I could not find any discussion of this error yet.
Thank you,
Andrew Redd

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Rf_error crashes entire program.

2008-07-28 Thread Andrew Redd
Switching all of my printfs to Rprintf fixed the problem the errors now
proceed correctly.  I was unable to reproduce the error, but now that is
irrelevant, at least to me.  Thanks for the help.
-Andrew

[[alternative HTML version deleted]]

__
R-help@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.