Re: [R] Difficulty Compiling RSQLite on Solaris x86 Using Studio 12 Compilers

2007-10-31 Thread Prof Brian Ripley
This isn't really an appropriate forum, and the problem seems to be 
related to how you built R (why is dmake being used?)

I've just tried RSQLite on our x86_64 Solaris 10 box (as far as I know 
SunOS 5.11 is not yet released but a preview), and it worked out of the 
box.

You need help from someone familiar with your OS installation: this is 
neither an R nor a generic Solaris issue.

On Tue, 30 Oct 2007, Aric Gregson wrote:

 Apologies if this is not the best list on which to ask for help. I have
 compiled R 2.6.0 using Sun Studio 12 compilers. I can install most CRAN
 and bioconductor packages that I need, with the exception of RSQLite.
 Unfortunately this is critical for other packages that I need. I have
 tried to compile it using R CMD INSTALL to generate a config.log file.
 I don't know how to fix the reported error. I have tried commenting
 out most of the test language in the configure file, but then there are
 other complaints.

 I used Studio 12 to build 2.5.1 and it worked perfectly. The only issue
 with the 2.6.0 build is that 'make test' fails and this did not happen
 with 2.5.1. However, it appears to run fine.

What is 'make test'?  We recommend 'make check', and it should work on a 
properly set up Solaris system.

 Any ideas of how I can get RSQLite to compile? Or is there another list
 to which I should address my question.

 thanks,

 aric

 Here is an except from the config.log:
 
 /usr/bin/uname -p = i386
 /bin/uname -X = System = SunOS
 Node = solenv
 Release = 5.11
 KernelID = snv_69
 Machine = i86pc

 ## --- ##
 ## Core tests. ##
 ## --- ##

 configure:1313: checking for gcc
 configure:1339: result: dmake: defaulting to parallel mode.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 /opt/studio12/SUNWspro/bin/cc -m64
 configure:1583: checking for C compiler version
 configure:1586: dmake: defaulting to parallel mode.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 /opt/studio12/SUNWspro/bin/cc -m64 --version /dev/null 5
 ./configure: line 1587: dmake:: command not found
 configure:1589: $? = 127
 configure:1591: dmake: defaulting to parallel mode.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 /opt/studio12/SUNWspro/bin/cc -m64 -v /dev/null 5
 ./configure: line 1592: dmake:: command not found
 configure:1594: $? = 127
 configure:1596: dmake: defaulting to parallel mode.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 /opt/studio12/SUNWspro/bin/cc -m64 -V /dev/null 5
 ./configure: line 1597: dmake:: command not found
 configure:1599: $? = 127
 configure:1622: checking for C compiler default output file name
 configure:1625: dmake: defaulting to parallel mode.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 /opt/studio12/SUNWspro/bin/cc -m64 dmake: defaulting to parallel mode.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 -xO5 -xc99 -xlibmieee -xlibmil -nofstore   conftest.c  5
 ./configure: line 1626: dmake:: command not found
 configure:1628: $? = 127
 configure: failed program was:
 | /* confdefs.h.  */
 |
 | #define PACKAGE_NAME 
 | #define PACKAGE_TARNAME 
 | #define PACKAGE_VERSION 
 | #define PACKAGE_STRING 
 | #define PACKAGE_BUGREPORT 
 | /* end confdefs.h.  */
 |
 | int
 | main ()
 | {
 |
 |   ;
 |   return 0;
 | }
 configure:1667: error: C compiler cannot create executables
 See `config.log' for more details.

 ## - ##
 ## Output variables. ##
 ## - ##

 -xO5 -xc99 -xlibmieee -xlibmil -nofstore'
 /opt/studio12/SUNWspro/bin/cc -m64'
 /opt/studio12/SUNWspro/bin/cc -m64'
 CC='dmake: defaulting to parallel mode.
 CFLAGS='dmake: defaulting to parallel mode.
 CPP=''
 CPPFLAGS=''
 DEFS=''
 ECHO_C=''
 ECHO_N='-n'
 ECHO_T=''
 EXEEXT=''
 LDFLAGS=''
 LIBOBJS=''
 LIBS=''
 LTLIBOBJS=''
 OBJEXT=''
 PACKAGE_BUGREPORT=''
 PACKAGE_NAME=''
 PACKAGE_STRING=''
 PACKAGE_TARNAME=''
 PACKAGE_VERSION=''
 PATH_SEPARATOR=':'
 PKG_CPPFLAGS=''
 PKG_LIBS=''
 SHELL='/bin/bash'
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 See the man page dmake(1) for more information on setting up
 the .dmakerc file.
 ac_ct_CC='dmake: defaulting to parallel mode.
 bindir='${exec_prefix}/bin'
 build_alias=''
 datadir='${prefix}/share'
 exec_prefix='NONE'
 host_alias=''
 includedir='${prefix}/include'
 infodir='${prefix}/info'
 libdir='${exec_prefix}/lib'
 libexecdir='${exec_prefix}/libexec'
 localstatedir='${prefix}/var'
 mandir='${prefix}/man'
 oldincludedir='/usr/include'
 prefix='NONE'
 program_transform_name='s,x,x,'
 sbindir='${exec_prefix}/sbin'
 sharedstatedir='${prefix}/com'
 sysconfdir='${prefix}/etc'
 target_alias=''

 ## --- ##
 ## confdefs.h. ##
 ## --- ##

 

Re: [R] DBI Package

2007-10-31 Thread Prof Brian Ripley

On Wed, 31 Oct 2007, Germán Carrillo wrote:


Hello everyone!

Congratulations by this gorgeous software.

My name is Germán Carrillo, I'm writting from Colombia. I don't have much
experience with R, reason why I use the R-GUI (version 2.5.1) on Windows.

I have some problems with DBI package, I want to connect to PostgreSQL
database but I don't know the way to do it.


As far as I am aware DBI does not currently have a PostgreSQL driver.  To 
connect to PostgreSQL you can use RODBC (easy) or RdbiPgSQL (and Rdbi) 
from Bioconductor, which uses a precursor to DBI.  Unfortunately, I don't 
see a Windows binary for RdbiPgSQL on the Bioconductor site so you would 
need to compile it from sources (not easy).



I was reading the DBI manual and I tried write in my R Console the next
command:

pg - dbDriver(PostgreSQL)

But R says:
Error en do.call(as.character(drvName), list(...)) :
   no se pudo encontrar la función PostgreSQL

I don't know what's happen, I would like to receive some help about this
topic, I was looking for in the internet but there's few documentation about
this package.


Thanks in advance.

Best regards.

Pdt: Sorry by my english, I'm learning... :)





--
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__
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] Odp: Fwd: data format

2007-10-31 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 30.10.2007 21:49:37:

 Excuse me for less detailed e-mail I've sent before, I guess there's a
 misunderstanding here.

And still is. You even did not show us how are your data stored in R.

 My problem is to use the data in the order I've typed below without
 splitting it. Is it possible? I really don't know. Some statistics 
packages
 do it.
 
 Original Data is;
 
 Good,Bad
 10,12
 15,15
 18,10
 12
 
 
 
 But I have the data in the following form,
 Label,Value
 Good,10
 Bad,12
 Good,15
 Good,18
 Good,12
 Bad,15
 Bad,10

If you have data frame test like this you can do:

selection-test$Label==Good
ks.test(test[selection,2], test[!selection,2])

or

test.s-split(test$Value, test$Label)
ks.test(test.s[[1]], test.s[[2]])

If you prefer you can use selection or split inside *.test functions, 
however it seems to me that separated version is more readable.

I also wander why you so much resist to split data into list? It is quite 
natural way how to handle them and R is pretty good in work with lists 
with its *apply functions.

Regards
Petr

 
 
 And I want to analyze the data without splitting it. I guessed whether
 there's a quick/simple solution to my problem. Array functions do solve 
this
 problem in general.  Now I'm reading the help files about How to deal 
with
 arrays in R environment?.
 
 Thx a lot for your concern
 Emre
 
 
 
 
 
 -- Forwarded message --
 From: Emre Unal [EMAIL PROTECTED]
 Date: Oct 30, 2007 4:39 PM
 Subject: data format
 To: r-help@r-project.org
 
 Hi,
 
 How can I analyze the data collected in database formatting (with 
labels)
 rather than splitted by individual columns (almost in excel)?
 
 For example (comma separated data);
 
 Label,Value
 Good,10
 Bad,12
 Good,15
 Good,18
 Good,12
 Bad,15
 Bad,10
 etc...
 
 ks.test or chisq.test can be done.
 Splitting the data into new columns is not applicable cos' I'll use
 R-integration in another software.
 
 
 
 Thanks for your concern
 Emre
 
 
 
 
 
 
 
 
 
 -- 
 ---
 Emre ÜNAL
 
 
 
 -- 
 ---
 Emre ÜNAL
 http://www.geocities.com/dusemre
 http://dusemre.blogspot.com
 ICQ: 5712269
 
[[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-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] strwidth of bold font

2007-10-31 Thread Paul Murrell
Hi


Henrique Dallazuanna wrote:
 Perhaps:
 
 strwidth(expression(bold(text)))


Or set the default font face ...

plot(1:10)
text(4, 6, testing, adj=c(0, 0))
segments(4, 6, 4 + strwidth(testing), 6, col=red)
par(font=2)
text(4, 8, testing, adj=c(0, 0))
segments(4, 8, 4 + strwidth(testing), 8, col=red)

Paul


 On 30/10/2007, Roland Kaiser [EMAIL PROTECTED] wrote:
 Hi!

 Is there a way to get the string width of the bold typefaces?

 like: strwidth(text, family = serif, font = 2).

 Thanks

 Roland

 __
 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.


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
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] error in display function of the ARM package

2007-10-31 Thread Kari Ruohonen
Hi,

I get the following error message when trying to use the display
function on the ARM package:

 display(model)
Error in .Internal(round(x, digits)) : no internal function round

Looks like some kind of mismatch between the ARM package and some
others? Can I somehow get around it? I have learned to like the display
function to print model summaries.

Here is my sessionInfo():

 sessionInfo()
R version 2.6.0 (2007-10-03) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;
LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;
LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods
base 

other attached packages:
[1] foreign_0.8-23car_1.2-5 arm_1.0-34
R2WinBUGS_2.1-6  
[5] coda_0.12-1   lme4_0.99875-9Matrix_0.999375-3
lattice_0.17-2   
[9] MASS_7.2-37  

loaded via a namespace (and not attached):
[1] grid_2.6.0

Thanks, Kari

__
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] error in display function of the ARM package

2007-10-31 Thread Prof Brian Ripley
On Wed, 31 Oct 2007, Kari Ruohonen wrote:

 Hi,

 I get the following error message when trying to use the display
 function on the ARM package:

You seem to mean 'arm' not 'ARM'.

 display(model)
 Error in .Internal(round(x, digits)) : no internal function round

 Looks like some kind of mismatch between the ARM package and some
 others?

You mayneed to reinstall your packages under R 2.6.0, in particular 
Matrix: see https://stat.ethz.ch/pipermail/r-help/2007-October/142367.html
This is a symptom of not doing so.

Without reproducible code we can't tell if there is anything else amiss.


  Can I somehow get around it? I have learned to like the display
 function to print model summaries.

 Here is my sessionInfo():

 sessionInfo()
 R version 2.6.0 (2007-10-03)
 i486-pc-linux-gnu

 locale:
 LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;
 LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;
 LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods
 base

 other attached packages:
 [1] foreign_0.8-23car_1.2-5 arm_1.0-34
 R2WinBUGS_2.1-6
 [5] coda_0.12-1   lme4_0.99875-9Matrix_0.999375-3
 lattice_0.17-2
 [9] MASS_7.2-37

 loaded via a namespace (and not attached):
 [1] grid_2.6.0

 Thanks, Kari

-- 
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

__
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] Biostatics position

2007-10-31 Thread Marwan Khawaja
Dear All,
Please respond to my personal email in case of queries -- not on the list at
the moment.
Best Marwan


The Faculty of Health Sciences of the American University of Beirut
currently seeks for its Department of Epidemiology and Population Health a
candidate with a Ph.D. degree in Biostatistics, or a related discipline with
strong methodological background. Experience in health research is strongly
valued.  

This position is available at the ranks of assistant, associate or full
professor depending on qualifications.  Visiting positions at all levels may
be considered. 
 
The Faculty of Health Sciences (FHS) offers MPH and MS degrees and
contributes public health courses to the MD program at the Faculty of
Medicine. It also offers undergraduate degrees in Health Sciences.  The
language of instruction is English. For more information please visit
http:// fhs.aub.edu.lb

Interested candidates should submit a complete resume, statement of teaching
and research interests and three letters of reference to: 

Huda Zurayk, Dean, Faculty of Health Sciences, American University of
Beirut,
3 Dag Hammarskjold Plaza, 8th Floor, New York, NY 10017-2303.  Fax in Beirut
+961-1-744470. Electronic submissions may be sent to [EMAIL PROTECTED] 

Deadline for receipt of applications is December 31, 2007 for a starting
date of September 15, 2008

The American University of Beirut is an Affirmative Action/Equal Opportunity
Employer.

--
Marwan Khawaja, Ph.D.
Professor  Director
Center for Research on Population  Health
American University of Beirut
P.O. Box 11-0236, Riad El Solh
Beirut 1107 2020 Lebanon

Email: [EMAIL PROTECTED]
Url: http://staff.aub.edu.lb/~webcrph
Tel: +961 1 35 00 00 ext. 4668
Fax: +961 1 74 44 70

__
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] NAIVE BAYES with 10-fold cross validation

2007-10-31 Thread Julia Kröpfl
thx for your help,

i checked the caret package out and the tuning works. but i can't find a way to 
make a contingency table in order to see the classification result.

e.g. like:

table(outcome NaiveBayes, mydata$code)

Is there something like that?

Julia

 Original-Nachricht 
 Datum: Tue, 30 Oct 2007 17:03:49 -0400
 Von: Kuhn, Max [EMAIL PROTECTED]
 An: Julia Kröpfl [EMAIL PROTECTED], r-help@r-project.org
 Betreff: RE: [R] NAIVE BAYES with 10-fold cross validation

  am trying to implement the code of the e1071 package for naive bayes, 
  but it doens't really work, any ideas??
  am very glad about any help!!
  need a naive bayes with 10-fold cross validation:
 
 The caret package will do this. Use
 
  fit - train(
x, y, method = nb, 
trControl = trainControl(method = cv, number = 10))
 
 (there is no formula interface yet).
 
 It will use the naïve Bayes implementation in klaR. Unless you specify
 otherwise, it will train naïve Bayes models with and without using kernel
 density estimation (but you can change that). 
 
 The object fit$finalModel will contain the model fit that is cv optimal.
 
 For example:
 
   fit - train(
  +iris[,-5], iris$Species, nb, 
  +trControl = trainControl(method = cv, number = 10))
  Iter 1  Values: TRUE 
  Loading required package: MASS
  Loading required package: class
  Iter 2  Values: FALSE 
   
   fit
  
  Call:
  train.default(x = iris[, -5], y = iris$Species, method = nb, 
  trControl = trainControl(method = cv, number = 10))
  
  150 samples
  4 predictors
  
  summary of cross-validation (10 fold) sample sizes:
  135, 135, 135, 135, 135, 135, ... 
  
  cv resampled training results across tuning parameters:
  
usekernel  Accuracy  Kappa  Accuracy SD  Kappa SD  Optimal
FALSE  0.953 0.93   0.0706   0.106
TRUE   0.96  0.94   0.0562   0.0843*  
  
  Accuracy was used to select the optimal model
  
 
 Max
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Julia Kröpfl
 Sent: Tuesday, October 30, 2007 4:46 PM
 To: r-help@r-project.org
 Subject: [R] NAIVE BAYES with 10-fold cross validation
 
 hi there!!
 
 i am trying to implement the code of the e1071 package for naive bayes,
 but it doens't really work, any ideas??
 i am very glad about any help!!
 i need a naive bayes with 10-fold cross validation:
 
 code:
 library(e1071)
 
 model - naiveBayes(code ~ ., mydata)
 
 tune.control - tune.control(random = FALSE, nrepeat = 1, repeat.aggregate
 = min,
 sampling = c(cross), sampling.aggregate = mean,
 cross = 10, best.model = TRUE, performances = TRUE)
 
 pred - predict(model, mydata[,-12], type=class)
 tune(naiveBayes, code~., mydata, predict.fun=pred, tune.control)
 
 
 thx for your help!
 cheers, julia
 --
 
 __
 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.

-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

__
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] drawing direction fields

2007-10-31 Thread Jim Lemon
Jong-Hoon Kim wrote:
 Dear useRs,
 
 I am trying to draw direction fields for some differential equations.
 So for I couldn't find much information on that.  Could anybody give
 me a hint how to draw a direction field using R?
 
Hi Jong-Hoon,

Here's a start on a function.

direction.field-function(dydx,xlim=c(-1,1),ylim=c(-1,1),
  nxarrows=20,nyarrows=20,length=NA) {

  xinc-diff(xlim)/(nxarrows*2)
  yinc-diff(ylim)/(nyarrows*2)
  if(is.na(length)) length-par(pin)[1]/100
  plot(0,xlim=xlim,ylim=ylim,type=n)
  for(x in seq(xlim[1]+xinc,xlim[2]-xinc,length=nxarrows)) {
   for(y in seq(ylim[1]+yinc,ylim[2]-yinc,length=nyarrows)) {
stan-atan(eval(parse(text=dydx)))
arrows(x-xinc*cos(stan),y-yinc*sin(stan),
 x+xinc*cos(stan),y+yinc*sin(stan),
 length=length)
   }
  }
}
direction.field(0*x+1*y)

Jim

__
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] strwidth of bold font

2007-10-31 Thread Roland Kaiser


 Hi


 Henrique Dallazuanna wrote:
 Perhaps:
 strwidth(expression(bold(text)))


 Or set the default font face ...

Thanks!
Things can often be so easy!

Roland


 plot(1:10)
 text(4, 6, testing, adj=c(0, 0))
 segments(4, 6, 4 + strwidth(testing), 6, col=red)
 par(font=2)
 text(4, 8, testing, adj=c(0, 0))
 segments(4, 8, 4 + strwidth(testing), 8, col=red)

 Paul


 On 30/10/2007, Roland Kaiser [EMAIL PROTECTED] wrote:
 Hi!

 Is there a way to get the string width of the bold typefaces?

 like: strwidth(text, family = serif, font = 2).

 Thanks

 Roland

 __
 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.


 -- 
 Dr Paul Murrell
 Department of Statistics
 The University of Auckland
 Private Bag 92019
 Auckland
 New Zealand
 64 9 3737599 x85392
 [EMAIL PROTECTED]
 http://www.stat.auckland.ac.nz/~paul/

__
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] reversing the scale on ggplot

2007-10-31 Thread Pedro de Barros
Dear All,


I am trying to build a simple ggplot, but where the scale is 
reversed, i.e. the largest numbers are on the bottom.
An example of the code I am using is

  plotdata-data.frame(x=1:10, y=runif(10))
  plot-ggplot()
  plot-plot+layer(data=plotdata, mapping=aes_string(x='x',y='y'), 
geom='point', stat='identity', size=4)
  plot-plot+ scale_y_continuous(limits=c(1,0))
  print(plot)
I was hoping that by reversing the limits argument I would obtain the 
result I wanted, but to no avail. I have searched the ggplot help and 
the archives, but cannot find the answer to this issue.
I would really appreciate if anyone could give me a pointer.

I am using R2.6.0 (patched) on Windows

Thanks,
Pedro

__
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] pdf() device uses fonts to represent points - data alteration?

2007-10-31 Thread Paul Murrell
Hi


jiho wrote:
 Hello all,
 
 I discovered that the pdf device uses fonts to represent points  
 symbols (as in plot(...,type=p,...) ). Namely it uses ZapfDingbats  
 with symbol U+25cf. This can lead to problems when the font is not  
 available, or available in another version (such as points being  
 replaced by other symbols, or worst: slightly displaced).  
 Furthermore, it also causes problems when opening the pdf files for  
 editing in other programs. I know that for reproducibility one should  
 avoid doing this but there are cases where R is simply not suited to  
 produce the end result graphic directly using code (Ex: replace some  
 colors by CMYK versions for color consistency in print). In addition,  
 publishers also often like being able to retouch graphics to ensure  
 fonts consistency or such, and this will be destructive in the case  
 of these pdfs. For example, Inkscape interprets points as squares  
 (more like U+2751 in ZapfDingbats) and Adobe Illustrator does not  
 even recognize the font (substituting AdobePiStd).
 I tried to embed fonts with embedFonts() but his does not solves the  
 issue with editing (Inkscape produces a kind of star and AI still  
 chokes on the font) and worst, it modifies how the original graphic  
 renders in pdf viewers: the circles are now filled (I believe this is  
 because this is the default state of the ZapfDingbats character).
 
 So my questions are:
 - does anyone have a work around this?
 - why can't the pdf device use shapes instead of fonts to represent  
 data point? It would appear as a much more robust approach and would  
 ensure that the points are rendered the same everywhere. Font  
 substitution in axes labels is not as bad since it does not modify  
 the data itself (at worst the labels are offset a little bit) but  
 font substitution on the data points can really harm the graphic.


If I recall correctly, the PDF device uses a character for small circles 
because that looks better.  There is no PDF circle primitive, so circles 
have to be drawn using bezier curves.  The original author may be able 
to elaborate on that.

Two suggestions for workarounds:
(i)  produce PostScript and then convert to PDF using something like 
ghostscript (e.g., ps2pdf)
(ii)  use an almost-but-not-quite opaque colour, e.g., rgb(0, 0, 0, .99) 
for the points.  If the points are not fully opaque, the character is 
not used.

Paul


 Examples of code:
   pdf(test.pdf)
   plot(0,0,xlab=,ylab=,bty=n,xaxt=n,yaxt=n); grid(lty=1);
   dev.off()
   embedFonts(test.pdf,pdfwrite,test_embed.pdf)
 
 visualize the fonts:
   pdffonts test.pdf
 
 and a package with the two pdf files and bitmaps of how they render  
 or are interpreted in various programs:
   http://jo.irisson.free.fr/dropbox/test_R_pdf_fonts.zip
 
 Thank you in advance for your attention and help.
 
 JiHO
 ---
 http://jo.irisson.free.fr/
 
 __
 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.


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
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] error in display function of the ARM package

2007-10-31 Thread Kari Ruohonen
Thank you very much for the answer. Re-installation (I did a full
reinstall of R and packages I use) helped and cured the problem. I had
somehow missed the advice to re-install packages when upgrading to 2.6.0
and had only used update.packages().

regards, Kari


On Wed, 2007-10-31 at 09:30 +, Prof Brian Ripley wrote:
 On Wed, 31 Oct 2007, Kari Ruohonen wrote:
 
  Hi,
 
  I get the following error message when trying to use the display
  function on the ARM package:
 
 You seem to mean 'arm' not 'ARM'.
 
  display(model)
  Error in .Internal(round(x, digits)) : no internal function round
 
  Looks like some kind of mismatch between the ARM package and some
  others?
 
 You mayneed to reinstall your packages under R 2.6.0, in particular 
 Matrix: see https://stat.ethz.ch/pipermail/r-help/2007-October/142367.html
 This is a symptom of not doing so.
 
 Without reproducible code we can't tell if there is anything else amiss.
 
 
   Can I somehow get around it? I have learned to like the display
  function to print model summaries.
 
  Here is my sessionInfo():
 
  sessionInfo()
  R version 2.6.0 (2007-10-03)
  i486-pc-linux-gnu
 
  locale:
  LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;
  LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;
  LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
 
  attached base packages:
  [1] stats graphics  grDevices utils datasets  methods
  base
 
  other attached packages:
  [1] foreign_0.8-23car_1.2-5 arm_1.0-34
  R2WinBUGS_2.1-6
  [5] coda_0.12-1   lme4_0.99875-9Matrix_0.999375-3
  lattice_0.17-2
  [9] MASS_7.2-37
 
  loaded via a namespace (and not attached):
  [1] grid_2.6.0
 
  Thanks, Kari


__
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] pdf() device uses fonts to represent points - data alteration?

2007-10-31 Thread jiho
Thank you very much for your answer, even so long after I first  
posted the message.

On 2007-October-31  , at 12:00 , Paul Murrell wrote:
 Hi

 jiho wrote:
 Hello all,
 I discovered that the pdf device uses fonts to represent points   
 symbols (as in plot(...,type=p,...) ). Namely it uses  
 ZapfDingbats  with symbol U+25cf. This can lead to problems when  
 the font is not  available, or available in another version (such  
 as points being  replaced by other symbols, or worst: slightly  
 displaced).  Furthermore, it also causes problems when opening the  
 pdf files for  editing in other programs. I know that for  
 reproducibility one should  avoid doing this but there are cases  
 where R is simply not suited to  produce the end result graphic  
 directly using code (Ex: replace some  colors by CMYK versions for  
 color consistency in print). In addition,  publishers also often  
 like being able to retouch graphics to ensure  fonts consistency  
 or such, and this will be destructive in the case  of these pdfs.  
 For example, Inkscape interprets points as squares  (more like U 
 +2751 in ZapfDingbats) and Adobe Illustrator does not  even  
 recognize the font (substituting AdobePiStd).
 I tried to embed fonts with embedFonts() but his does not solves  
 the  issue with editing (Inkscape produces a kind of star and AI  
 still  chokes on the font) and worst, it modifies how the original  
 graphic  renders in pdf viewers: the circles are now filled (I  
 believe this is  because this is the default state of the  
 ZapfDingbats character).
 So my questions are:
 - does anyone have a work around this?
 - why can't the pdf device use shapes instead of fonts to  
 represent  data point? It would appear as a much more robust  
 approach and would  ensure that the points are rendered the same  
 everywhere. Font  substitution in axes labels is not as bad since  
 it does not modify  the data itself (at worst the labels are  
 offset a little bit) but  font substitution on the data points can  
 really harm the graphic.

 If I recall correctly, the PDF device uses a character for small  
 circles because that looks better.  There is no PDF circle  
 primitive, so circles have to be drawn using bezier curves.  The  
 original author may be able to elaborate on that.

OK. I was suspecting that PDF did not have circle primitives indeed.  
That's a good reason.

 Two suggestions for workarounds:
 (i)  produce PostScript and then convert to PDF using something  
 like ghostscript (e.g., ps2pdf)
 (ii)  use an almost-but-not-quite opaque colour, e.g., rgb(0, 0,  
 0, .99) for the points.  If the points are not fully opaque, the  
 character is not used.

(ii) is really good to know (and I would probably never have found it  
myself). (i) is not applicable since I use PDF to keep transparency.

Thanks for your help. I still think that not using fonts at all  
should be preferred because really strange things can happen with  
fonts while bezier curves are robust and do not depend at all on the  
rest of the OS. In this precise matter, robustness is probably to be  
preferred over appearance, since it involves the data directly.  
Anyway, I'm fine now with your workaround. I should file a bug report  
for this to be solved in a future release maybe.

JiHO
---
http://jo.irisson.free.fr/

__
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] Performance of concatenating strings

2007-10-31 Thread Tamara Steijger
Hi,

I would like to ask how the paste(S1, S2, sep=) function internally  
works. Are the two stings copied to a new String?

I have a program where successively strings are build up. First the  
program calls an external function and depending on the result it  
builds up strings to visualize the result. The external function is  
really fast, also for huge input data. But the building of the  
strings takes much to long for huge input sizes. So I'm wondering if  
the concatenating could be the problem, like using String in Java  
instead of StringBuffer. Is there something like StringBuffers in R  
also?

Thanks,
T. Steijger

__
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] cbind()

2007-10-31 Thread Henrique Dallazuanna
Hi
Perhaps:

Hi,

Try this:

do.call(rbind, lapply(a, function(x)do.call(cbind, x)))

On 31/10/2007, livia [EMAIL PROTECTED] wrote:


 Hello,

 I would like to use the cbind() function to construct a matrix used in the
 middle of a function as following

 for (i in 1:1000) {
 b[i] - function(cbind(a[[1]][[i]],
 a[[2]][[i]],a[[3]][[i]],...a[[67]][[i]]))
 }


 Is there an easy way of achieving this rather than cbind every column?
 --
 View this message in context:
 http://www.nabble.com/cbind%28%29-tf4724534.html#a13507633
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] cbind()

2007-10-31 Thread Duncan Murdoch
On 10/31/2007 8:06 AM, livia wrote:
 Hello,
 
 I would like to use the cbind() function to construct a matrix used in the
 middle of a function as following
 
 for (i in 1:1000) {
 b[i] - function(cbind(a[[1]][[i]],
 a[[2]][[i]],a[[3]][[i]],...a[[67]][[i]]))
 }
 
 
 Is there an easy way of achieving this rather than cbind every column? 

What you're doing is a little complicated (taking the i'th element out 
of elements 1:67 in a list), so the solution is bound to be a little 
complicated too.  But something like this will save you typing:

# construct a list of the i'th elements
ithelements - lapply(a[1:67], function(e) e[[i]])

# pass them as args to cbind
do.call(cbind, ithelements)

I haven't tested this (not having your data at hand), but if it doesn't 
work, something like it should.

Duncan Murdoch

__
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] drawing direction fields

2007-10-31 Thread Jong-Hoon Kim
Dear useRs,

I am trying to draw direction fields for some differential equations.  So
for I couldn't find much information on that.  Could anybody give me a hint
how to draw a direction field using R?

-- 
734 274 2394
Jong-Hoon Kim

[[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] ylim in barplot2 function?

2007-10-31 Thread Dieter Vanderelst
Hi list,

I'm using barplot2 form the gplots package to plot a few numbers (I want to add 
SD bars later).

However, I would like the y-axis not to start from 0 but 500. When I add the 
parameters YLIM, something goes wrong. The graph is not 'cut off' at 500. 
Instead the bars seems to sink trough the bottom of the graph.

Because its a little hard to explain, here is a self-containing example:


library(gplots)

ABrt-c(588,589,593,588)
Wrt-c(580,583,592,612)

RT-rbind(ABrt,Wrt)
barplot2(RT,beside=T,col=c('black','white'),ylim=c(500,1000))

Does anybody know of a solution?

Regards,
Dieter

--
Dieter Vanderelst

dieter _ vanderelst AT emailengine DOT org
d DOT vanderelst AT tue DOT nl

Eindhoven University of Technology
Faculty of Industrial Design
Designed Intelligence Group
Den Dolech 2
5612 AZ Eindhoven
The Netherlands
Tel +31 40 247 91 11

__
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] timezone conversion difficulties with the new US daylight saving time switch over

2007-10-31 Thread Tony Plate
Mike Waters wrote:
 Tony Plate wrote:
 [...]
 You don't say if this an R-specific problem, or if it afflicts your 
 computer system clock as well.

Thanks, I should have noted that my computer system clock is fine, and as
far as I can tell it (correctly) believes we are still in Daylight 
Saving mode.
It did not incorrectly fall back last Sunday at the date that would have 
been
the end of Daylight Saving under the old rules.

In case it matters, I do have a program running on my computer that
synchronizes time: Domain Time II version 3.1.b.20040724R

-- Tony Plate

__
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] NAIVE BAYES with 10-fold cross validation

2007-10-31 Thread Kuhn, Max
Julia,

 i checked the caret package out and the tuning works. but i 
 can't find a way to make a contingency table in order to 
 see the classification result.

You should read the vignettes for the package at:

   http://cran.r-project.org/src/contrib/Descriptions/caret.html

these have the details for caret. There are many other methods. Typing

   help.search(confusion)

yields four different implementations on my system. 

Looking at your email, you need to read something about basic predict methods. 
Please read ?predict.NaiveBayes

Max

__
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] ylim in barplot2 function?

2007-10-31 Thread John Kane
I'm not sure exactly why it won't work but it could be
that conceptually a bar plot starting at 500 does not
make a lot of sense and the package writers did not
entertain such an idea?

I'd suggest having a look at ?dotchart as an
alternative why to plot the data or perhaps have a
look at errplot() in Hmisc.  

If you really need a barplot you might have a look at
gap.barplot in plotrix.  


--- Dieter Vanderelst
[EMAIL PROTECTED] wrote:

 Hi list,
 
 I'm using barplot2 form the gplots package to plot a
 few numbers (I want to add SD bars later).
 
 However, I would like the y-axis not to start from 0
 but 500. When I add the parameters YLIM, something
 goes wrong. The graph is not 'cut off' at 500.
 Instead the bars seems to sink trough the bottom of
 the graph.
 
 Because its a little hard to explain, here is a
 self-containing example:
 
 
 library(gplots)
 
 ABrt-c(588,589,593,588)
 Wrt-c(580,583,592,612)
 
 RT-rbind(ABrt,Wrt)

barplot2(RT,beside=T,col=c('black','white'),ylim=c(500,1000))
 
 Does anybody know of a solution?
 
 Regards,
 Dieter
 
 --
 Dieter Vanderelst
 
 dieter _ vanderelst AT emailengine DOT org
 d DOT vanderelst AT tue DOT nl
 
 Eindhoven University of Technology
 Faculty of Industrial Design
 Designed Intelligence Group
 Den Dolech 2
 5612 AZ Eindhoven
 The Netherlands
 Tel +31 40 247 91 11
 
 __
 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] Splitting up the micEcon package?

2007-10-31 Thread Millo Giovanni
Dear Arne and Ott-Siim,

my personal opinion is that one single package is easiest both for the
useR who wants to keep track of the add-ins he might need and for the
maintainer(s) of the relevant Task Views. I'd prefer to have one single
micEcon as long as I know that I've to look there both for micro demand
models and for sample selection. Moreover, I feel they fit together
nicely from a broad econometric viewpoint (if this means anything).
Of course, if splitting the package up means easing the maintenance
burden in any way, we'll just keep track of one more package... :^) 

Best regards and many thanks for your effort
Giovanni

Giovanni Millo
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 4, 
34131 Trieste (Italy)
tel. +39 040 671184 
fax  +39 040 671160 

#
Original message:

Message: 34
Date: Tue, 30 Oct 2007 18:44:12 +0200
From: Arne Henningsen [EMAIL PROTECTED]
Subject: [R] Splitting up the micEcon package?
To: r-help@r-project.org
Cc: Ott-Siim Toomet [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Dear R Users:

The functions of our micEcon package [1,2] can be subdivided into
three 
categories:
- microeconomic demand and firm models
- sample selection models (mainly selection())
- routines for (likelihood) maximisation (e.g. maxLik(), maxNR(),
maxBHHH())
   (mainly used for ML estimation of sample selection models)

Although sample selection models are often used in microeconomic
analyses, 
they are also used in several other disciplines. Therefore, we are
unsure 
whether it is better to keep these different functionalities in the
micEcon 
package or to move the sample selection models and the routines for 
(likelihood) maximisation into one or two new package(s) (increasing the
long 
list of R packages even further).
What is the recommendation of the R community?

Thank you,
Ott  Arne

Note: We have asked this question already on R-devel five days ago [3], 
but we did not receive an answer yet.

References:
[1] http://cran.r-project.org/src/contrib/Descriptions/micEcon.html
[2] http://www.micecon.org/
[3] http://tolstoy.newcastle.edu.au/R/e3/devel/07/10/0222.html

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
[EMAIL PROTECTED]
http://www.uni-kiel.de/agrarpol/ahenningsen/


 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:13}}

__
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] forecasting multiple regression model

2007-10-31 Thread Usul

Hi all,

Does anyone have the knowledge to help me identify a package capable of
forecasting a MULTIPLE regression model? i have a model with one one
dependant variable and 4 independant variables. i would like to forecast
confidence intervals for a few steps ahead...(DENSITY forecasting).

PS i can forecast a univariate vector, with package 'forecast', however, i
want one that can do forecasting on multivariate matrices.

Thanks and kind regards, to all!:-)
-- 
View this message in context: 
http://www.nabble.com/forecasting-multiple-regression-model-tf4725064.html#a13509244
Sent from the R help mailing list archive at Nabble.com.

__
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] DBI Package

2007-10-31 Thread elw




I have some problems with DBI package, I want to connect to PostgreSQL
database but I don't know the way to do it.

pg - dbDriver(PostgreSQL)


... nope.  That won't work.

you need the RdbiPgSQL package from Bioconductor.  Along with DBI, as I 
recall.


--elijah__
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.


Re: [R] ylim in barplot2 function?

2007-10-31 Thread Marc Schwartz
On Wed, 2007-10-31 at 11:52 +0100, Dieter Vanderelst wrote:
 Hi list,
 
 I'm using barplot2 form the gplots package to plot a few numbers (I
 want to add SD bars later).
 
 However, I would like the y-axis not to start from 0 but 500. When I
 add the parameters YLIM, something goes wrong. The graph is not 'cut
 off' at 500. Instead the bars seems to sink trough the bottom of the
 graph.
 
 Because its a little hard to explain, here is a self-containing
 example:
 
 
 library(gplots)
 
 ABrt-c(588,589,593,588)
 Wrt-c(580,583,592,612)
 
 RT-rbind(ABrt,Wrt)
 barplot2(RT,beside=T,col=c('black','white'),ylim=c(500,1000))
 
 Does anybody know of a solution?
 
 Regards,
 Dieter

The behavior here is the same for both barplot() and barplot2(). You
need to set par(xpd) to FALSE, so that the bars are clipped to the
plot region:

barplot2(RT,beside=T,col=c('black','white'),ylim=c(500,1000), 
 xpd = FALSE)

See ?par

That being said, this is a bad idea in general, as you impact the
ability to visually discern the relative difference (or lack of it) in
the bars. You would be better off using a dotplot.

HTH,

Marc Schwartz

__
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] Reading a file with read.csv: two character rows not interpreted as I hope

2007-10-31 Thread Bryan Hanson
OK, I fixed it myself!  Here's the code.  Of course, it mostly seems simple
once one gets it working... Thanks Jim.  Bryan

sample.info = read.table(input.file.name, sep=,, as.is=TRUE, nrows=3) #
get the first three lines with sample info in character format
sample.names = sample.info[1,]
sample.colors = sample.info[2,]; sample.colors =
as.character(sample.colors[-1])
sample.class = sample.info[3,]; sample.class =
as.character(sample.class[-1])
data = read.table(input.file.name, sep=,, skip=3)
colnames(data) = sample.names


On 10/30/07 10:53 PM, Bryan Hanson [EMAIL PROTECTED] wrote:

 Jim, thanks for the suggestion.  There is still something subtle
 
non-intuitive going on here.  I adapted your code with minor changes
 as
follows (I had to add the sep argument) but get different
 behavior:

c.names - scan(file.csv, what='', nlines=1, sep=,)  # read
 column names
c.options - read.table(file.csv, as.is=TRUE, nrows=2, sep=,)
 # get
lines 2-3
c.data - read.table(file.csv, sep=,)  # rest of the
 data
colnames(file.csv) - c.names

Your code works perfectly (you knew
 that!).  My adaptation runs, but
c.options contains the first two lines, not
 lines 2  3, and c.data contains
the contents of the entire file as *factors*
 (data type of c.names 
c.options is correct - character). How strange!

Also,
 and this is an observation rather than a question: in your code, you
call scan
 and get the first line as characters, then you do read.table which
gets lines
 2  3 presumably because the first line, from read.table's
perspective is a
 hidden label (?), then the second time you use read.table
the hidden first
 line is ignored, as are the two lines with character data.
I really don't
 understand these behaviors, which is probably why I'm having
trouble parsing
 the file!

Thanks, Bryan 

On 10/30/07 8:40 PM, jim holtman
 [EMAIL PROTECTED] wrote:

 Here is one way.  You will probably use 'file'
 instead of textConnection
 
 x.in - textConnection('wavelength SampleA
 SampleB SampleC SampleD
 +  color green black black green
 +  class
 Class 1 Class 2 Class 2 Class 1
 +  403 1.94E-01 2.14E-01 2.11E-01
 1.83E-01
 +  409 1.92E-01 1.89E-01 2.00E-01 1.82E-01
 +  415 1.70E-01
 1.99E-01 1.94E-01 1.86E-01
 +  420 1.59E-01 1.91E-01 2.16E-01 1.74E-01
 +
 426 1.50E-01 1.66E-01 1.72E-01 1.58E-01
 +  432 1.42E-01 1.50E-01 1.62E-01
 1.48E-01')
 
 c.names - scan(x.in, what='', nlines=1)  # read column
 names
 Read 5 items
 c.options - read.table(x.in, as.is=TRUE, nrows=2) #
 get lines 2-3
 c.data - read.table(x.in)  # rest of the data

 colnames(c.data) - c.names
 close(x.in)
 c.options  # here are lines
 2-3
  V1  V2  V3  V4  V5
 1 color   green   black
 black   green
 2 class Class 1 Class 2 Class 2 Class 1
 c.data  # your
 data
   wavelength SampleA SampleB SampleC SampleD
 1403   0.194
 0.214   0.211   0.183
 2409   0.192   0.189   0.200   0.182
 3
 415   0.170   0.199   0.194   0.186
 4420   0.159   0.191   0.216
 0.174
 5426   0.150   0.166   0.172   0.158
 6432   0.142
 0.150   0.162   0.148
 
 
 On 10/30/07, Bryan Hanson [EMAIL PROTECTED]
 wrote:
 Hi Folks... Œbeen playing with this for a while, with no luck, so
 I¹m hoping
 someone knows it off the top of their head...  Difficult to find
 this nuance
 in the archives, as so many msgs deal with read.csv!
 
 I¹m
 trying to read a data file with the following structure (a little piece
 of
 the actual data, they are actually csv just didn¹t paste with the

 commas):
 
  wavelength SampleA SampleB SampleC SampleD
  color green
 black black green
  class Class 1 Class 2 Class 2 Class 1

 403 1.94E-01 2.14E-01 2.11E-01 1.83E-01
  409 1.92E-01 1.89E-01 2.00E-01
 1.82E-01
  415 1.70E-01 1.99E-01 1.94E-01 1.86E-01
  420 1.59E-01 1.91E-01
 2.16E-01 1.74E-01
  426 1.50E-01 1.66E-01 1.72E-01 1.58E-01
  432 1.42E-01
 1.50E-01 1.62E-01 1.48E-01
 
 Columns after the first one are sample
 names.  2nd row is the list of colors
 to use in later plotting.  3rd row is
 the class for later manova.  The rest
 of it is x data in the first column
 with y1, y2...following for plotting.
 
 I can read the file w/o the color
 or class rows with read.csv just fine,
 makes a nice data frame with proper
 data types.  The problem comes when
 parsing the 2nd and 3rd rows.  Here¹s
 the code:
 
 data = read.csv(filename, header=TRUE) # read in data

 color = data[1,]; color = data[-1] # capture color info  throw out 1st

 value
 class = data[2,]; class = class[-1] # capture category info  throw
 out 1st
 value
 
 cleaned.data = data[-1,] # remove color  category
 info for matrix
 operations
 cleaned.data = data[-1,]
 freq = data[,1] #
 capture frequency info
 
 What happens is that freq is parsed as factors,
 and the color and class are
 parsed as a data frames of factors.
 I need
 color and class to be characters which I can pass to functions in the

 typical way one uses colors and levels.
 I need the freq  the cleaned.data
 info as numeric for 

Re: [R] Performance of concatenating strings

2007-10-31 Thread hadley wickham
On 10/31/07, Tamara Steijger [EMAIL PROTECTED] wrote:
 Hi,

 I would like to ask how the paste(S1, S2, sep=) function internally
 works. Are the two stings copied to a new String?

I'm not 100% sure, but I'd suspect so, as this is the default
behaviour in pretty much every programming language.

 I have a program where successively strings are build up. First the
 program calls an external function and depending on the result it
 builds up strings to visualize the result. The external function is
 really fast, also for huge input data. But the building of the
 strings takes much to long for huge input sizes. So I'm wondering if
 the concatenating could be the problem, like using String in Java
 instead of StringBuffer. Is there something like StringBuffers in R
 also?

If you know how many components there will be in the string, it's
probably best to create a character vector (str - vector(character,
100)) filling it up as you go, and then pasting it together at the
very end.  If you don't know how many components there will be, you
will need to do something a bit more sophisticated.

You might also trying profiling your function to make sure the
slowness really is being caused by what you think it is.

Hadley

-- 
http://had.co.nz/

__
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] R WinEdt on Windows vista

2007-10-31 Thread Alexander Nervedi

Hi!

I was trying to install the RWinEdt library on a Windows Vista machine which 
had R 2.6.0, WinEdt 5.4 and the RWinEdt1.7.8.zip file in the library folder 
under the ...\R\2.6.0 directory. I am able to install fine form the local zip 
but I can't launch winedt from within R for some reason. 

 utils:::menuInstallLocal()
package 'RWinEdt' successfully unpacked and MD5 sums checked 
updating HTML package descriptions
 library(RWinEdt)
Error in file(file, r) : unable to open connection In addition: Warning 
message:
In file(file, r) :
  cannot open file 'C:\Program Files\WinEdt Team\WinEdt\R.ver', reason 'No such 
file or directory'
Error : .onAttach failed in 'attachNamespace'
Error: package/namespace load failed for 'RWinEdt'

I was hoping some one could help me interpret this error message,

many thanks.

Alex

_
[[replacing trailing spam]]

ilnews
[[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] thicker axis in levelplot

2007-10-31 Thread Jenny Barnes
Dear R-help community,

I need to find out how to make the black axis line around my plot thicker in 
levelplot, I cannot find the correct command in ?levelplot or ?par - or if it 
is 
there I cannot get it to work - any help would be more that appreciated!

Here's an example script - I would want the code for making the axis bordering 
the plot thicker:

x- seq(pi/4, 5*pi,length=100)
y- seq(pi/4, 5*pi,length=100)
r- as.vector(sqrt(outer(x^2,y^2,+)))
grid- expand.grid(x=x,y=y)
grid$z - cos(r^2) * exp(-r/(pi^3))

levelplot(z~x*y, grid, cuts=50, scales=list(log=e), xlab=,
   ylab=, main=Weird Function, sub=with log scales,
   colorkey=FALSE, region=TRUE)


Also, If anybody knows how to make the lines around the colorkey (legend) 
thicker too I'd like to do that as well! (I realise that the above script does 
not include a colorkey component but my actual work does).

Many thanks,

Jenny Barnes

__
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] quantreg log and polinomial functions

2007-10-31 Thread Duccio -
I have two variables which show a typical quantile relation
I would like to fit quantile regression models based on both logarithm and
polynomial of second order functions within quantreg.
Any help appreciated...
Cheers
Duccio

Herewith  the values:
--
var1var2
0.964290.00138
10.02316
1.031450.09323
1.240880.77128
1.398690.86732
1.337280.63674
1.482990.96194
0.760.1
0.770190.3
0.960.00028
0.934910.00057
0.824320.00171
0.730770.00275
0.746480.00313
0.96970.00361
0.792450.00439
0.929940.00586
0.821430.00858
0.73770.00862
0.807950.01053
0.870750.01407
0.829930.01936
0.845070.01968
0.851850.03322
1.050630.03341
0.901230.03621
0.994150.0386
0.857140.03873
0.762590.04932
0.751880.05513
1.131220.06014
0.853330.06636
0.904110.0732
1.297780.07327
0.842110.08094
1.060240.08509
0.922080.08662
0.843540.09211
0.93590.09642
1.062860.10479
0.90.10786
0.750.11703
0.796990.1214
0.885910.12347
0.808510.12404
0.809520.12424
0.838240.13017
0.953850.14673
1.020130.1513
0.80.1555
1.066670.15733
0.887320.16003
0.961540.18156
1.022470.18261
1.098770.18561
1.165640.18985
1.10.19068
1.182390.20152
1.156630.21013
1.029410.22034
1.323810.22261
1.094590.23226
1.00680.23951
1.036140.26169
0.972220.26258
0.938780.28128
1.01370.28627
1.460870.28714
1.144510.28726
0.929130.28782
1.075950.30899
0.96350.34355
1.16770.36839
0.945950.38738
1.141180.39093
1.154290.40374
1.16250.41852
1.082350.42404
1.129410.43112
1.081760.44307
1.3250.45221
1.383080.47239
1.00730.47427
1.171050.47728
1.139070.48632
1.343280.49487
1.209880.50787
1.363640.52367
1.217950.53399
1.238640.5
1.232880.55839
1.282610.56652
1.357890.56932
1.228070.57798
1.20530.57992
1.186670.58031
1.12230.58048
1.109380.58197
1.296970.58868
1.220930.61025
1.214810.63087
1.580950.63506
1.348840.65639
1.23810.70642
1.517240.71612
1.341610.75399
1.452630.76035
1.288340.78978
1.539270.80492
1.350650.80679
1.381820.83345
1.37430.87256
1.60510.87435
1.38650.90878
1.440.94695
1.464050.95543
1.529410.96108
1.496860.98102
0.974360.00053
0.949720.03044
1.08380.04558
0.783220.04753
1.087910.06048
1.068320.06949
1.152940.13114
1.100670.18832
1.141240.23016
1.288140.25488
1.253160.25809
1.10.26702
1.137720.41137
1.123460.43028
1.153850.47513
1.186210.48385
1.253010.52187
1.109590.56926
1.173910.57653
1.40.63667
1.223680.72883
1.417140.76351
1.30.86687
1.337580.89052
1.452380.92793
1.397440.94344
1.481010.9775
0.79470.00049
0.941180.00078
0.906830.01507
0.786210.03443
1.059520.09995
0.921570.10748
0.980650.11945
1.050.15
1.090910.19752
0.866140.22126
1.218390.27116
10.28663
1.03750.31568
1.095540.362
1.094890.48028
1.228760.6107
1.270270.82497
1.476740.88388
1.364860.91599
1.50.9485
1.464290.96476
0.984290.00017
0.960.00132
1.10160.00164
1.034880.00259
1.131310.00676
1.10.00857
1.177780.01879
0.848480.02734
1.044940.03203
0.994590.0334
1.060770.04496
0.993630.04525
0.97590.04738
0.844160.05265
10.06271
1.163840.06624
1.192550.10814
1.078650.11254
1.148390.11579
1.065870.11741
0.987950.15986
1.025640.16745
1.182320.24054
1.064750.26294
1.20280.33415
1.052630.33649
0.962030.35101
1.418990.36591
1.290320.38599
1.303370.39697
1.225810.40419
1.322310.41405
1.142860.41882
1.31210.48076
1.276840.49725
1.151520.50391
1.241030.52758
1.284850.53712
1.247060.55238
1.163120.589
1.248320.59592
1.194240.59958
1.230770.60055
1.153850.60596
1.177220.6227
1.321640.65736
1.288140.67897
1.359120.68161
1.216220.68561
1.20.69235
1.293230.69752
1.242420.72117
1.587790.7424
1.359380.75283
1.30380.76964
1.263890.78097
1.266190.78649
1.284670.78969
1.468210.81551
1.294960.82751
1.328860.82946
1.383460.86327
1.396230.88525
1.365850.89968
1.369860.91253
1.418440.92278
1.472970.92683
1.58940.93875
1.452050.95307
1.440.96991
1.516340.97627
1.114750.01352
0.952380.07429
0.949370.15717
1.326730.19765
1.10490.3566
1.142860.35769
1.1750.38035
1.339810.38826
1.211010.39268
1.238710.41222
1.396230.43026
1.065420.45457
1.236360.46048
1.115380.50053
1.181210.50146
1.282050.5199
1.591160.53439

Re: [R] R WinEdt on Windows vista

2007-10-31 Thread Uwe Ligges
Alexander Nervedi wrote:
 Hi!
 
 I was trying to install the RWinEdt library on a Windows Vista machine which 
 had R 2.6.0, WinEdt 5.4 and the RWinEdt1.7.8.zip file in the library folder 
 under the ...\R\2.6.0 directory. I am able to install fine form the local zip 
 but I can't launch winedt from within R for some reason. 
 
 utils:::menuInstallLocal()
 package 'RWinEdt' successfully unpacked and MD5 sums checked 
 updating HTML package descriptions
 library(RWinEdt)
 Error in file(file, r) : unable to open connection In addition: Warning 
 message:
 In file(file, r) :
   cannot open file 'C:\Program Files\WinEdt Team\WinEdt\R.ver', reason 'No 
 such file or directory'

At first make sure that WinEdt is installed and registered.
Then, please start R with a right click (and choose start with 
Administrator privileges - don't know the exact english translation) and 
reinstall RWinEdt. Everything should work after that.

I just found out that there might be a minor problem with unregistered 
versions of WinEdt - and a fix will be committed shortly (but not that 
important, because people who do not own a copy can make use of other 
editors such as Tinn-R, which is better supported than my RWinEdt 
extension, I hope...

Uwe Ligges



 Error : .onAttach failed in 'attachNamespace'
 Error: package/namespace load failed for 'RWinEdt'
 
 I was hoping some one could help me interpret this error message,
 
 many thanks.
 
 Alex
 
 _
 [[replacing trailing spam]]
 
 ilnews
   [[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-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] SAS ODBC DRIVER

2007-10-31 Thread Michael King
Has anyone been able to successfully query SAS libraries from R using RODBC?
While I believe I have configured the SAS ODBC Driver properly (I can query
SAS libraries from MS Access) when I try to query SAS libraries from R, I
only seem to get back the column names of the table I am querying.
Sample Code:

 # open connection to SAS library 'Common'
 conn = odbcConnect('Common')
 # query test table I made in SAS
 mytable = sqlQuery(conn, 'select * from Common.Mydata')
 # mytable only has the names of the the Common.Mydata Dataset, it did not
 # retrieve the values
 mytable
[1] var1 var2 var3
0 rows (or 0-length row.names)

Thanks for your help.
-Mike King

[[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] accessing SAS libraries using RODBC

2007-10-31 Thread Michael King
Has anyone been able to successfully query SAS libraries from R using RODBC?
While I believe I have configured the SAS ODBC Driver properly (I can query
SAS libraries from MS Access) when I try to query SAS libraries from R, I
only seem to get back the column names of the table I am querying.
Sample Code:

 # open connection to SAS library 'Common'
 conn = odbcConnect('Common')
 # query test table I made in SAS
 mytable = sqlQuery(conn, 'select * from Common.Mydata')
 # mytable only has the names of the the Common.Mydata Dataset, it did not
 # retrieve the values
 mytable
[1] var1 var2 var3
0 rows (or 0-length row.names)

Thanks for your help.
-Mike King

[[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] find overlap between intervals - Correction

2007-10-31 Thread Juan Manuel Barreneche
I'm not sure if i got the idea of what you want. At fist i thought that
you wanted this output:

Output:
  290  380
  380  440
  440  443
  443  468

to get it, you can use the following function:

intervals - function(Input)
{
all - c(Input$Start, Input$End)
numbers - sort(all[-which(duplicated(all))])
Output - NULL
for(i in 1:(length(numbers) - 1))
{
Output - rbind(Output, c(numbers[i], numbers[i+1]))
}
Output
}
## then write:
intervals(Input)


but your output it's a little diferent:

CORRECTED Desired output:
 Start End
 290   380
 380   440
 443   468

and i noticed too late... ¿maybe you missed one interval (440 to 443) in
the desired Output?

JM

On Wed, 2007-10-31 at 15:01 +0100, João Fadista wrote:
 Dear all,
 Sorry for the previous email. I had a wrong example output:
  
 
 Input:
 Start End
 440   443 
 380   443 
 290   468
  
 CORRECTED Desired output:
 Start End
 290   380
 380   440
 443   468
  
 
 Best regards,
 Joo Fadista
 
   [[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-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] set initial parameter values for GLMM estimation

2007-10-31 Thread Wilfried Cools

Dear list members,

I look for a way (or alternative) to specify initial values when estimating
linear mixed models in R, and to avoid iterative estimation.

This is a way to control specific parameter values (eg. variance parameter
values) such that the result (F-value) is based on them. This result can
then be used for power analyses that uses the non-central F-distribution, as
is done with SAS using the -PARMS- and -noiter- statements, indicated in the
following SAS example:


after using/constructing a data set, with actual scores changed into
predicted scores (no error)

proc mixed data = dataSet;
class treat group;
model y = treat*time ;
random intercept / subject=group(treat); 

PARMS (2.1) (1.2) / NOITER; 

contrast 'slopes' treat*time 1 -1 0,treat*time 1 0 -1;
ods output contrasts=c;
run;

data dataSet;
set c;
alpha=0.05;
ncparm=numdf*fvalue;
fc=finv(1-alpha,numdf,dendf,0);
power=1-probf(fc,numdf,dendf,ncparm);
run;
proc print;run;

cheers,
 
Wilfried


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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] pdf() device uses fonts to represent points - dataalteration?

2007-10-31 Thread Greg Snow
Another approach is to use the my.symbols function in the TeachingDemos
package (in place of the points function) and define how you want your
circles represented (a polygon with enough sides is a good approximation
to a circle for most cases).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of jiho
 Sent: Wednesday, October 31, 2007 5:40 AM
 To: Paul Murrell
 Cc: R-help
 Subject: Re: [R] pdf() device uses fonts to represent points 
 - dataalteration?
 
 Thank you very much for your answer, even so long after I 
 first posted the message.
 
 On 2007-October-31  , at 12:00 , Paul Murrell wrote:
  Hi
 
  jiho wrote:
  Hello all,
  I discovered that the pdf device uses fonts to represent 
 points   
  symbols (as in plot(...,type=p,...) ). Namely it uses 
 ZapfDingbats  
  with symbol U+25cf. This can lead to problems when the 
 font is not  
  available, or available in another version (such as points being  
  replaced by other symbols, or worst: slightly displaced).  
  Furthermore, it also causes problems when opening the pdf 
 files for  
  editing in other programs. I know that for reproducibility 
 one should  
  avoid doing this but there are cases where R is simply not 
 suited to  
  produce the end result graphic directly using code (Ex: 
 replace some  
  colors by CMYK versions for color consistency in print). 
 In addition,  
  publishers also often like being able to retouch graphics 
 to ensure  
  fonts consistency or such, and this will be destructive in 
 the case  
  of these pdfs.
  For example, Inkscape interprets points as squares  (more like U
  +2751 in ZapfDingbats) and Adobe Illustrator does not  even
  recognize the font (substituting AdobePiStd).
  I tried to embed fonts with embedFonts() but his does not 
 solves the  
  issue with editing (Inkscape produces a kind of star and AI still  
  chokes on the font) and worst, it modifies how the 
 original graphic  
  renders in pdf viewers: the circles are now filled (I 
 believe this is  
  because this is the default state of the ZapfDingbats character).
  So my questions are:
  - does anyone have a work around this?
  - why can't the pdf device use shapes instead of fonts to 
 represent  
  data point? It would appear as a much more robust approach 
 and would  
  ensure that the points are rendered the same everywhere. Font  
  substitution in axes labels is not as bad since it does 
 not modify  
  the data itself (at worst the labels are offset a little bit) but  
  font substitution on the data points can really harm the graphic.
 
  If I recall correctly, the PDF device uses a character for small 
  circles because that looks better.  There is no PDF circle 
 primitive, 
  so circles have to be drawn using bezier curves.  The 
 original author 
  may be able to elaborate on that.
 
 OK. I was suspecting that PDF did not have circle primitives indeed.  
 That's a good reason.
 
  Two suggestions for workarounds:
  (i)  produce PostScript and then convert to PDF using 
 something like 
  ghostscript (e.g., ps2pdf)
  (ii)  use an almost-but-not-quite opaque colour, e.g., rgb(0, 0, 0, 
  .99) for the points.  If the points are not fully opaque, the 
  character is not used.
 
 (ii) is really good to know (and I would probably never have 
 found it myself). (i) is not applicable since I use PDF to 
 keep transparency.
 
 Thanks for your help. I still think that not using fonts at 
 all should be preferred because really strange things can 
 happen with fonts while bezier curves are robust and do not 
 depend at all on the rest of the OS. In this precise matter, 
 robustness is probably to be preferred over appearance, since 
 it involves the data directly.  
 Anyway, I'm fine now with your workaround. I should file a 
 bug report for this to be solved in a future release maybe.
 
 JiHO
 ---
 http://jo.irisson.free.fr/
 
 __
 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.


Re: [R] reversing perspective plot axis

2007-10-31 Thread Greg Snow
A simple approach is to swap x and y and rotate the theta parameter -90
degrees (play around with this until it is what you want).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of James
 Sent: Tuesday, October 30, 2007 8:17 PM
 To: r-help@r-project.org
 Subject: [R] reversing perspective plot axis
 
 Hi,
 
 I am trying to create a perspective plot with Time on the 
 x-axis, Underlying Price on the y-axis, and Option Price on 
 the z-axis.  But I don't like the way my x-axis is setup.  
 Right now, Time is this sequence.
 
 Time = seq(from = 1/52, to = 1, by=1/52)
 
 That results in the x-axis going from 0 at the back, to 1 
 near the foreground corner.(If that makes any sense)  I want 
 to do the exact opposite.  When I try this sequence:
 
 Time = seq(from = 1, to = 1/52, by=-1/52)
 
 I get this error message:
 
 Error in persp.default(x = Time, y = S, z = Price, xlab = 
 Time, ylab = S,  :
   increasing 'x' and 'y' values expected
 
 So it seems that I can't use a descending sequence for my 
 perspective plot.  Is that true?  Is there a way to work around this?
 
 persp(x=Time, y=S, z=Price, xlab=Time, ylab=S, zlab=TypeFlag, ...)
 
 Essentially, what I'm trying to create is something that 
 looks like this.
 
 http://www.insightful.com/products/finmetrics/opSensitivity1_lg.gif
 
 You can see how Time on the x-axis diminishes as it moves to 
 the foreground corner.
 
 Thanks in advance.
 
 James
 
 __
 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] Error optimizing Poisson log-likelihood with L-BFGS-B

2007-10-31 Thread Sergey Goriatchev
Dear R users,
I have following code, estimating Poisson log-likelihood a number of times:


poisson.loglik - function(mu, y){
n - NROW(y)
logl - sum(y)*log(mu)-n*mu
return(-logl)
}

estimates - numeric(1e5)

for(i in seq_along(estimates)){
estimates[i] - optim(par=1, poisson.loglik, method=L-BFGS-B,
lower=0, y=rpois(10,lambda=2))$par
}

I cannot run this because I always get an error message:

Error in optim(par = 1, poisson.loglik, lower = 0, method = L-BFGS-B,  :
  non-finite finite-difference value [1]

Could someone enlighten me what that means and why this happens?

THanks in advance,
Sergey

__
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] Problems with generating F-distr from lme()

2007-10-31 Thread Andreas Nord

Dear all, 

Using the data set and code below, I am interested in modelling how egg
temperature (egg.temp) 
is related to energy expenditure (kjday) and clutch size (treat) in
incubating birds using the
lme-function. I wish to generate the F-distribution for my model, and have
tried to do so using 
the anova()-function. However, in the resulting anova-table, the parameter
kjday has gone from 
being highly non-signiicant in the lme-expression, to all of a sudden being
significant at the 
0.05 level. At the same time, treat retains its original p-value. I've
tried to understand why,
but can't really figure it out. So, what has happened and why? How to best
interpret it?

Further, any advice on how to best generate F-distributions from the
lme-function is most appreciated.

Many thanks in advance, 
Andreas Nord
Sweden


  ind treat egg.temp  kjday
   79 2 27.33241 42.048
   42 2 30.73269 41.760
   10 2 29.54986 38.304
  206 2 31.78947 45.216
   23 2 29.69114 40.896
   24 2 36.48199 46.944
   45 2 29.76454 44.064
   29 2 30.56510 42.912
   78 2 27.71468 43.200
   79 3 25.88227 45.216
   42 3 30.95983 44.640
   10 3 28.13296 45.216
  206 3 31.77147 45.216
   23 3 27.5 42.336
5 3 28.16205 51.264
   24 3 34.69391 48.960
   45 3 28.79778 46.368
  368 3 26.18006 45.792
   29 3 29.75208 45.216
   78 3 25.28393 43.200
   44 3 23.32825 44.640


# lme-model with individual as random factor
 incub.lme2-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df)

Fixed effects: egg.temp ~ kjday + treat 
Value Std.Error DF   t-value p-value
(Intercept) 24.937897  6.662475 11  3.743038  0.0032
kjday0.108143  0.152540  7  0.708945  0.5013
treat3  -1.506605  0.485336  7 -3.104254  0.0172


#generating an anova table to get the F-distribution
 anova(incub.lme2)
numDF denDF   F-value p-value
(Intercept) 111 1176.6686  .0001
kjday   1 75.7060  0.0483
treat   1 79.6364  0.0172
 

-- 
View this message in context: 
http://www.nabble.com/Problems-with-generating-F-distr-from-lme%28%29-tf4726064.html#a13512770
Sent from the R help mailing list archive at Nabble.com.

__
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] problem with package fSeries

2007-10-31 Thread Balazs Torma

Helo,

  please look at the log below: after loading the fSeries library, I can not 
use the log function. Is this a bug or what am I doing wrong?

Because of this, I'm unable to use the garch library.

thanks a lot for any help,
Balazs Torma


 log(1)
[1] 0
 require(fSeries)
Loading required package: fSeries
Loading required package: robustbase
Loading required package: fCalendar
Loading required package: fEcofin

Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL
fCalendar: Time, Date and Calendar Tools

Package fSeries (260.72) loaded.
Rmetrics - Financial Time Series Objects
Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL

 log(1)
Error in .Internal(log(x)) : no internal function log


__
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] datadist options error, DESIGN library

2007-10-31 Thread Frank E Harrell Jr
Giulia Barbati wrote:
 Hello,
 using the Design library, and the following command (from the Harrell's book, 
 example at Ch.20):
 
 dd - datadist(rx, age, wt, pf, pf.coded, heart, map, hg, sz, sg, ap, bm)
 options(datadist=='dd')

That command doesn't appear in the book.  The == should be a single =

Frank

 
 I get the following error:
 
 Error in datadist == dd : comparison (1) possible only for atomic data or 
 list
 
 What does it means?
 
 thank you,
 
 giulia
 
 
 
 __
 
 
 
   [[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.
 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
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] drawing direction fields

2007-10-31 Thread Greg Snow
For drawing the arrows look at the my.symbols and ms.arrows functions in
the TeachingDemos package.  If you need help with determining the
directions of the arrows, then perhaps the Ryacas package or other link
to a mathematics package will help.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Jong-Hoon Kim
 Sent: Wednesday, October 31, 2007 1:50 AM
 To: r-help@r-project.org
 Subject: [R] drawing direction fields
 
 Dear useRs,
 
 I am trying to draw direction fields for some differential equations.
 So for I couldn't find much information on that.  Could 
 anybody give me a hint how to draw a direction field using R?
 
 Jong-Hoon
 
 __
 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] Simple Umacs example help..

2007-10-31 Thread Ted Hart
Hello all...

I am just starting to teach myself Bayesian methods, and am  
interested in learning how to use UMacs.  I've read the  
documentation, but the single example is a bit over my head at the  
level I am at right now.  I was wondering if anyone has any simple  
examples they'd like to share.  I've successfully done a couple of  
simple gibbs examples, but have had a hard time modifying some of the  
home written metropolis hastings samplers I've made to work with  
Umacs.  Does anyone have any pointers or simple 2 parameter  
examples?  Thanks.

Here is one of my simple MH samplers using a simple linear regression  
with a Cauchy error term.

x - c(1.808,1.799,1.179,0.574,3.727,0.946,3.719,1.566,3.596,3.253)
y - c(1.816,1.281,-1.382,0.573,3.793,0.935,1.775,1.474,3.679,3.889)

fn = function(x,a=0,b=1){
a+b*x
}


sample.ab -function(x,y,a,b,s,da,db){
bstar = runif(1,b-db,b+db)
astar = runif(1,a-da,a+da)

logalpha = sum(dcauchy(y,location=fn(x,astar,bstar),scale=s,log=T) -  
dcauchy(y,location=fn(x,a,b),scale=s,log=T))
logu = log(runif(1,0,1))
acc = (logu  logalpha)
b = acc*bstar + (1-acc)*b
a = acc*astar + (1-acc)*a
list(b=b,a=a,acc=acc)
}


samples = function(x,y,a,b,s,ds){

sstar = runif(1,s-ds,s+ds)
while(sstar = 0){
sstar = runif(1,s-ds,s+ds)
}
logalpha = sum( dcauchy(y,location=fn(x,a,b),scale=sstar,log=T) -  
dcauchy(y,location=fn(x,a,b),scale=s,log=T)) - log(sstar/s)
logu = log(runif(1,0,1))
acc = (logu  logalpha)
s = acc*sstar + (1-acc)*s
list(s=s,accs=acc)
}
sample.abs-function(n=1,x,y,a=0,b=1,s=2,da=.2,db =.2,ds=1)
{

accab  - 0
accs - 0
A = B = S = rep(NaN,n)
for(i in 1:n){
z = sampleab(x,y,a,b,s,da,db)
q - samples(x,y,a,b,s,ds)
A[i] = a = z$a
B[i] = b = z$b
S[i]=s=q$s
accab = accab + z$acc
accs - accs +q$accs


}
invisible(list(a=A, b=B, s=S, accab=accab/n,accs=accs/n))
}



Cheers,
Ted

Dept. of Biology,
University of Vermont



[[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] clim.pact: change group of stations object into a field

2007-10-31 Thread Irina Foss
Hello,
I have a question about one of the functions from package clim.pact.
I am planning to perform canonical correlation analysis (CCA) with temperature 
stations data, I want to use clim.pact package for that. As I understood I 
should be able to use the function stations2field in order to group my stations 
objects into a field, so that I can include the result in CCA analysis.

If I have stations objects bute.obj,braemar.obj,lerwick.obj (I have more, but 
this is just an example) and I write the code:

 field.obj-stations2field(data.set=list(bute=bute.obj,braemar=braemar.obj,lerwick=lerwick.obj))

I receive the following message:

[1] stations2field
[1] Presumes that 'data.set' is a list of station objects
[1] bute
[1] braemar
[1] lerwick
Error in stations2field(data.set = list(bute = bute.obj, braemar = braemar.obj, 
 : 
  object i.data not found

I went through the code of the function stations2field and it was not clear 
what i.data is.

I was wondering what can be done in such situation.
Thank you,
Irina.

__
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] problem with package fSeries

2007-10-31 Thread Kerpel, John
Are you using the latest version of R - with the patch?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Balazs Torma
Sent: Wednesday, October 31, 2007 11:44 AM
To: r-help@r-project.org
Cc: [EMAIL PROTECTED]
Subject: [R] problem with package fSeries


Helo,

  please look at the log below: after loading the fSeries library, I can
not use the log function. Is this a bug or what am I doing wrong?

Because of this, I'm unable to use the garch library.

thanks a lot for any help,
Balazs Torma


 log(1)
[1] 0
 require(fSeries)
Loading required package: fSeries
Loading required package: robustbase
Loading required package: fCalendar
Loading required package: fEcofin

Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL
fCalendar: Time, Date and Calendar Tools

Package fSeries (260.72) loaded.
Rmetrics - Financial Time Series Objects
Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL

 log(1)
Error in .Internal(log(x)) : no internal function log


__
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.


Re: [R] survey weights in sample with replacement

2007-10-31 Thread Mehtabul Azam
Thanks Thomas ! I am trying to draw random sample from a household survey
which has 80,000 observations.
rural is name of the dataset, while iwt is survey weights assigned to each
observation.
the resulting error are :

 z=sample(rural,5000,replace=TRUE, Prob=rural$iwt)
Error in sample(rural, 5000, replace = TRUE, Prob = rural$iwt) : 
unused argument(s) (Prob = c(133, 133, 166, 166, 166, 166, 1047,
1047, 1047, 1047, 288, 623, 623, 240, 240, 432, 144, 144, 719, 719, 316,
342, 342, 816, 816, 105, 158, 158, 1105, 1105, 101, 557, 557, 405, 405, 101,
304, 304, 1165, 1165, 193, 771, 771, 1060, 1060, 482, 530, 530, 2024, 2024,
254, 254, 241, 241, 241, 241, 674, 674, 674, 674, 137, 137, 623, 623, 623,
623, 603, 603, 603, 603, 285, 556, 556, 970, 970, 285, 728, 728, 499, 499,
272, 1349, 1349, 218, 218, 272, 1240, 1240, 95, 95, 307, 307, 307, 307, 307,

 iwt=rural[,iwt]

 z=sample(rural,5000,replace=TRUE, Prob=iwt)
Error in sample(rural, 5000, replace = TRUE, Prob = iwt) : 
unused argument(s) (Prob = c(133, 133, 166, 166, 166, 166, 1047,
1047, 1047, 1047, 288, 623, 623, 240, 240, 432, 144, 144, 719, 719, 316,
342, 342, 816, 816, 105, 158, 158, 1105, 1105, 101, 557, 557, 405, 405, 101,
304, 304, 1165, 1165, 193, 771, 771, 1060, 1060, 482, 530, 530, 2024, 2024,
254, 254, 241, 241, 241, 241, 674, 674, 674, 674, 137, 137, 623, 623, 623,
623, 603, 603, 603, 603, 285, 556, 556, 970, 970, 285, 728, 728, 499, 499,
272, 1349, 1349, 218, 218, 272, 1240, 1240, 95, 95, 307, 307, 307, 307, 307,


 iwt=as.vector(rural[,iwt])
 z=sample(rural,5000,replace=TRUE, Prob=iwt)
Error in sample(rural, 5000, replace = TRUE, Prob = iwt) : 
unused argument(s) (Prob = c(133, 133, 166, 166, 166, 166, 1047,
1047, 1047, 1047, 288, 623, 623, 240, 240, 432, 144, 144, 719, 719, 316,
342, 342, 816, 816, 105, 158, 158, 1105, 1105, 101, 557, 557, 405, 405, 101,
304, 304, 1165, 1165, 193, 771, 771, 1060, 1060, 482, 530, 530, 2024, 2024,
254, 254, 241, 241, 241, 241, 674, 674, 674, 674, 137, 137, 623, 623, 623,
623, 603, 603, 603, 603, 285, 556, 556, 970, 970, 285, 728, 728, 499, 499,
272, 1349, 1349, 218, 218, 272, 1240, 1240, 95, 95, 307, 307, 307, 307, 307,



summary(rural$iwt)
   Min. 1st Qu.  MedianMean 3rd Qu.Max. 
  1 400107818942981   54320 
 
I just want that random sample look as close as possible to population (
weighted proportions generated from sample)
I thought it should automatically normalize probablity vector.I am not sure,
i am reading this right // I might be totally off the track.

Regards,
Mehtab
-Original Message-
From: Thomas Lumley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 31, 2007 9:44 AM
To: Azam, Mehtabul 
Cc: [EMAIL PROTECTED]
Subject: Re: [R] survey weights in sample with replacement

On Tue, 30 Oct 2007, Azam, Mehtabul  wrote:

 Hi,
   I am trying to draw a random sample from an household survey with 
 sample weight. Is there any function in R or Splus which allows this.


It depends on exactly what you want.

The sample() function will draw unequal probability samples with 
replacement.

sample() will also draw samples without replacement, but (as documented) 
it uses sequential sampling and so does not actually generate 
probabilities proportional to the specified weights for sample sizes 
greater than 1.

The error in sequential sampling is pretty small, but it has attracted a 
lot of creativity in the survey literature (probably more than it 
deserves).  The 'sampling' package implements several algorithms for 
drawing unequal probability samples without replacement that really are 
proportional to the specified weights where this is achievable.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
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] DBI Package

2007-10-31 Thread Germán Carrillo
Ok, thanks to Prof Brian Ripley and to Elijah, I did the connection to
PostgeSQL database with RODBC, it's simple.

I will try with RdbiPgSQL in the next days.

Thanks a lot.


2007/10/31, [EMAIL PROTECTED] [EMAIL PROTECTED]:



  I have some problems with DBI package, I want to connect to PostgreSQL
  database but I don't know the way to do it.
 
  pg - dbDriver(PostgreSQL)

 ... nope.  That won't work.

 you need the RdbiPgSQL package from Bioconductor.  Along with DBI, as I
 recall.

 --elijah
 __
 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.




-- 
---
  |\__
(:__)(
  |/

Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/

[[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] reversing perspective plot axis

2007-10-31 Thread James
On Oct 31, 2007, at 9:48 AM, Greg Snow wrote:

 A simple approach is to swap x and y and rotate the theta parameter  
 -90
 degrees (play around with this until it is what you want).

Thank you.  That does exactly what I wanted.  Oddly enough, I had  
already swapped X and Y trying to get this to work -- not realizing  
that I could just rotate it.  I've now swapped the axes back and used  
theta=-25 to rotate it the other direction which fixes everything.   
Thank you.

James

__
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] Error optimizing Poisson log-likelihood with L-BFGS-B

2007-10-31 Thread Ben Bolker



Sergey Goriatchev wrote:
 
 
 [snip]
 
 I cannot run this because I always get an error message:
 
 Error in optim(par = 1, poisson.loglik, lower = 0, method = L-BFGS-B,  :
   non-finite finite-difference value [1]
 
 Could someone enlighten me what that means and why this happens?
 
 THanks in advance,
 Sergey
 
 

  It happens because L-BFGS-B is willing to try points that are exactly on
the boundary.

## modify likelihood function to allow debug option
poisson.loglik - function(mu, y,debug=FALSE){
  n - NROW(y)
  logl - sum(y)*log(mu)-n*mu
  v = -logl
  if (debug) cat(mu,v,\n)
  return(v)
}

estimates - numeric(1e5)

## try the loop, but save yval every time so we can replicate the problem
for (i in 1:1000) {
  yval = rpois(10,lambda=2)
  estimates[i] - optim(par=1, poisson.loglik, method=L-BFGS-B,
lower=0, y=yval)$par
}

## now see what crashed (stopped after rep 33 for me)
optim(par=1, poisson.loglik, method=L-BFGS-B,
lower=0, y=yval)$par

## yes, it crashed. Try debugging.
optim(par=1, poisson.loglik, method=L-BFGS-B,
lower=0, y=yval, debug=TRUE)$par

## increase lower bound value ...
optim(par=1, poisson.loglik, method=L-BFGS-B,
lower=0.002, y=yval, debug=TRUE)$par


for (i in 1:1) {
  yval = rpois(10,lambda=2)
  estimates[i] - optim(par=1, poisson.loglik, method=L-BFGS-B,
lower=0.002, y=yval)$par
}

 ## works (and minimum estimate is not on the boundary)
-- 
View this message in context: 
http://www.nabble.com/Error-optimizing-Poisson-log-likelihood-with-L-BFGS-B-tf4726144.html#a13514904
Sent from the R help mailing list archive at Nabble.com.

__
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] high RAM on Linux or Solaris platform

2007-10-31 Thread David Bickel
Dr. Lumley and Prof. Ripley,

Thank you very much for your helpful responses. 

Have you found any particular distribution of Linux to work well with
64-bit R? For the cluster, I am currently considering Debian (since it
seems popular) and SUSE (since Matlab runs on it), but I remain open to
others.

Best regards,
David


-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 30, 2007 4:51 PM
To: Thomas Lumley
Cc: David Bickel; [EMAIL PROTECTED]
Subject: Re: [R] high RAM on Linux or Solaris platform

On Tue, 30 Oct 2007, Thomas Lumley wrote:

 On Tue, 30 Oct 2007, David Bickel wrote:

 To help me make choices regarding a platform for running high-memory
R
 processes in parallel, I would appreciate any responses to these
 questions:

 1. Does the amount of RAM available to an R session depend on the
 processor (Intel vs. Sun) or on the OS (various Linux distributions
vs.
 Solaris)?

 Yes.

 It depends on whether R uses 64-bit or 32-bit pointers. For 64-bit R
you 
 need a 64-bit processor, an operating system that will run 64-bit 
 programs, and a compiler that will produce them.

 I'm not sure what the current Intel offerings are, but you can compile

 and run 64-bit on AMD Opteron (Linux) and Sun (Solaris) systems.

That is both Sparc Solaris and x86_64 Solaris (although for the latter
you 
seem to need to use the SunStudio compilers).

As far as I know all current desktop Intel processors run x86_64, and 
Xeons seem to have a price-performance edge at the moment. We have
several 
boxes with dual quad-core Xeons and lots of RAM.  (Not all for use with
R, 
some Linux, some Windows.)  Core 2 Duos do, and are commonplace in quite

low-end systems.


 2. Does R have any built-in limitations of RAM available to a
session?
 For example, could it make use of 16 GB in one session given the
right
 processor/OS platform?

 R does have built-in limitations even in a 64-bit system, but they are

 large. It is certainly possible to use more than 16Gb of memory.

 The main limit is that the length of a vector is stored in a C int,
and 
 so is no more than 2^31-1, or about two billion. A numeric vector of 
 that length would take up 16Gb on its own.

?Memory-limits documents them.

 3. Is there anything else I should consider before choosing a
processor
 and OS?

 I don't think there is anything else R-specific.

-- 
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

__
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] find overlap between intervals

2007-10-31 Thread jim holtman
Got a little bit of a different answer:

 x - Start End
+ 440   443
+ 380   443
+ 290   468
 x.in - read.table(textConnection(x), header=TRUE)
 # create matrix to determine queue size (overlap)
 x.q - rbind(cbind(x.in$Start, 1), cbind(x.in$End, -1))
 # sort
 x.q - x.q[order(x.q[,1], x.q[,2]),]
 x.q - cbind(x.q, queue=cumsum(x.q[,2]))
 # remove duplicated entries
 x.q - x.q[!duplicated(x.q[,1]),]
 x.q
queue
[1,] 290  1 1
[2,] 380  1 2
[3,] 440  1 3
[4,] 443 -1 2
[5,] 468 -1 0
 # now output ranges -- '0' indicates end of an interval
 x.intervals - t(sapply(seq_len(nrow(x.q) - 1), function(.row){
+ if (x.q[.row, 'queue'] == 0) next # skip
+ c(Start=x.q[.row, 1], End=x.q[.row + 1, 1])
+ }))
 x.intervals
 Start End
[1,]   290 380
[2,]   380 440
[3,]   440 443
[4,]   443 468



On 10/31/07, João Fadista [EMAIL PROTECTED] wrote:
 Dear all,

 I would like to be able to know the intervals of my data that overlap between 
 them. Here it goes a small example:

 Input:
 Start End
 440   443
 380   443
 290   468

 Desired output:
 Start End
 290  380
 380  440
 440  468


 Best regards,
 João Fadista

[[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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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] tree problem

2007-10-31 Thread Richard Valliant
This is a repeat posting from 28 Oct that generated no replies. I'm
hoping someone has some advice since I'm still stuck ...

I am trying to use tree to partition a data set. The data set has 3924
observations. Partitioning works for small subsets of the data, but when
I use the entire data set, no partitioning occurs. The variables are:

RESP respondent to a survey (0 = not a respondent, 1 = respondent)
AGE_P Age (continuous)
ORIGIN_I Hispanic Ethnicity (1 = Hispanic, 2 = non-Hispanic)
RACRECI2Race Recode (1 = White, 2 = Black, 3 = Other)
parents Parent(s) present in the family (1 = Yes, 2 = No)
educ Education Recode (1 = HS, GED, or less, 5 = some college, 6 =
Bachelor's or AA degree, 9 = Masters  higher

Here are 2 calls to tree and a snip of summary results:

### Use a sample of 100 
 set.seed(331)
 nsize = 100
 sam - sample(1:nrow(nhis), nsize)
 
 t1 - tree( RESP ~ AGE_P + ORIGIN_I + RACRECI2 + parents + educ, 
+ method = class,
+ control = tree.control(nobs = nsize, minsize = 10),
+ data = nhis[sam,])
 summary(t1)

Classification tree:
tree(formula = RESP ~ AGE_P + ORIGIN_I + RACRECI2 + parents + 
educ, data = nhis[sam, ], control = tree.control(nobs = nsize, 
minsize = 10), method = class)
Number of terminal nodes: 13  # All vars were used


 Use entire data set 
 nsize = 3924
 sam - sample(1:nrow(nhis), nsize)
 
 t1 - tree( RESP ~ AGE_P + ORIGIN_I + RACRECI2 + parents + educ, 
+ method = class,
+ control = tree.control(nobs = nsize, minsize = 10),
+ data = nhis[sam,])
 summary(t1)

Classification tree:
.
.
.
Variables actually used in tree construction:
character(0)   # No vars were
used
Number of terminal nodes: 1 

It doesn't matter whether I use the categorical vars as factors or not;
I still get the same results. As I increase the subsample from 100
incrementally up to 1200 , fewer vars are used in tree construction. At
1200 the point is reached where none are used.

Is there a way to force tree to do something with the larger sample
sizes and the whole data set?

Package tree version 1.0-26 
R 2.6.0
Windows XP, v.5.1, service pack 2

Thanks
Richard Valliant
U of Maryland, US

__
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] Multiple calls to a function

2007-10-31 Thread Keith Jones
Hi y'all,

I wrote two functions; 1) sparsely samples a point pattern and 
calculates the Clark Evans R value and Z score, 2) calls the first 
function multiple times using a for loop and generates a histogram. 
I would like to know if there is a more efficient way of calling the 
first function other than using the for loop.  Any ideas?

cel-data.frame(R=0,RZ=0,CV=0,PVAL=0,INT=0)
for(i in 1:N) cel[i,]-cezhpts(dat,np,cv)

Thanks,

Keith Jones

__
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] textplot() in gplots causes problems (0x9)

2007-10-31 Thread Jonas Malmros
Hello,

I am using textplot function in gplots package to put some model
output inside a PDF file, but it does not seem to work properly with
PDF.

I am doing follwing:
pdf(file=C:/..., paper=a4, width=8, height=12)
.model - lm(.model.formula, data=database)
textplot(capture.output(summary(.model)), valign=top, halign=left)

I  am getting these error messages:

Warning messages:
1: In FUN(c(C, a, l, l, :, l, m, (, f, o, r,  :
  font width unknown for character 0x9
2: In strwidth(object, cex = cex) : font width unknown for character 0x9
3: In FUN(c(C, a, l, l, :, l, m, (, f, o, r,  :
  font width unknown for character 0x9
4: In strwidth(object, cex = cex) : font width unknown for character 0x9
5: In FUN(c(C, a, l, l, :, l, m, (, f, o, r,  :
  font width unknown for character 0x9
6: In strwidth(object, cex = cex) : font width unknown for character 0x9
7: In text.default(x = xpos, y = ypos, labels = object, adj = c(0,  :
  font width unknown for character 0x9
8: In text.default(x = xpos, y = ypos, labels = object, adj = c(0,  :
  font width unknown for character 0x9

This is a tab character that causes problems, I guess. Is there any
way to solve this?

Thank you in advance

-- 
Jonas Malmros
Stockholm University
Stockholm, Sweden

__
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] Lattice: par.ylab.text alpha ?

2007-10-31 Thread Folkes, Michael
Hi all,
I've got R for windows 2.3.1
I'm trying to modify my lattice histograms.
The following does reset the y-label to blue, but I cannot turn off the label 
(alpha=0), nor shift label position (I'm assuming that is what lineheight is 
for).  Is 'lineheight' the equivalent of 'line' in mtext?
Am I erring somehow?
Thanks!

trellis.par.set(list(par.ylab.text=list(col='blue')))  #- works
trellis.par.set(list(par.ylab.text=list(alpha=0)))  #-no change, i.e. label 
still there
trellis.par.set(list(par.ylab.text=list(lineheight=3)))  #- label not moved

I assume I'm interpreting alpha correctly as this gets rid of axes:
trellis.par.set(list(axis.line=list(alpha=0)))


___
Michael Folkes
Salmon Stock Assessment
Canadian Dept. of Fisheries  Oceans 
Pacific Biological Station
3190 Hammond Bay Rd.
Nanaimo, B.C., Canada
V9T-6N7
Ph (250) 756-7264 Fax (250) 756-7053  [EMAIL PROTECTED]


[[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] Multiple calls to a function

2007-10-31 Thread Greg Snow
Since you do not change anything in your call to the function, you could
just use the replicate function instead of the for loop (I don't know
that it will speed things up much, but it is a bit more readable).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Keith Jones
 Sent: Wednesday, October 31, 2007 1:04 PM
 To: r-help@r-project.org
 Subject: [R] Multiple calls to a function
 
 Hi y'all,
 
 I wrote two functions; 1) sparsely samples a point pattern 
 and calculates the Clark Evans R value and Z score, 2) calls 
 the first function multiple times using a for loop and 
 generates a histogram. 
 I would like to know if there is a more efficient way of 
 calling the first function other than using the for loop.  Any ideas?
 
 cel-data.frame(R=0,RZ=0,CV=0,PVAL=0,INT=0)
 for(i in 1:N) cel[i,]-cezhpts(dat,np,cv)
 
 Thanks,
 
 Keith Jones
 
 __
 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.


Re: [R] thicker axis in levelplot

2007-10-31 Thread jim holtman
try:

 trellis.par.set(axis.line=list(lwd=4))


On 10/31/07, Jenny Barnes [EMAIL PROTECTED] wrote:
 Dear R-help community,

 I need to find out how to make the black axis line around my plot thicker in
 levelplot, I cannot find the correct command in ?levelplot or ?par - or if it 
 is
 there I cannot get it to work - any help would be more that appreciated!

 Here's an example script - I would want the code for making the axis bordering
 the plot thicker:

 x- seq(pi/4, 5*pi,length=100)
 y- seq(pi/4, 5*pi,length=100)
 r- as.vector(sqrt(outer(x^2,y^2,+)))
 grid- expand.grid(x=x,y=y)
 grid$z - cos(r^2) * exp(-r/(pi^3))

 levelplot(z~x*y, grid, cuts=50, scales=list(log=e), xlab=,
   ylab=, main=Weird Function, sub=with log scales,
   colorkey=FALSE, region=TRUE)


 Also, If anybody knows how to make the lines around the colorkey (legend)
 thicker too I'd like to do that as well! (I realise that the above script does
 not include a colorkey component but my actual work does).

 Many thanks,

 Jenny Barnes

 __
 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.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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] seg fault with randomForest ( ... , xtest )

2007-10-31 Thread clayton . springer
Dear R-help,

what are the limits on xtest?

 NOT_A.rf -  randomForest (log10(Y[!A]  ) ~ . , data = notA_desc , 
proximity=T ,xtest =  A_desc)

 *** caught segfault ***
address 0x9cdd000, cause 'memory not mapped'
Segmentation fault

I don't think that the matrix are large:

notA_desc is 651 obs of 27 variables
A_desc is 17 obs of 27 variables

thanks in advance,

Clayton
[[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] Problem With SciViews-R

2007-10-31 Thread dt Excellent
After installing the SciViews-R Console I am getting the following error 
message when I try to run any of the commands.
   
  Error in file.info(fn - c(...)) : invalid filename argument

  See also the attached file Doc1.
   
   
   

   
-


__
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] Homework help: Is this how CIs of normal distributions are computed?

2007-10-31 Thread Zembower, Kevin
I'm looking for a function in R similar to t.test() which was generously
pointed out to me yesterday, but which can be used for normally
distributed data.

To recap yesterday:
 x - scan()
1: 62 52 68 23 34 45 27 42 83 56 40
12: 
Read 11 items
 alpha- .05
 t.test(x)

One Sample t-test

data:  x 
t = 8.8696, df = 10, p-value = 4.717e-06
alternative hypothesis: true mean is not equal to 0 
95 percent confidence interval:
 36.21420 60.51307 
sample estimates:
mean of x 
 48.36364 

What if I now mock-up my data for 100 trials:
 x100-sample(x, 100, replace=TRUE)

I think that I should be able to use a normal distribution, because of
the n30 rule-of-thumb.

I can compute the 95% CI using:
 mean(x100) - qnorm(alpha/2)*sd(x100)/sqrt(length(x100))
[1] 51.91222
 mean(x100) + qnorm(alpha/2)*sd(x100)/sqrt(length(x100))
[1] 44.80778
 t.test(x100)

One Sample t-test

data:  x100 
t = 26.683, df = 99, p-value  2.2e-16
alternative hypothesis: true mean is not equal to 0 
95 percent confidence interval:
 44.76383 51.95617 
sample estimates:
mean of x 
48.36 



The critical values I compute manually are close to the t.test values,
which is what I expect. As the number of samples increases, the t value
approaches the normal distribution value.

I thought I looked at all the other .test functions in the stats
package, and didn't find one that computed results like the t.test for
normal distributions. Is something similar to my 'manual' computations
the way it's done in R, or have I overlooked something again?

Thanks.

-Kevin

Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland  21202
410-659-6139 

__
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] Homework help: Is this how CIs of normal distributions are computed?

2007-10-31 Thread Daniel Lakeland
On Wed, Oct 31, 2007 at 03:56:37PM -0400, Zembower, Kevin wrote:
 I'm looking for a function in R similar to t.test() which was generously
 pointed out to me yesterday, but which can be used for normally
 distributed data.
...
  x100-sample(x, 100, replace=TRUE)
 
 I think that I should be able to use a normal distribution, because of
 the n30 rule-of-thumb.
 
 I can compute the 95% CI using:
  mean(x100) - qnorm(alpha/2)*sd(x100)/sqrt(length(x100))

You can compute quantiles of the particular normal distribution itself
rather than transforming from the standardized normal by hand.

qnorm(c(.025,.975),mean=mean(x100),sd=sd(x100)/sqrt(length(x100)))

-- 
Daniel Lakeland
[EMAIL PROTECTED]
http://www.street-artists.org/~dlakelan

__
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] Find A, given B where B=A'A

2007-10-31 Thread Michael Gormley
Given a matrix B, where B=A'A, how can I find A?
In other words, if I have a matrix B which I know is another matrix A times 
its transpose, can I find matrix A?

Thanks,
Mike

__
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] Homework help: Is this how CIs of normal distributionsare computed?

2007-10-31 Thread Zembower, Kevin
Daniel, thanks, I should have remembered this, too; I've seen it and
worked with it before. Thanks.

-Kevin

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Daniel Lakeland
Sent: Wednesday, October 31, 2007 4:04 PM
To: r-help@r-project.org
Subject: Re: [R] Homework help: Is this how CIs of normal
distributionsare computed?

On Wed, Oct 31, 2007 at 03:56:37PM -0400, Zembower, Kevin wrote:
 I'm looking for a function in R similar to t.test() which was
generously
 pointed out to me yesterday, but which can be used for normally
 distributed data.
...
  x100-sample(x, 100, replace=TRUE)
 
 I think that I should be able to use a normal distribution, because of
 the n30 rule-of-thumb.
 
 I can compute the 95% CI using:
  mean(x100) - qnorm(alpha/2)*sd(x100)/sqrt(length(x100))

You can compute quantiles of the particular normal distribution itself
rather than transforming from the standardized normal by hand.

qnorm(c(.025,.975),mean=mean(x100),sd=sd(x100)/sqrt(length(x100)))

-- 
Daniel Lakeland
[EMAIL PROTECTED]
http://www.street-artists.org/~dlakelan

__
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] mosaic row and column order

2007-10-31 Thread Michael Kubovy
Dear R-helpers,

I wasn't able to find out how to override the alphabetical ordering  
of the rows and columns in a vcd::mosaic plot. I would like to have  
them each ordered by numerical values in a different column of the  
data frame that contains the contingency data.

I would be most grateful for a pointer toward the solution.

Thanks,
MK
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
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] Find A, given B where B=A'A

2007-10-31 Thread Katharine Mullen
B is symmetric by definition; if it's also real positive-definite then A
is the upper triangular factor of the Choleski decomposition, and you can
use
 chol(B)
to get A.

On Wed, 31 Oct 2007, Michael Gormley wrote:

 Given a matrix B, where B=A'A, how can I find A?
 In other words, if I have a matrix B which I know is another matrix A times
 its transpose, can I find matrix A?

 Thanks,
 Mike

 __
 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.


Re: [R] Homework help: Is this how CIs of normal distributions arecomputed?

2007-10-31 Thread Greg Snow
There is a z.test function in the TeachingDemos package, but it is
mainly for learning purposes to ease students into using t.test.

The rule of use the normal for n30 comes from the days when
computations were done by hand using tables and people did not want to
carry around t-tables with 100's of rows, so they noticed that the row
for 29 df on the t-table is close to the normal values for the common
confidence intervals.  If you are using the computer then that does not
apply and you should use the t test and t intervals for any situation
that the computer can compute the t-values for you.  The normal based
confidence intervals should only be used for the paradoxical case where
you know for certain the population standard deviation, but don't know
the mean.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Zembower, Kevin
 Sent: Wednesday, October 31, 2007 1:57 PM
 To: r-help@r-project.org
 Subject: [R] Homework help: Is this how CIs of normal 
 distributions arecomputed?
 
 I'm looking for a function in R similar to t.test() which was 
 generously pointed out to me yesterday, but which can be used 
 for normally distributed data.
 
 To recap yesterday:
  x - scan()
 1: 62 52 68 23 34 45 27 42 83 56 40
 12: 
 Read 11 items
  alpha- .05
  t.test(x)
 
 One Sample t-test
 
 data:  x
 t = 8.8696, df = 10, p-value = 4.717e-06 alternative 
 hypothesis: true mean is not equal to 0
 95 percent confidence interval:
  36.21420 60.51307
 sample estimates:
 mean of x
  48.36364 
 
 What if I now mock-up my data for 100 trials:
  x100-sample(x, 100, replace=TRUE)
 
 I think that I should be able to use a normal distribution, 
 because of the n30 rule-of-thumb.
 
 I can compute the 95% CI using:
  mean(x100) - qnorm(alpha/2)*sd(x100)/sqrt(length(x100))
 [1] 51.91222
  mean(x100) + qnorm(alpha/2)*sd(x100)/sqrt(length(x100))
 [1] 44.80778
  t.test(x100)
 
 One Sample t-test
 
 data:  x100
 t = 26.683, df = 99, p-value  2.2e-16
 alternative hypothesis: true mean is not equal to 0
 95 percent confidence interval:
  44.76383 51.95617
 sample estimates:
 mean of x 
 48.36 
 
 
 
 The critical values I compute manually are close to the 
 t.test values, which is what I expect. As the number of 
 samples increases, the t value approaches the normal 
 distribution value.
 
 I thought I looked at all the other .test functions in the 
 stats package, and didn't find one that computed results like 
 the t.test for normal distributions. Is something similar to 
 my 'manual' computations the way it's done in R, or have I 
 overlooked something again?
 
 Thanks.
 
 -Kevin
 
 Kevin Zembower
 Internet Services Group manager
 Center for Communication Programs
 Bloomberg School of Public Health
 Johns Hopkins University
 111 Market Place, Suite 310
 Baltimore, Maryland  21202
 410-659-6139 
 
 __
 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.


Re: [R] Find A, given B where B=A'A

2007-10-31 Thread Lucke, Joseph F
chol(B) doesn't give the original A, which I believe is what Mike wants.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Katharine Mullen
Sent: Wednesday, October 31, 2007 4:08 PM
To: Michael Gormley
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Find A, given B where B=A'A

B is symmetric by definition; if it's also real positive-definite then A
is the upper triangular factor of the Choleski decomposition, and you
can use
 chol(B)
to get A.

On Wed, 31 Oct 2007, Michael Gormley wrote:

 Given a matrix B, where B=A'A, how can I find A?
 In other words, if I have a matrix B which I know is another matrix A 
 times its transpose, can I find matrix A?

 Thanks,
 Mike

 __
 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.


Re: [R] Find A, given B where B=A'A

2007-10-31 Thread Rolf Turner

On 1/11/2007, at 9:13 AM, Michael Gormley wrote:

 Given a matrix B, where B=A'A, how can I find A?
 In other words, if I have a matrix B which I know is another matrix  
 A times
 its transpose, can I find matrix A?

You can't, because A is not unique.  You can easily find ***a***  
solution.

E.g. A1 - matrix(1:4,ncol=2)
  B  - t(A1)%*%A1
  A2 - msqrt(B)

A2 != A1 (A2 is symmetric), yet t(A2)%*%A2 == B.

The function msqrt() above is a simple-minded calculation of the
square root of a positive semi-definite real matrix, the code of
which I just cribbed from an old posting by Prof. Brian Ripley:

msqrt - function(X) {
e - eigen(X)
V - e$vectors
V%*%diag(sqrt(e$values))%*%t(V)
}

The problem of finding ***all possible*** solutions A to A'A = B
(for B symmetric positive semi-definite) is likely to be hard,
but may have been solved by the linear algebraists.  I dunno.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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] Find A, given B where B=A'A

2007-10-31 Thread Charles C. Berry
On Thu, 1 Nov 2007, Rolf Turner wrote:


 On 1/11/2007, at 9:13 AM, Michael Gormley wrote:

 Given a matrix B, where B=A'A, how can I find A?
 In other words, if I have a matrix B which I know is another matrix
 A times
 its transpose, can I find matrix A?

 You can't, because A is not unique.  You can easily find ***a***
 solution.

 E.g. A1 - matrix(1:4,ncol=2)
  B  - t(A1)%*%A1
  A2 - msqrt(B)

Also, see

?chol

Chuck


 A2 != A1 (A2 is symmetric), yet t(A2)%*%A2 == B.

 The function msqrt() above is a simple-minded calculation of the
 square root of a positive semi-definite real matrix, the code of
 which I just cribbed from an old posting by Prof. Brian Ripley:

 msqrt - function(X) {
   e - eigen(X)
   V - e$vectors
   V%*%diag(sqrt(e$values))%*%t(V)
 }

 The problem of finding ***all possible*** solutions A to A'A = B
 (for B symmetric positive semi-definite) is likely to be hard,
 but may have been solved by the linear algebraists.  I dunno.

   cheers,

   Rolf Turner

 ##
 Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

 __
 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.


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
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] mosaic row and column order

2007-10-31 Thread Achim Zeileis
On Wed, 31 Oct 2007, Michael Kubovy wrote:

 Dear R-helpers,

 I wasn't able to find out how to override the alphabetical ordering
 of the rows and columns in a vcd::mosaic plot. I would like to have
 them each ordered by numerical values in a different column of the
 data frame that contains the contingency data.

mosaic() uses the same ordering as in the levels() of your factor. You
probably created the factor with an alphabetical ordering (which is the
default if the input is a character vector), e.g.:

  ## character vector
  x - c(a, b, b, a, c)

  ## use alphabetical default
  f - factor(x)
  f

  ## change ordering in existing factor
  levels(f) - c(b, c, a)
  f

  ## create from scratch



 I would be most grateful for a pointer toward the solution.

 Thanks,
 MK
 _
 Professor Michael Kubovy
 University of Virginia
 Department of Psychology
 USPS: P.O.Box 400400Charlottesville, VA 22904-4400
 Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, VA 22903
 Office:B011+1-434-982-4729
 Lab:B019+1-434-982-4751
 Fax:+1-434-982-4766
 WWW:http://www.people.virginia.edu/~mk9y/

 __
 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] Axis Location/Data view in scatterplot3d

2007-10-31 Thread Bret Collier
All,

I constructed a fairly simple plot using the below and scatterplot3d. 
However, the axis locations in scatterplot3d seem to 'hide' quite a bit 
of the points in my graphic based on the viewing angle, hence not 
adhering to Tufte's rules.  I tried to determine if I could rotate the 
graph and relocate all three axis (origin (0, 0, 0))so they would be at 
the back left so the plotted points would slope down toward the viewer. 
  Using 'angle' and 'axis' did not get me any closer.  Does anyone have 
any suggestions?

TIA,
Bret

for(Days_Nesting in 1:55){
Breeding_Period-1:118
DSR_RGWT= exp(6.6205449-0.0589883*Days_Nesting)/(1+ 
exp(6.6205449-0.0589883*Days_Nesting))
DSR_BS-DSR_RGWT^Breeding_Period
DSR_Final-as.data.frame(cbind(Days_Nesting, Breeding_Period, DSR_BS))
write(c(t(DSR_Final)), location.txt, append=T, ncolumns=3)
}
dsr_data-read.delim(location.txt, header=F, sep=)
attach(dsr_data)
scatterplot3d(V1, V2, V3, grid=F, box=T, pch=20, xlim=c(1, 
55),ylim=c(1,118), zlim=c(0, 1))



 version
platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  6.0
year   2007
month  10
day03
svn rev43063
language   R
version.string R version 2.6.0 (2007-10-03)

-- 
Bret A. Collier, Ph.D.
Department of Wildlife and Fisheries Sciences
Texas AM University
College Station TX 77843
979-458-0500; [EMAIL PROTECTED]

__
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] Find A, given B where B=A'A

2007-10-31 Thread Peter Dalgaard
Michael Gormley wrote:
 Thanks for your help, all those who submitted responses.  I do not need a 
 specific matrix A, any solution will do.  With this said, is it possible to 
 specify the dimensions of the A matrix in the decompostion?  For example, if 
 A is a 2X1 matrix then A'A=B would be a 2X2 as well.
   

B would have rank 1 then, and a pivoted Choleski  decomposition has zero 
rows e.g.

  B - outer(c(2,3),c(2,3))
  B
 [,1] [,2]
[1,]46
[2,]69
  chol(B, pivot=TRUE)
 [,1] [,2]
[1,]32
[2,]00
attr(,pivot)
[1] 2 1
attr(,rank)
[1] 1
Warning message:
In chol.default(B, pivot = TRUE) : matrix not positive definite

an eigen() decomposition could also be used.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] mosaic row and column order

2007-10-31 Thread Duncan Murdoch
On 31/10/2007 5:50 PM, Achim Zeileis wrote:
 On Wed, 31 Oct 2007, Michael Kubovy wrote:
 
 Dear R-helpers,

 I wasn't able to find out how to override the alphabetical ordering
 of the rows and columns in a vcd::mosaic plot. I would like to have
 them each ordered by numerical values in a different column of the
 data frame that contains the contingency data.
 
 mosaic() uses the same ordering as in the levels() of your factor. You
 probably created the factor with an alphabetical ordering (which is the
 default if the input is a character vector), e.g.:
 
   ## character vector
   x - c(a, b, b, a, c)
 
   ## use alphabetical default
   f - factor(x)
   f

This prints

[1] a b b a c
Levels: a b c

as you'd expect.

 
   ## change ordering in existing factor
   levels(f) - c(b, c, a)
   f

This prints

[1] b c c b a
Levels: b c a

which might be a surprise if you wanted the order c(a, b, b, a, 
c).  If you don't want to change the values, use

f - factor(f, levels=c(b, c, a))
f

which prints

[1] a b b a c
Levels: b c a

Duncan Murdoch
 
   ## create from scratch
 
 
 
 I would be most grateful for a pointer toward the solution.

 Thanks,
 MK
 _
 Professor Michael Kubovy
 University of Virginia
 Department of Psychology
 USPS: P.O.Box 400400Charlottesville, VA 22904-4400
 Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, VA 22903
 Office:B011+1-434-982-4729
 Lab:B019+1-434-982-4751
 Fax:+1-434-982-4766
 WWW:http://www.people.virginia.edu/~mk9y/

 __
 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.


Re: [R] Don't understand write.csv default: Why is column name for column of row names blank?

2007-10-31 Thread Gabor Grothendieck
Would this be good enough:

# example using builtin BOD data frame
write.csv(cbind(Z = row.names(BOD), BOD), row.names = FALSE)


On Oct 31, 2007 7:04 PM, Earl F. Glynn [EMAIL PROTECTED] wrote:
 I've always been frustrated that R never puts a label on the column name for
 a column of row names.  This is usually the key in a database table, and
 it sure would be nice to carry a key name along with the data instead of
 the field being blank.  So, why is it a good idea for it to be blank?

 ?write.csv  says this:

CSV files
By default there is no column name for a column of row names. If
 col.names = NA and row.names = TRUE
a blank column name is added, which is the convention used for CSV files
 to be read by spreadsheets.


 This last sentence doesn't make any sense to me:  the convention used for
 CSV files to be read by spreadsheets.  Spreadsheets don't care whether this
 column is blank or has useful information.  R may have a convention to leave
 the column name for a column of row names blank (I don't understand why),
 but most other applications do not.

 I seem to spend a lot of time trying to get this blank field fixed since
 it's just not right to have a database key be blank.  I often must
 manually edit the .csv file written by R since that's easier than the kludge
 to put the column names in a new column one so they can have a column name
 too, and then suppress the row names in the write.csv.

 What am I missing?  Is there an easy way to fill this blank field  with a
 useful name for a database key when using write.csv defaults?

 Thanks for any insight on this.

 efg

 Earl F. Glynn
 Scientific Programmer
 Stowers Institute for Medical Research

 __
 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.


Re: [R] Don't understand write.csv default: Why is column name for column of row names blank?

2007-10-31 Thread jim holtman
The nice thing about R is that you can always extend it in any manner
that you want.  Here is some code (that you could put in a function
wrapper) that will do what you want.  It just creates the header,
writes it out, and then the dataframe itself without a column header:

out - file('/tempxx.csv', 'w') #output file
header - paste(c(DB KEY, names(BOD)), collapse=',')  # column names
cat(header, '\n', file=out)  #write it out
write.table(BOD, out, sep=',', col.names=FALSE)  #rest of table
close(out)



On 10/31/07, Earl F. Glynn [EMAIL PROTECTED] wrote:
 I've always been frustrated that R never puts a label on the column name for
 a column of row names.  This is usually the key in a database table, and
 it sure would be nice to carry a key name along with the data instead of
 the field being blank.  So, why is it a good idea for it to be blank?

 ?write.csv  says this:

CSV files
By default there is no column name for a column of row names. If
 col.names = NA and row.names = TRUE
a blank column name is added, which is the convention used for CSV files
 to be read by spreadsheets.


 This last sentence doesn't make any sense to me:  the convention used for
 CSV files to be read by spreadsheets.  Spreadsheets don't care whether this
 column is blank or has useful information.  R may have a convention to leave
 the column name for a column of row names blank (I don't understand why),
 but most other applications do not.

 I seem to spend a lot of time trying to get this blank field fixed since
 it's just not right to have a database key be blank.  I often must
 manually edit the .csv file written by R since that's easier than the kludge
 to put the column names in a new column one so they can have a column name
 too, and then suppress the row names in the write.csv.

 What am I missing?  Is there an easy way to fill this blank field  with a
 useful name for a database key when using write.csv defaults?

 Thanks for any insight on this.

 efg

 Earl F. Glynn
 Scientific Programmer
 Stowers Institute for Medical Research

 __
 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.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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] Axis Location/Data view in scatterplot3d

2007-10-31 Thread Duncan Murdoch
On 31/10/2007 5:51 PM, Bret Collier wrote:
 All,
 
 I constructed a fairly simple plot using the below and scatterplot3d. 
 However, the axis locations in scatterplot3d seem to 'hide' quite a bit 
 of the points in my graphic based on the viewing angle, hence not 
 adhering to Tufte's rules.  I tried to determine if I could rotate the 
 graph and relocate all three axis (origin (0, 0, 0))so they would be at 
 the back left so the plotted points would slope down toward the viewer. 
   Using 'angle' and 'axis' did not get me any closer.  Does anyone have 
 any suggestions?
 
 TIA,
 Bret
 
 for(Days_Nesting in 1:55){
 Breeding_Period-1:118
 DSR_RGWT= exp(6.6205449-0.0589883*Days_Nesting)/(1+ 
 exp(6.6205449-0.0589883*Days_Nesting))
 DSR_BS-DSR_RGWT^Breeding_Period
 DSR_Final-as.data.frame(cbind(Days_Nesting, Breeding_Period, DSR_BS))
 write(c(t(DSR_Final)), location.txt, append=T, ncolumns=3)
 }
 dsr_data-read.delim(location.txt, header=F, sep=)
 attach(dsr_data)
 scatterplot3d(V1, V2, V3, grid=F, box=T, pch=20, xlim=c(1, 
 55),ylim=c(1,118), zlim=c(0, 1))

The plot3d() function in rgl allows manipulation of the viewpoint, and 
fairly flexible specification of the axes.

Duncan Murdoch

__
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] RWeka and naiveBayes

2007-10-31 Thread Sancar Adali
Hi
I'm trying to use RWeka to use a NaiveBayes Classifier(the Weka
version). However it crashes whenever there is a NA in the class
Gender

Here is the.code I have with d2 as the data frame.
The first call to NB doesn't make R crash but the second call does.

NB - make_Weka_classifier(weka/classifiers/bayes/NaiveBayesSimple)

d2[,64]-d2$Gender==M
NB(Gender~age,d2,na.action=na.exclude)   #1st call

d2$Gender[d2$Gender==]-NA


valid.set-(!is.na(d2$Gender)(!is.na(d2$age)))
NB(formula=Gender~age,data=d2[valid.set,],subset=valid.set,na.action=na.exclude)



Anybody have an idea how to fix this. or a very detailed explanation
of how to use naiveBayes function from e1071 package? I tried using
this function , too. However I can't figure out what the returning
error means?

naiveBayes(formula=Gender~age,data=d2[valid.set,],subset=valid.set,na.action=na.exclude)

I get the following error
Error in tapply(var, y, mean, na.rm = TRUE) :
arguments must have same length


Thanks
-- 
Sancar Adali
Johns Hopkins University
Graduate Student

__
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 me in Cochran armitage trend test Coding

2007-10-31 Thread Shibu John
Dear sir,

I am Shibu John from Thrombosis Research Institute India. It is a
multidisciplinary organisation concerned with the interrelated problems of
thrombosis and atherosclerosis.

I was searching for Cochran armitage trend test program in R. Then I had
seen your R coding for C-A trend test.  I tried that in the R software.
But I can’t run the program due the [Error: could not find function
independence_test]. Where is the declaration of this function?

I was trying the trend test for Genotype frequency in Cases and controls.
So I would like to know how to do the Monte carlo simulation test with
Cochran armitage trend test.

Sir can you please help me to solve the problem.



Here I copied the codes from R

 library(coin)
Loading required package: survival
Loading required package: splines
Loading required package: mvtnorm
Error: package 'modeltools' required by 'coin' could not be found
In addition: Warning messages:
1: package 'coin' was built under R version 2.6.0
2: package 'survival' was built under R version 2.5.1
3: package 'mvtnorm' was built under R version 2.5.1
 lungtumor - data.frame(dose = rep(c(0, 1, 2), c(40, 50, 48)),
+ tumor = c(rep(c(0, 1), c(38, 2)),
+ rep(c(0, 1), c(43, 7)),
+ rep(c(0, 1), c(33, 15
 table(lungtumor$dose, lungtumor$tumor)

 0  1
  0 38  2
  1 43  7
  2 33 15
 independence_test(tumor ~ dose, data = lungtumor, teststat = quad)
Error: could not find function independence_test




sincerely,

Shibu John
Research Assistant
Department of Bioinformatics
Thrombosis Research Institute
Narayana Hrudayalaya
258/A Bommasandra Industrial Area, Anekal Taluk
Bangalore 560099, India

__
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] Lattice: par.ylab.text alpha ?

2007-10-31 Thread Deepayan Sarkar
On 11/1/07, Folkes, Michael [EMAIL PROTECTED] wrote:



 wohoo!  A bug.  I know I wasn't the first to find it, but I had a hunch this
 time that it was going to be a bug and not just my poor understanding.  I
 wasn't really thinking as just ylab= works fine too.  I think I was hoping
 to squeeze it (the ylab) closer to the axis w/o axis labels.

There's nothing specially meant for ylab, but you can supply a factor
for all layout widths and heights; e.g., compare

xyplot(1 ~ 1, ylab = foo, par.settings = list(layout.widths = list(ylab = 2)))
xyplot(1 ~ 1, ylab = foo, par.settings = list(layout.widths = list(ylab = 0)))

 Now that we're on topic.  If I turn off the axes lines using alpha, is there
 a way to turn on just axis 1/2/3/4?

Not sure exactly what you mean, but try variants of

xyplot(1 ~ 1, scales = list(alternating = 0/1/2/3, tck = 0/1))

-Deepayan

__
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] Updating packages

2007-10-31 Thread John Field
I've just updated from R-2.5.1 to R-2.6.0, under Windows XP.  Is 
there a simple way to reload into R-2.6.0 all the packages I had 
loaded under R-2.5.1?
Thanks,
John
=
John Field Consulting Pty Ltd
10 High Street, Burnside SA 5066 Australia
Phone +61 8 8332 5294 or +61 409 097 586
Fax   +61 8 8332 1229
Email  [EMAIL PROTECTED]

__
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] loops sampling

2007-10-31 Thread Garth.Warren
Hi,

 

I'm new to R (and statistics) and my boss has thrown me in the deep-end with 
the following task: 

 

We want to evaluate the impact that sampling size has on our ability to create 
a robust model, or evaluate how robust the model is to sample size for the 
purpose of cross-validation i.e. in our current project we have collected a 
series of independent data at 250 locations, from which we have built a 
predictive model, we want to know whether we could get away with collecting 
fewer samples and still build a decent model; for the obvious operational 
reasons of cost, time spent in the field etc.. 

 

Our thinking was that we could apply a bootstrap type procedure:

 

We would remove 10 records or samples from the total n=250 and then replace 
those 10 removed with replacements (or copies) from the remaining 240. With 
this new data-frame we would apply our model and calculate an r², we would then 
repeat through looping 1000 times before generating the mean r² from those 1000 
r² values generated. After which we would start the process again by remove 20 
samples from our data with replacements from the remaining 230 records and so 
on... 

 

Below is a simplified version of the real code which contains most of the basic 
elements. My main problem is I'm not sure what the 'for(i in 1:nboot)' line is 
doing, originally I though what this meant was that it removed 1 sample or 
record from the data which was replaced by a copy of one of the records from 
the remaining n, such that 'for(i in 10:nboot)' when used in the context of the 
below code removed 10 samples with replacements as I have said above. I'm 
almost positive that this isn't happening and if not how can I make the code 
below for example do what we want it to? 

 

library(utils)

#data

a - c(5.5, 2.3, 8.5, 9.1, 8.6, 5.1)

b - c(5.2, 2.2, 8.6, 9.1, 8.8, 5.7)

c - c(5.0,14.6, 8.9, 9.0, 9.1, 5.5)

#join

abc - data.frame(a,b,c)

#set column names

names(abc)[1]-y

names(abc)[2]-x1

names(abc)[3]-x2

abc2 - abc

#sample

abc3 - as.data.frame(t(as.matrix(data.frame(abc2

n - length(abc2)

npboot.function - function(nboot)

{

boot.cor - vector(length=nboot)

for(i in 1:nboot){

rdata - sample(abc3,n,replace=T)

abc4 - as.data.frame(t(as.matrix(data.frame(rdata

model - lm(asin(sqrt(abc4$y/100)) ~ I(abc4$x1^2) + abc4$x2)

boot.cor[i] - cor(abc4$y, model$fit)}

boot.cor

}

bt.cor - npboot.function(nboot=10)

bootmean - mean(bt.cor)

 

 

Any assistance would be greatly appreciated, also the sooner the better as we 
are under pressure to reach a conclusion.

 

Cheers,

 

Garth


[[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 me in Cochran armitage trend test Coding

2007-10-31 Thread Henric Nilsson (Public)


Shibu John wrote:
 Dear sir,
 
 I am Shibu John from Thrombosis Research Institute India. It is a
 multidisciplinary organisation concerned with the interrelated problems of
 thrombosis and atherosclerosis.
 
 I was searching for Cochran armitage trend test program in R. Then I had
 seen your R coding for C-A trend test.  I tried that in the R software.
 But I can’t run the program due the [Error: could not find function
 independence_test]. Where is the declaration of this function?

In the `coin' package.

 
 I was trying the trend test for Genotype frequency in Cases and controls.
 So I would like to know how to do the Monte carlo simulation test with
 Cochran armitage trend test.
 
 Sir can you please help me to solve the problem.
 
 
 
 Here I copied the codes from R
 
 library(coin)
 Loading required package: survival
 Loading required package: splines
 Loading required package: mvtnorm
 Error: package 'modeltools' required by 'coin' could not be found

So, you need to install package `modeltools'...

 In addition: Warning messages:
 1: package 'coin' was built under R version 2.6.0
 2: package 'survival' was built under R version 2.5.1
 3: package 'mvtnorm' was built under R version 2.5.1

Since you've failed to provide the result of `sessionInfo()', we don't 
know which version of R and the packages you've installed or your platform.

In any case, packages should be built using the R version you intend to 
use them under. Here, judging from the above warnings, you have package 
built under a mix of R 2.6.0 and 2.5.1. And since it complains about 
both, I guess your running neither.

So, (re-)install R 2.6.0, the `coin' package and all its dependencies 
and everything is more likely to work. (As it does for me.)


HTH,
Henric



 lungtumor - data.frame(dose = rep(c(0, 1, 2), c(40, 50, 48)),
 + tumor = c(rep(c(0, 1), c(38, 2)),
 + rep(c(0, 1), c(43, 7)),
 + rep(c(0, 1), c(33, 15
 table(lungtumor$dose, lungtumor$tumor)
 
  0  1
   0 38  2
   1 43  7
   2 33 15
 independence_test(tumor ~ dose, data = lungtumor, teststat = quad)
 Error: could not find function independence_test
 
 
 
 sincerely,
 
 Shibu John
 Research Assistant
 Department of Bioinformatics
 Thrombosis Research Institute
 Narayana Hrudayalaya
 258/A Bommasandra Industrial Area, Anekal Taluk
 Bangalore 560099, India
 
 __
 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.