RE: [R] special symobol / character

2005-02-15 Thread FISCHER, Matthew


Hi Eric,

Thanks for your speedy reply,  I should have noted
that I'm using a Linux machine.  However, when I copy
the symbol from Windows to Linux (using R/emacs) via an x-win 32 window
it replaces the per mille symbol with a /211.
R then produces the character (not a per mille symbol!)
that can be found in the equivalent place
using character.table() in the Hmisc package.  I'd use
windows, except we have huge output datasets generated
by a climate model, and its not possible to move it to a machine
running windows.

Any other suggestions are welcome!,

cheers,

Matt.



-Original Message-
From: Eric Lecoutre [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 February 2005 18:54
To: FISCHER, Matthew; 'r-help@stat.math.ethz.ch'
Subject: Re: [R] special symobol / character



Hi Matthew,

Most systems allow to enter any ASCII (or extended ASCII) character 
directly using a key combination.
Accessing ANSI charcaters under Windows is possible with:
ALT+0xxx (press ALT, hold it down, press 0 and the number of the character, 
release ALT)
Thus: ALT+0137 makes: ?
The future seems promising with the Unicode support: kudo R core team!

Eric


At 08:23 15/02/2005, FISCHER, Matthew wrote:

Hi all,

 Is it possible to add a permil (or per mille) symbol to
an R plot (I couldn't find this symbol under demo(Hershey) or
the plotmath information).

In some ascii tables it is symbol no. 137.

cheers,

Matt.

 [[alternative HTML version deleted]]

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

Eric Lecoutre
UCL /  Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium

tel: (+32)(0)10473050
[EMAIL PROTECTED]
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre

If the statistics are boring, then you've got the wrong numbers. -Edward 
Tufte

[[alternative HTML version deleted]]

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


Re :Off topic -- large data sets. Was RE: [R] 64 Bit R Background Question

2005-02-15 Thread Naji

Hi,


Also I agree those cases are relatively rare in STATISTICAL analysis, you
can encounter them for simulation topics (natural catalysm a 5 meter in the
topographics can change all the simulations)
Two ideas (in addition to loading several sections) is
1- to search for duplicate cases and estimate your model upon a frequency
weighted shema, perhaps you don't have 200millions different 'cases'
2- take into account your data and model the used algorythm
precision/accuracy, (i.e. No need to take into account 1million case, a
precision close to .001, if the gradient, or any other function used, has a
.01 accuracy) ...

Best regards
Naji

Le 14/02/05 18:41, « Berton Gunter » [EMAIL PROTECTED] a écrit :

 
 read all 200 million rows a pipe dream no matter what
 platform I'm using?
 
 In principle R can handle this with enough memory. However,
 200 million 
 rows and three columns is 4.8Gb of storage, and R usually needs a few
 times the size of the data for working space.
 
 You would likely be better off not reading the whole data set
 at once, but 
 loading sections of it from Oracle as needed.
 
 
 -thomas
 
 
 Thomas's comment raises a question:
 
 Can comeone give me an example (perhaps in a private response, since I'm off
 topic here) where one actually needs all cases in a large data set (large
 being  1e6, say) to do a STATISTICAL analysis? By statistical I exclude,
 say searching for some particular characteristic like an adverse event in a
 medical or customer repair database, etc. Maybe a definition of
 statistical is: anything that cannot be routinely done in a single pass
 database query.
 
 The reason I ask this is that it seems to me that with millions of cases,
 (careful, perhaps stratified or in some other not completely at random way)
 sampling should always suffice to reduce a dataset to manageable size
 sufficient for the data analysis needs at hand. But my ignorance and naivete
 probably show here.
 
 Thanks.
 
 -- Bert
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


RE: [R] special symobol / character

2005-02-15 Thread Prof Brian Ripley
On Tue, 15 Feb 2005, FISCHER, Matthew wrote:
   Thanks for your speedy reply,  I should have noted
that I'm using a Linux machine.  However, when I copy
the symbol from Windows to Linux (using R/emacs) via an x-win 32 window
it replaces the per mille symbol with a /211.
\211 I hope.  (That is octal for 137.)
R then produces the character (not a per mille symbol!)
that can be found in the equivalent place
using character.table() in the Hmisc package.  I'd use
windows, except we have huge output datasets generated
by a climate model, and its not possible to move it to a machine
running windows.
Any other suggestions are welcome!,
Note that this is not as you claimed an ASCII symbol and it is not even an 
ISO Latin-1 symbol.  The area 128 to 143 is a control area in almost all 
encodings except WinAnsi, which is what you are using on Windows, I 
believe.

Try `man ascii' on your Linux system.
per mille is not AFAICS in the Adobe symbol font that plotmath uses, and 
so it cannot be added there.  In any case, it is text-like, not a symbol 
(you would want it in the same font as %).

It is the Unicode character U+2030, so you will be able to use it in a 
UTF-8 locale in R-2.1.0 via \u2030.


-Original Message-
From: Eric Lecoutre [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 February 2005 18:54
To: FISCHER, Matthew; 'r-help@stat.math.ethz.ch'
Subject: Re: [R] special symobol / character

Hi Matthew,
Most systems allow to enter any ASCII (or extended ASCII) character
directly using a key combination.
Accessing ANSI charcaters under Windows is possible with:
ALT+0xxx (press ALT, hold it down, press 0 and the number of the character,
release ALT)
Thus: ALT+0137 makes: ?
The future seems promising with the Unicode support: kudo R core team!
Eric
At 08:23 15/02/2005, FISCHER, Matthew wrote:
Hi all,
Is it possible to add a permil (or per mille) symbol to
an R plot (I couldn't find this symbol under demo(Hershey) or
the plotmath information).
In some ascii tables it is symbol no. 137.

--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] convolution of functions

2005-02-15 Thread Mari Luz Gamiz Perez
Dear sir,

we would like to know if there exist  any  R package containing the
computational performance of  the n-fold Stieljes' convolution of functions. 


We look forward to hearing from you.

Thank you in advance.







M.Luz Gámiz Pérez
Dpt. Estadística e Investigación Operativa
Facultad de Ciencias
Universidad de Granada
Telf.: 958-243156
e-mail: [EMAIL PROTECTED]

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


[R] update.packages - delete downloaded - N

2005-02-15 Thread Heinz Tuechler
Hello,

Using Update Packages from CRAN in R Version 2.0.1 Patched (2005-01-15)
under Windows 98, I found it tricky to save the downloaded files.
Even if I answer N to the question, if the downloaded files should be
deleted, they are deleted after R is quitted. I understood that I have to
copy them to a different location before quitting R. Is this an intended
behavoiur of R or did I miss some instruction?

Heinz Tüchler

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


Re: [R] update.packages - delete downloaded - N

2005-02-15 Thread Uwe Ligges
Heinz Tuechler wrote:
Hello,
Using Update Packages from CRAN in R Version 2.0.1 Patched (2005-01-15)
under Windows 98, I found it tricky to save the downloaded files.
Even if I answer N to the question, if the downloaded files should be
deleted, they are deleted after R is quitted. I understood that I have to
copy them to a different location before quitting R. Is this an intended
behavoiur of R or did I miss some instruction?
Yes, intended, yes, you missed destdir:
It is intended to save in tempdir() by default.
You can specify argument destdir, if you want something different.
Uwe Ligges

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


[R] Tests on contingency tables

2005-02-15 Thread Jacques VESLOT
Dear all,

I have a dataset with qualitative variables (factors) and I want to test the
null hypothesis of independance between two variables for each pair by using
appropriate tests on contingency tables.

I first applied chisq.test and obtained dependance in almost all cases with
extremely small p-values and warning messages.

 chisq.test(table(data$ins.f, data$ins.st))$p.val
[1] 4.811263e-100
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(table(data$ins.f,
data$ins.st))

I then turned to Fisher's Exact Test for Count Data, but I got only error
messages such as:

Error in fisher.test(table(data$ins.f, data$ins.st)) :
FEXACT error 501.
The hash table key cannot be computed because the largest key
is larger than the largest representable int.
The algorithm cannot proceed.
Reduce the workspace size or use another algorithm.

maybe cause the dimensions of contingency tables are too large (?).

 dim(table(data$ins.f, data$ins.st))
[1] 10  8

I then tried likelihood-ratio G-statistic on contingency table (g.stats()
from hierfstat package), as follows:

 g.stats(data.frame(as.numeric(data$ins.f),as.numeric(data$ins.s)))$g.stats
[1] 486.1993

and I replaced in Chi2 distribution function to get p-value:

 1-pchisq(486.199, df=63)
[1] 0


Is there a better way to perform this or a more appropriate function
dedicated to tests on large-dimensioned contingency tables ?

Thanks in advance,

Jacques VESLOT

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


Re: [R] Problem with R CMD Rd2dvi: Rd.sty not found

2005-02-15 Thread Duncan Murdoch
On Thu, 10 Feb 2005 21:27:03 + (UTC), Gabor Grothendieck
[EMAIL PROTECTED] wrote :

Tuszynski, Jaroslaw W. JAROSLAW.W.TUSZYNSKI at saic.com writes:

: 
: Hi,
: 
: I run into a problem with R CMD Rd2dvi command: it gives me File `Rd.sty'
: not found error (See the output message on the bottom). I get the same
: error when running RCMD check. My system is: Windows 2000, R version
: 2.0.1, MiKTeX version 2.4. I do have a Rd.sty file in R_HOME/share/texm
: directory.
: 
 ...

There is some information on this at:

http://www.murdoch-sutherland.com/Rtools/miktex.html

The information there is slightly out of date:  the last version of
Miktex that I've tried has broken that solution.  I asked the author
about it, and he replied as below.

I think this is pretty poor behaviour on the part of Miktex, but in
other respects I prefer it to fptex.  

For what you're doing, you need to set up your
$R_HOME/bin/helpprint.bat file so that it makes use of the TEXINPUTS
environment variable.  You want the pdftex command to have something
like

-include-directory=%TEXINPUTS%

in it and then it will look in the right places for the includes.

Duncan Murdoch


To: Duncan Murdoch [EMAIL PROTECTED]
Subject: Re: Help with e-tex?
From: MiKTeX Support [EMAIL PROTECTED]
Date: Sun, 6 Feb 2005 22:04:15 +0100

Duncan Murdoch wrote:
 Unfortunately, these instructions do not seem to work any more with
 pdfTeX.  Sometime between these two releases:

 MiKTeX-pdfTeX 2.4.1603 (1.20a-rc4) (MiKTeX 2.4)

 MiKTeX-pdfTeX 2.4.1817 (1.20b) (MiKTeX 2.4)

 it seems that support for TEXINPUTS was dropped from pdfTeX.

Sorry, I can confirm that TEXINPUTS isn't supported by newer versions of 
MiKTeX-pdfTeX. No promise that this will be fixed in the 2.4 branch. Sorry!

Kind regards,
Christian Schenk

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


[R] R + MacOSX + Emacs(XEmacs) + ESS

2005-02-15 Thread Ronaldo Reis-Jr.
Hi,

I try to use Emacs or XEmacs with R in a MacOS X Panter without X11.

Anybody can make this work?

How?

Thanks
Ronaldo
-- 
 Um mapa-mundi que nao inclua a utopia, nao e digno de 
 consulta, pois deixa de fora as terras a que a Humanidade 
 esta sempre apontando.
  -- Oscar Wilde
--
|   // | \\   [***]
|   ( õ   õ )  [Ronaldo Reis Júnior]
|  V  [UFV/DBA-Entomologia]
|/ \   [36571-000 Viçosa - MG  ]
|  /(.''`.)\  [Fone: 31-3899-2532 ]
|  /(: :'  :)\ [EMAIL PROTECTED]]
|/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ]
|( `-  )   [***]
|  _/   \_Powered by GNU/Debian Woody/Sarge

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


Re: [R] R + MacOSX + Emacs(XEmacs) + ESS

2005-02-15 Thread Jari Oksanen
On Tue, 2005-02-15 at 10:34 -0200, Ronaldo Reis-Jr. wrote:
 Hi,
 
 I try to use Emacs or XEmacs with R in a MacOS X Panter without X11.
 
 Anybody can make this work?

Did you try googling for macos X emacs? That's the way you get it. I
have found two different versions, both work graphically without X11.
ESS installs quite smoothly. Depending on your configuration, you may
have to use ESC for Meta instead of Alt of some other systems. So
start R in ESS using ESC-R. 

(The emacs that comes with MacOS X also is GNU Emacs, but works only
within terminal window.) 

cheers, jari oksanen
-- 
Jari Oksanen [EMAIL PROTECTED]

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


Re: [R] update.packages - delete downloaded - N

2005-02-15 Thread Heinz Tuechler
Thank you for the hint regarding the destdir parameter of update.packages.

Heinz Tüchler

At 12:15 15.02.2005 +0100, Uwe Ligges wrote:
Heinz Tuechler wrote:

 Hello,
 
 Using Update Packages from CRAN in R Version 2.0.1 Patched (2005-01-15)
 under Windows 98, I found it tricky to save the downloaded files.
 Even if I answer N to the question, if the downloaded files should be
 deleted, they are deleted after R is quitted. I understood that I have to
 copy them to a different location before quitting R. Is this an intended
 behavoiur of R or did I miss some instruction?

Yes, intended, yes, you missed destdir:

It is intended to save in tempdir() by default.
You can specify argument destdir, if you want something different.

Uwe Ligges


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



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


RE: [R] using poly in a linear regression in the presence of NA f ails (despite subsetting them out)

2005-02-15 Thread Liaw, Andy
My apologies:  It's another case of me not thinking statistically...  It may
also help those of us whose brains run at slow clock speeds to have ?poly,
?bs and ?ns mention how they react to NAs.

Best,
Andy


 From: Prof Brian Ripley 
 
 Andy,
 
 I don't think it is a bug.  The problem is that poly(x, 2) 
 depends on the 
 possible set of x values, and so needs to know all of them, unlike 
 e.g. log(x) which is observation-by-observation.  Silently omitting 
 missing values is not a good idea in such cases, especially 
 if the values 
 are missing in other variables (which is what na.action is 
 likely to do).
 
 I would say models with poly, ns, bs etc are inadvisable in 
 the presence 
 of missing values in their argument.  We could make poly() give an 
 informative message, though.
 
 Brian
 
 
 On Mon, 14 Feb 2005, Liaw, Andy wrote:
 
  This smells like a bug to me.  The error is triggered by the line:
 
variables - eval(predvars, data, env)
 
  inside model.frame.default().  At that point, na.action has not been
  applied, so poly() ended being called on data that still 
 contains missing
  values.  The qr() that issued the error is for generating 
 the orthogonal
  basis when evaluating poly(), not for fitting the linear 
 model itself.
 
  Essentially, calling
 
   model.frame(y ~ poly(x, 2), data=data.frame(x=c(NA, 1:3), 
 y=rnorm(4)),
   na.action=na.omit)
 
  would show the same error.  The obvious workaround is to 
 omit cases with NAs
  before calling lm().
 
  Andy
 
  From: Markus Jäntti
 
  I ran into a to me surprising result on running lm with an 
 orthogonal
  polynomial among the predictors.
 
  The lm command resulted in
 
  Error in qr(X) : NA/NaN/Inf in foreign function call (arg 1)
  Error during wrapup:
 
  despite my using a subset in the call to get rid of NA's.
 
  poly is apparently evaluated before any NA's are subsetted out
  of the data.
 
  Example code (attached to this e-mail as as a script):
   ## generate some data
   n - 50
   x - runif(n)
   a0 - 10
   a1 - .5
   sigma.e - 1
   y - a0 + a1*x + rnorm(n)*sigma.e
   tmp.d - data.frame(y, x)
   rm(list=c(n, x, a0, a1, sigma.e, y))
  
   print(lm.1 - lm(y ~ poly(x, 2), data = tmp.d)
  +
  + ## now make a few NA's
  +
  + tmp.d$x[1:2] - rep(NA, 2)
  Error: syntax error
  Error during wrapup:
  
   ## this fails, just as it should
   print(lm.1 - lm(y ~ poly(x, 2), data = tmp.d))
 
  Call:
  lm(formula = y ~ poly(x, 2), data = tmp.d)
 
  Coefficients:
  (Intercept)  poly(x, 2)1  poly(x, 2)2
10.380   -0.242   -1.441
 
  
   ## these also fail, but should not?
  
   print(lm.2 - lm(y ~ poly(x, 2), data = tmp.d, subset = 
 !is.na(x)))
 
  Call:
  lm(formula = y ~ poly(x, 2), data = tmp.d, subset = !is.na(x))
 
  Coefficients:
  (Intercept)  poly(x, 2)1  poly(x, 2)2
10.380   -0.242   -1.441
 
   print(lm.3 - lm(y ~ poly(x, 2), data = tmp.d, na.action =
  na.omit))
 
  Call:
  lm(formula = y ~ poly(x, 2), data = tmp.d, na.action = na.omit)
 
  Coefficients:
  (Intercept)  poly(x, 2)1  poly(x, 2)2
10.380   -0.242   -1.441
 
  
   ## but this works
  
   print(lm.3 - lm(y ~ poly(x, 2), data = subset(tmp.d, subset =
  !is.na(x
 
  Call:
  lm(formula = y ~ poly(x, 2), data = subset(tmp.d, subset = 
 !is.na(x)))
 
  Coefficients:
  (Intercept)  poly(x, 2)1  poly(x, 2)2
10.380   -0.242   -1.441
 
  
 
  The documentation of lm is *not* misleading at this point, 
 saying that
 
  subset an optional vector specifying a subset of
  observations to be
  used in the fitting process.
 
  which implies that data are subsetted once lm.fit is called.
  All the same, this behavior is a little unexpected to me.
  Is it to be considered a feature, that is, does it produce 
 beneficial
  side effects which explain why it works as it does?
 
  Regards,
 
  Markus
 
  I am running R on a Debian testing system with kernel 2.6.10 and
 
   version
_
  platform i386-pc-linux-gnu
  arch i386
  os   linux-gnu
  system   i386, linux-gnu
  status
  major2
  minor0.1
  year 2004
  month11
  day  15
  language R
  --
  Markus Jantti
  Abo Akademi University
  [EMAIL PROTECTED]
  http://www.iki.fi/~mjantti
 
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 
 -- 
 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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 

Re: [R] Tests on contingency tables

2005-02-15 Thread Prof Brian Ripley
You can test independence via a log-linear model.  More importantly, you 
can model that dependence and learn something useful about the data.

I don't see your point here: the two factors are clearly highly dependent: 
who cares what the exact p value is?   Did you do e.g. a mosaicplot as I 
suspect the dependence is obvious in any reasonable plot?

On Tue, 15 Feb 2005, Jacques VESLOT wrote:
Dear all,
I have a dataset with qualitative variables (factors) and I want to test the
null hypothesis of independance between two variables for each pair by using
appropriate tests on contingency tables.
I first applied chisq.test and obtained dependance in almost all cases with
extremely small p-values and warning messages.
chisq.test(table(data$ins.f, data$ins.st))$p.val
[1] 4.811263e-100
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(table(data$ins.f,
data$ins.st))
I then turned to Fisher's Exact Test for Count Data, but I got only error
messages such as:
Error in fisher.test(table(data$ins.f, data$ins.st)) :
   FEXACT error 501.
The hash table key cannot be computed because the largest key
is larger than the largest representable int.
The algorithm cannot proceed.
Reduce the workspace size or use another algorithm.
maybe cause the dimensions of contingency tables are too large (?).
The help file does says
 Note this fails (with an error message) when the entries of the table
 are too large.
Note, the _entries_, not the dimensions.  The issue is how many tables 
need to be enumerated.

dim(table(data$ins.f, data$ins.st))
[1] 10  8
I then tried likelihood-ratio G-statistic on contingency table (g.stats()
from hierfstat package), as follows:
g.stats(data.frame(as.numeric(data$ins.f),as.numeric(data$ins.s)))$g.stats
[1] 486.1993
and I replaced in Chi2 distribution function to get p-value:
1-pchisq(486.199, df=63)
[1] 0
Is there a better way to perform this or a more appropriate function
dedicated to tests on large-dimensioned contingency tables ?

--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Correct effect plots from lme() objects

2005-02-15 Thread CG Pettersson
Hello all!
R2.0.1, W2k
I posted this question to the list last Sunday without getting any 
replies on the list. I got two off the list though, suggesting me to 
plot manually as a second step, from estimable() or intervals() 
objects respectively. As this was not really what I wished for, I take 
the risk to upset somebody with a trivial question, and re-post it (just 
a little edited).

So, here it is again:
I use lme() from nlme to make mean estimates from series of field
experiments where not all treatments (like variety) are present in
all experiments. (An old problem in variety evaluation).
A typical call is:
yield.lme - lme(Yield ~ Variety, data = data,
na.action = na.omit,
random = ~ 1 | Experiment/Block)
This works well, even when observations are lacking. I have checked
against the accepted method for doing this in Sweden, which is
PROC MIXED in SAS, and the fitted fixed effects are more or less
identical. I use estimable() from gmodels (gregmisc package) to
extract estimates, standard errors and such. I use matrices with the
variety names as row names, it works smooth.
What I am unable to, as yet, is to make nice plots of the estimates
for a given set of varieties. To use only the fixed call directly on
the dataset works for many plooting functions, but produces the wrong 
graphs, as the structure is not used. The structure (the random call)
has to be used, as there are NA:s in the dataset.

Pinheiro  Bates have a lot of graphics on lme objects, but they try
to illustrate more sophisticated relations than my need. I´ve looked
through gplots and the graphic parts of nlme without any hits.
Probably, my difficulties are just due to my own lack of skill. Some 
standard plotting facility plotting directly from the lme object ought 
to work, but I don´t understand how.

How should I do this?
Cheers
/CG
--
CG Pettersson MSci. PhD.Stud.
Swedish University of Agricultural Sciences (SLU)
Dep. of Ecology and Crop production sciences (EVP).
http://www.slu.se/
[EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Tests on contingency tables

2005-02-15 Thread Prof Brian Ripley
I forgot to mention a crucial statistical point:
As you are doing this pairwise, remember Simpson's paradox.
or if you don't know about it, Google it (it is not really due to 
Simpson, an instance of Stigler's Law of Eponymy).

On Tue, 15 Feb 2005, Prof Brian Ripley wrote:
You can test independence via a log-linear model.  More importantly, you can 
model that dependence and learn something useful about the data.

I don't see your point here: the two factors are clearly highly dependent: 
who cares what the exact p value is?   Did you do e.g. a mosaicplot as I 
suspect the dependence is obvious in any reasonable plot?

On Tue, 15 Feb 2005, Jacques VESLOT wrote:
Dear all,
I have a dataset with qualitative variables (factors) and I want to test 
the
null hypothesis of independance between two variables for each pair by 
using
appropriate tests on contingency tables.

I first applied chisq.test and obtained dependance in almost all cases with
extremely small p-values and warning messages.
chisq.test(table(data$ins.f, data$ins.st))$p.val
[1] 4.811263e-100
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(table(data$ins.f,
data$ins.st))
I then turned to Fisher's Exact Test for Count Data, but I got only error
messages such as:
Error in fisher.test(table(data$ins.f, data$ins.st)) :
   FEXACT error 501.
The hash table key cannot be computed because the largest key
is larger than the largest representable int.
The algorithm cannot proceed.
Reduce the workspace size or use another algorithm.
maybe cause the dimensions of contingency tables are too large (?).
The help file does says
Note this fails (with an error message) when the entries of the table
are too large.
Note, the _entries_, not the dimensions.  The issue is how many tables need 
to be enumerated.

dim(table(data$ins.f, data$ins.st))
[1] 10  8
I then tried likelihood-ratio G-statistic on contingency table (g.stats()
from hierfstat package), as follows:
g.stats(data.frame(as.numeric(data$ins.f),as.numeric(data$ins.s)))$g.stats
[1] 486.1993
and I replaced in Chi2 distribution function to get p-value:
1-pchisq(486.199, df=63)
[1] 0
Is there a better way to perform this or a more appropriate function
dedicated to tests on large-dimensioned contingency tables ?

--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] R, MacOSX G5 bi-proc

2005-02-15 Thread Liaw, Andy
You can use the snow package on CRAN.  I don't know if RPVM/RMPI work on the
Macs, but they are also on CRAN.

Andy

 From: Naji
 
 Hi all,
 
 
 I've downloaded binary files from CRAN to install R and it's 
 working quite
 fine..I'm wandering if I can take advantage of two processors 
 from the Mac.
 Where can I find lecture/help for this?
 
 
 Thanks in advance
 Naji
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


[R] memory problem with package mix

2005-02-15 Thread Delphine . Gille

Hello,

I think we have a memory problem with  em.mix.

We have done:

library(mix)
Manq - read.table(C:/.../file.txt)
attach(Manq)
Manq
V1 V2 V3 V4 .V27
 1  1  1  1  1...
 2  1 NA  3  6
 3  1  2  6  2
 ...
 ...
 300  2  NA  6  2...

 Essaimanq -prelim.mix(as.matrix(Manq),5)
 test - em.mix(Essaimanq)
 error cannot allocated vector of size 535808 KB
   in addition : warning message reached total allocation of 509MB

Thank you

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


[R] matlab norm(h) command in R: sqrt(sum(h^2)) - use in an expression

2005-02-15 Thread Christoph Lehmann
Hi
in matlab I defined a function (double gamma, parameters at the end of 
this mail) as
  h(i)=((t/d1)^a1)*exp(-(t-d1)/b1)-c*((t/d2)^a2)*exp(-(t-d2)/b2);
  h=h/norm(h);

I do know that norm() in matlab is equal to:
  sqrt(sum(x^2))
in R
so in R I do it like:
#function (double gamama)
h - expression((t/d1)^a1*exp(-(t-d1)/b1)-c*(t/d2)^a2*exp(-(t-d2)/b2))
# plot it
t - seq(0, 2, by = 100)
t - t/1000
plot(eval(h), type = 'l')
# however this yields an error
h - h/sqrt(sum(h^2))
Error in h^2 : non-numeric argument to binary operator
what shall I do to get the matlab: h = h/norm(h) implemented in R?
thanks for a hint
christoph

# parameters
peak1 - 5.4
fwhm1 - 5.2
peak2 - 10.8
fwhm2 - 7.35
dip - 0.35
b1 - 0.9 # dispersion
b2 - 0.9 #dispersion
a1 - peak1/b1
a2 - peak2/b2
d1 - a1*b1
d2 - a2*b2
c - dip
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] matlab norm(h) command in R: sqrt(sum(h^2)) - use in an e xpression

2005-02-15 Thread Liaw, Andy
 From: Christoph Lehmann
 
 Hi
 
 in matlab I defined a function (double gamma, parameters at 
 the end of 
 this mail) as
h(i)=((t/d1)^a1)*exp(-(t-d1)/b1)-c*((t/d2)^a2)*exp(-(t-d2)/b2);
h=h/norm(h);
 
 I do know that norm() in matlab is equal to:
 
sqrt(sum(x^2))
 in R
 so in R I do it like:
 
 #function (double gamama)
 h - expression((t/d1)^a1*exp(-(t-d1)/b1)-c*(t/d2)^a2*exp(-(t-d2)/b2))
 
 # plot it
 t - seq(0, 2, by = 100)
 t - t/1000
 plot(eval(h), type = 'l')
 
 # however this yields an error
 h - h/sqrt(sum(h^2))
   ^  ^

Those are still expressions, not vectors.  You need to wrap those in eval()
as you did in plot(), or do h - eval(h) beforehand.

Andy




 Error in h^2 : non-numeric argument to binary operator
 
 what shall I do to get the matlab: h = h/norm(h) implemented in R?
 
 thanks for a hint
 
 christoph
 
 
 
 # parameters
 peak1 - 5.4
 fwhm1 - 5.2
 peak2 - 10.8
 fwhm2 - 7.35
 dip - 0.35
 
 b1 - 0.9 # dispersion
 b2 - 0.9 #dispersion
 a1 - peak1/b1
 a2 - peak2/b2
 d1 - a1*b1
 d2 - a2*b2
 c - dip
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


RE: [R] Tests on contingency tables

2005-02-15 Thread Jacques VESLOT
Thanks a lot for your help !

Right ! According to tables, most factors look indeed highly dependent...
but, because of strange p-values and warning messages, as I tried to test it
with Chisquare test, and because Fisher's Exact Test function doesn't work
on my data, I wondered whether there were other functions to perform such
tests.

I will try with test independence via a log-linear model.
Is this code correct ? (I can't catch exactly how to put 'formula' argument)

 z - table(data$fac1, data$fac2)
 names(dimnames(z)) - c(fac1, fac2)
 fm - loglm(~ins+pl,z)
 fm
Call:
loglm(formula = ~ins + pl, data = z)

Statistics:
  X^2 df P( X^2)
Likelihood Ratio 286.1236 490
Pearson  450.5332 490


Jacques

-Message d'origine-
De : Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Envoye : mardi 15 fevrier 2005 17:41
A : Jacques VESLOT
Cc : R-HELP; [EMAIL PROTECTED]
Objet : Re: [R] Tests on contingency tables


You can test independence via a log-linear model.  More importantly, you
can model that dependence and learn something useful about the data.

I don't see your point here: the two factors are clearly highly dependent:
who cares what the exact p value is?   Did you do e.g. a mosaicplot as I
suspect the dependence is obvious in any reasonable plot?

On Tue, 15 Feb 2005, Jacques VESLOT wrote:

 Dear all,

 I have a dataset with qualitative variables (factors) and I want to test
the
 null hypothesis of independance between two variables for each pair by
using
 appropriate tests on contingency tables.

 I first applied chisq.test and obtained dependance in almost all cases
with
 extremely small p-values and warning messages.

 chisq.test(table(data$ins.f, data$ins.st))$p.val
 [1] 4.811263e-100
 Warning message:
 Chi-squared approximation may be incorrect in:
chisq.test(table(data$ins.f,
 data$ins.st))

 I then turned to Fisher's Exact Test for Count Data, but I got only error
 messages such as:

 Error in fisher.test(table(data$ins.f, data$ins.st)) :
FEXACT error 501.
 The hash table key cannot be computed because the largest key
 is larger than the largest representable int.
 The algorithm cannot proceed.
 Reduce the workspace size or use another algorithm.

 maybe cause the dimensions of contingency tables are too large (?).

The help file does says

  Note this fails (with an error message) when the entries of the table
  are too large.

Note, the _entries_, not the dimensions.  The issue is how many tables
need to be enumerated.

 dim(table(data$ins.f, data$ins.st))
 [1] 10  8

 I then tried likelihood-ratio G-statistic on contingency table (g.stats()
 from hierfstat package), as follows:


g.stats(data.frame(as.numeric(data$ins.f),as.numeric(data$ins.s)))$g.stats
 [1] 486.1993

 and I replaced in Chi2 distribution function to get p-value:

 1-pchisq(486.199, df=63)
 [1] 0


 Is there a better way to perform this or a more appropriate function
 dedicated to tests on large-dimensioned contingency tables ?


--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] matlab norm(h) command in R: sqrt(sum(h^2)) - use in anexpression

2005-02-15 Thread Dimitris Rizopoulos
you are trying to square an expression not an number! try this:
h.fun - function(tt) ((tt/d1)^a1) * exp(-(tt-d1)/b1) - 
cc*((tt/d2)^a2) * exp(-(tt-d2)/b2)

h - h.fun(tt)
h - h/sqrt(sum(h*h))
I hope it helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm

- Original Message - 
From: Christoph Lehmann [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Tuesday, February 15, 2005 3:45 PM
Subject: [R] matlab norm(h) command in R: sqrt(sum(h^2)) - use in 
anexpression


Hi
in matlab I defined a function (double gamma, parameters at the end 
of this mail) as
  h(i)=((t/d1)^a1)*exp(-(t-d1)/b1)-c*((t/d2)^a2)*exp(-(t-d2)/b2);
  h=h/norm(h);

I do know that norm() in matlab is equal to:
  sqrt(sum(x^2))
in R
so in R I do it like:
#function (double gamama)
h - 
expression((t/d1)^a1*exp(-(t-d1)/b1)-c*(t/d2)^a2*exp(-(t-d2)/b2))

# plot it
t - seq(0, 2, by = 100)
t - t/1000
plot(eval(h), type = 'l')
# however this yields an error
h - h/sqrt(sum(h^2))
Error in h^2 : non-numeric argument to binary operator
what shall I do to get the matlab: h = h/norm(h) implemented in R?
thanks for a hint
christoph

# parameters
peak1 - 5.4
fwhm1 - 5.2
peak2 - 10.8
fwhm2 - 7.35
dip - 0.35
b1 - 0.9 # dispersion
b2 - 0.9 #dispersion
a1 - peak1/b1
a2 - peak2/b2
d1 - a1*b1
d2 - a2*b2
c - dip
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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


[R] D(eval(g)) problem, since Function `eval' is not in the derivatives table

2005-02-15 Thread Christoph Lehmann
thanks Andy and Dimitris for your reply to my expression/eval - problem
starting with the resulting expression g I need g's derivative as 
expression, but I get: Function `eval' is not in the derivatives table:

#function (double gamama)
h - expression((t/d1)^a1*exp(-(t-d1)/b1)-c*(t/d2)^a2*exp(-(t-d2)/b2))
# plot it
t - seq(0, 2, by = 100)
t - t/1000
g - expression(eval(h)/sqrt(sum(eval(h)^2)))
plot(eval(g), type = 'l')
g.deriv - D(g, t)
 Error in D(g, t) : Function `eval' is not in the derivatives table
is there any way one can solve this problem?
thanks a lot
christoph

## --
## parameters
peak1 - 5.4
fwhm1 - 5.2
peak2 - 10.8
fwhm2 - 7.35
dip - 0.35
b1 - 0.9 # dispersion
b2 - 0.9 #dispersion
a1 - peak1/b1
a2 - peak2/b2
d1 - a1*b1
d2 - a2*b2
c - dip
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] convolution of functions

2005-02-15 Thread Huntsinger, Reid
If you mean the convolution 

(f*g)(x) = integral f(x-y)g(y) dy 

for integrable functions f and g on R^n, then I think using the fact that
the Fourier transform of the convolution is the product of the Fourier
transforms of f and g is the most efficient approach, unless f or g have
some special structure.

For this you just need fft() in base R. You do have to do a little
bookkeeping to manage the discretizations.

Reid Huntsinger

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mari Luz Gamiz Perez
Sent: Tuesday, February 15, 2005 5:19 AM
To: r-help@stat.math.ethz.ch
Subject: [R] convolution of functions


Dear sir,

we would like to know if there exist  any  R package containing the
computational performance of  the n-fold Stieljes' convolution of functions.



We look forward to hearing from you.

Thank you in advance.







M.Luz Gámiz Pérez
Dpt. Estadística e Investigación Operativa
Facultad de Ciencias
Universidad de Granada
Telf.: 958-243156
e-mail: [EMAIL PROTECTED]

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

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


Re: [R] Correct effect plots from lme() objects

2005-02-15 Thread Deepayan Sarkar
On Tuesday 15 February 2005 08:15, CG Pettersson wrote:
 Hello all!

 R2.0.1, W2k

 I posted this question to the list last Sunday without getting any
 replies on the list. I got two off the list though, suggesting me to
 plot manually as a second step, from estimable() or intervals()
 objects respectively. As this was not really what I wished for, I
 take the risk to upset somebody with a trivial question, and re-post
 it (just a little edited).

 So, here it is again:

 I use lme() from nlme to make mean estimates from series of field
 experiments where not all treatments (like variety) are present in
 all experiments. (An old problem in variety evaluation).

 A typical call is:

 yield.lme - lme(Yield ~ Variety, data = data,
  na.action = na.omit,
  random = ~ 1 | Experiment/Block)

 This works well, even when observations are lacking. I have checked
 against the accepted method for doing this in Sweden, which is
 PROC MIXED in SAS, and the fitted fixed effects are more or less
 identical. I use estimable() from gmodels (gregmisc package) to
 extract estimates, standard errors and such. I use matrices with the
 variety names as row names, it works smooth.

 What I am unable to, as yet, is to make nice plots of the estimates
 for a given set of varieties. To use only the fixed call directly on
 the dataset works for many plooting functions, but produces the wrong
 graphs, as the structure is not used. The structure (the random call)
 has to be used, as there are NA:s in the dataset.

It's not clear to me what you are looking for. In particular, exactly 
what 'estimates' do you want to plot? Could you give us a reproducible 
example (preferably using a dataset from nlme) and describe the plot 
you are looking for in terms of that example?

Deepayan

 Pinheiro  Bates have a lot of graphics on lme objects, but they try
 to illustrate more sophisticated relations than my need. I´ve looked
 through gplots and the graphic parts of nlme without any hits.
 Probably, my difficulties are just due to my own lack of skill. Some
 standard plotting facility plotting directly from the lme object
 ought to work, but I don´t understand how.

 How should I do this?

 Cheers
 /CG

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


[R] shrinkage estimates in lme

2005-02-15 Thread Bill Shipley
Hello.  Slope estimates in lme are shrinkage estimates which pull the
OLS slope estimates towards the population estimates, the degree of
which depends on the group sample size and the distance between the
group-based estimate and the overall population estimate.  Although
these shrinkage estimates as said to be more precise with respect to the
true values, they are also biased.  So there is a tradeoff between
precision and bias.

Are there rules of thumb to help determine when it is better to use the
OLS slope estimates and when to use the mixed model (lme) shrinkage
estimates?  I have 35 groups but the numbers per group vary from over 50
to as low as 4.

Thanks for any help.

 

Bill Shipley

Subject Matter Editor, Ecology

North American Editor, Annals of Botany

Département de biologie, Université de Sherbrooke,

Sherbrooke (Québec) J1K 2R1 CANADA

[EMAIL PROTECTED]

 http://callisto.si.usherb.ca:8080/bshipley/
http://callisto.si.usherb.ca:8080/bshipley/

 


[[alternative HTML version deleted]]

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


Re: [R] lattice multiple plots per page

2005-02-15 Thread Deepayan Sarkar
On Monday 14 February 2005 18:12, Jeff Jorgensen wrote:
 Dear R-sters,

 I was wondering if anyone has encountered the following issues.  I've
 figured out how to get multiple levelplots [library(lattice)] on a
 single plot.  However, when I add text (adding axis labels for the
 entire four panel plot) the text is missing when I insert the *.eps
 file I've created into my LaTeX document (via MikTeX-WinEdt).  And,
 I've just upgraded to R v2.0.1 from v1.8.1 (Windows), and each
 individual levelplot is smaller compared to the older R release.

 Any clues as to 1) how I can recover the lost text, and 

Your use is incorrect, in the sense that the return value of 
grid.locator() is not a valid input of ltext. You could do the 
following to fix this, 

library(grid)
ltext(lapply(grid.locator(), convertX, native, TRUE),
  lab=x-axis label, where I click,cex=1.5)
ltext(lapply(grid.locator(), convertX, native, TRUE),
  lab = y-axis label, where I click,
  cex=1.5, srt=90)

but that doesn't seem to help either. So, there seems to be a bug 
somewhere. However, you presumably want something like 


grid.text(x = .05, y = .5, lab=y-axis label, 
  default.units = npc, gp = gpar(cex=1.5), 
  rot = 90)
grid.text(x = .5, y = .05, lab=x-axis label, 
  default.units = npc, gp = gpar(cex=1.5))

for the last two steps, which seems to work. 


 2) increase the size of each of the levelplots?

You need to change the following settings, in particular the entries 
that end with 'padding' (similarly for 'layout.heights').

 str(trellis.par.get(layout.widths))
List of 13
 $ left.padding : num 1
 $ key.left : num 1
 $ key.ylab.padding : num 1
 $ ylab : num 1
 $ ylab.axis.padding: num 1
 $ axis.left: num 1
 $ axis.panel   : num 1
 $ panel: num 1
 $ between  : num 1
 $ axis.right   : num 1
 $ axis.key.padding : num 1
 $ key.right: num 1
 $ right.padding: num 1

Deepayan


 Cheers,

 Jeff Jorgensen

 ~~~
 Sample code that illustrates what I'm trying to do:

 #create a levelplot
 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))
 a-levelplot(z~x*y, grid, cuts = 50, xlab=, ylab=,
   colorkey = FALSE)

 #create the multiple panel plot, here using all the same levelplot
 trellis.par.set(list(background=list(col=white))) #white background
 #using position to scale the plots up and to the right ~10%
 #to make room for the axis labels
 print(a,position=c(0.1,0.1,1,1),split=c(1,1,2,2),more=T)
 print(a,position=c(0.1,0.1,1,1),split=c(1,2,2,2),more=T)
 print(a,position=c(0.1,0.1,1,1),split=c(2,1,2,2),more=T)
 print(a,position=c(0.1,0.1,1,1),split=c(2,2,2,2),more=F)
 #commands that let you click where you want the labels centered
 ltext(grid::grid.locator(),lab=x-axis label, where I click,cex=1.5)
 ltext(grid::grid.locator(),lab=y-axis label, where I
 click,cex=1.5,srt=90) #save device to an *.eps file, to be called
 later by a \includegraphics command
 dev.copy2eps(file=twobytwoplot.eps)

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


RE: [R] memory problem with package mix

2005-02-15 Thread Ted Harding
On 15-Feb-05 [EMAIL PROTECTED] wrote:
 Hello,
 I think we have a memory problem with  em.mix.
 
 We have done:
 
library(mix)
Manq - read.table(C:/.../file.txt)
attach(Manq)
Manq
V1 V2 V3 V4 .V27
 1  1  1  1  1...
 2  1 NA  3  6
 3  1  2  6  2
 ...
 ...
 300  2  NA  6  2...
 
 Essaimanq -prelim.mix(as.matrix(Manq),5)
 test - em.mix(Essaimanq)
 error cannot allocated vector of size 535808 KB
 in addition : warning message reached total allocation of 509MB

Hmm.

According to the above, it seems you might have 5 categorical
variables V1...V5 with at least 6 levels, so since your call to
em.mix does not specify any model restriction (for which you
need to call ecm.mix insead) you may have at least 6^5 = 46656
cells for the different combinations of levels. This will
require 46655 parameters for the probabilities of these cells.

For each cell, you have a separate vector of means for the
multivariate normal distribution to be fitted to the (27-5)=22
continuous variables. This requires 22*46656 = 1026432 parameters.

Sub-total: 1073087

Then, as a bit of sugar on the cake, you have the 22*21/2 = 121
parameters for the covariance matrix.

Sub-total: 1073208

Since em.mix does quite complicated things, it is perhaps
not surpising that it demands more than 509MB (corresponding
to about 500 bytes per parameter or, with 8 bytes per number,
about 60 numbers per parameter). Not to mention the 8100
numbers (about 65000 bytes) required for each working copy
of the representation of the data.

In any case, apparently you only have 300*27 = 8100 data,
quite inadequate for this unrestricted model!

Even if you could have allocated enough memory, you would
then have found that the EM fit would not get anywhere.

Suggested solution: think about restricting the number of
parameters in the model, using the parameter margins to
ecnm.mix to restrict the number of independent combinations
of categorical levels, and also design to specify a simpler
model for the dependence of the continuous variables
on the categoricals (e.g. the matrix corresponding to the
model ~ V1+V2+V3+V4+V5 only introduces 5*6*22=660 new
parameters, namely a simple additive effect of level of each Vi
on the mean of each of the 22 continuous variables).

Hoping this helps,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 15-Feb-05   Time: 16:24:18
-- XFMail --

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


[R] how many 7th of the month is there between two dates

2005-02-15 Thread Omar Lakkis
This is a eaeir way to ask my prior question:

I want to caculate how many an exact day of the month there is between
two dates.

For example; How many 7th of the month is there between 1998/12/17
and 2000/1/7. To make the problem simple, the day of the month (7)
is the day in the 2nd date.

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


[R] reading a 40kb csv file in R

2005-02-15 Thread Fairouz Makhlouf
I am trying to read a matrix of  5000*2000 from a csv
file of real numbers in R using the scan function. I
am getting an error saying that R can not read a
vector  32KB and it can't allocate a memory of 191 MB
etc. 

What should I do. I am using R1.7.1.

Thanks

=
Thanks
Fairouz Makhlouf

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


Re: [R] shrinkage estimates in lme

2005-02-15 Thread Dimitris Rizopoulos
What exactly do you mean by slope estimates? Marginal or 
subject-specific?

Presuming that you mean the fixed-effects (since you refer to OLS) 
then these are unbiased since they are Weighted Least Squares 
estimators based on the marginal model. They are unbiased even in the 
case where you misspecify the correlation structure. Moreover if you 
use a reasonably well chosen covariance structure then they are also 
very efficient.

The subject-specific fitted values are shrunken toward the mean in the 
sense:

\hat{y}_i = \sum_i V_i^{-1}X_i\hat{\bfbeta} + (I-\sum_i V_i^{-1})y_i
and thus it is a weighted average of the population average profile 
X_i\hat{\bfbeta} and the observed data y_i with weights \sum_i 
V_i^{-1} and (I-\sum_i V_i^{-1}), respectively (where \sum_i V_i^{-1} 
is the residual covariance matrix).

I hope this helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: Bill Shipley [EMAIL PROTECTED]
To: R help list r-help@stat.math.ethz.ch
Sent: Tuesday, February 15, 2005 5:17 PM
Subject: [R] shrinkage estimates in lme

Hello.  Slope estimates in lme are shrinkage estimates which pull the
OLS slope estimates towards the population estimates, the degree of
which depends on the group sample size and the distance between the
group-based estimate and the overall population estimate.  Although
these shrinkage estimates as said to be more precise with respect to 
the
true values, they are also biased.  So there is a tradeoff between
precision and bias.

Are there rules of thumb to help determine when it is better to use 
the
OLS slope estimates and when to use the mixed model (lme) shrinkage
estimates?  I have 35 groups but the numbers per group vary from over 
50
to as low as 4.

Thanks for any help.

Bill Shipley
Subject Matter Editor, Ecology
North American Editor, Annals of Botany
Dpartement de biologie, Universit de Sherbrooke,
Sherbrooke (Qubec) J1K 2R1 CANADA
[EMAIL PROTECTED]
http://callisto.si.usherb.ca:8080/bshipley/
http://callisto.si.usherb.ca:8080/bshipley/

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

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


Off topic -- large data sets. Was RE: [R] 64 Bit R Background Question

2005-02-15 Thread Graham Jones
In message [EMAIL PROTECTED], r-help-
[EMAIL PROTECTED] writes

Can comeone give me an example (perhaps in a private response, since I'm off
topic here) where one actually needs all cases in a large data set (large
being  1e6, say) to do a STATISTICAL analysis? By statistical I exclude,
say searching for some particular characteristic like an adverse event in a
medical or customer repair database, etc. Maybe a definition of
statistical is: anything that cannot be routinely done in a single pass
database query.

If the dimensionality of the data is large, you may need a large number
of cases too. An example from my own experience would be using quadratic
discriminant analysis (with regularization) for classifying symbols for
an OCR program. With 200 classes and 100 features, I'd really like many
millions of cases. I've been using about 20,000 per class or 4 million
in total, but if I had 40 million it would probably work better.
Compared to many applications in pattern recognition and data mining, I
think this is a fairly small example. 

-- 
Graham Jones, author of SharpEye Music Reader
http://www.visiv.co.uk
21e Balnakeil, Durness, Lairg, Sutherland, IV27 4PT, Scotland, UK

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


Re: [R] how many 7th of the month is there between two dates

2005-02-15 Thread Gabor Grothendieck
Omar Lakkis uofiowa at gmail.com writes:


: I want to caculate how many an exact day of the month there is between
: two dates.
: 
: For example; How many 7th of the month is there between 1998/12/17
: and 2000/1/7. To make the problem simple, the day of the month (7)
: is the day in the 2nd date.

d1 - as.Date(1998/12/17)
d2 - as.Date(2000/1/7)

day - function(x) as.numeric(format(x, %d))

sum(day(seq(from = d1, to = d2, by = day)) == day(d2))

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


[R] nlsList vs nlme with lsoda function

2005-02-15 Thread Manuel Morales
Hello list members,
I'm trying to get nlme to work with lsoda from odesolve. Currently, I 
can use nlsList to fit a simple logistic growth model to some simulated 
data, but I get the following error message with nlme: Error in 
model.frame(formula, rownames, variables, varnames, extras, extranames, 
 : invalid variable type

The commands I'm trying are below. Any suggestions for how to get this 
to work?

Thanks!
This works:
fit.nlsList-nlsList(xvals~lsoda(x0,times,Logist,
+c(r=r,K=K,x0=x0))[,2]|group,
+start=list(r=1,K=500,x0=2),data=data.group)
This returns the error message above:
fit.nlme-nlme(xvals~(lsoda(x0,times,Logist,
+c(r=r,K=K,x0=x0))[,2]),
+start=list(r=1,K=500,x0=2),data=data.group,
+fixed=r+K+x0~1,random=x0~1)
The model function is:
Logist=function(t,x,parms) {
N1-x[1]
with(as.list(parms),{
dN1=r*N1*(1-(N1/K))
list(c(dN1))
})}
My data set looks like:
Grouped Data: xvals ~ times | group
   xvals times group
1-0.44543969 0 1
238.86411972 3 1
3   310.77106961 6 1
4   486.78653327 9 1
5 0.40613173 0 2
634.94635643 3 2
7   307.81884870 6 2
8   486.46098417 9 2
etc...
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: Off topic -- large data sets. Was RE: [R] 64 Bit R Background Question

2005-02-15 Thread Prof Brian Ripley
On Tue, 15 Feb 2005, Graham Jones wrote:
In message [EMAIL PROTECTED], r-help-
[EMAIL PROTECTED] writes
[Actually quoting Bert Gunter, BTW]
Can comeone give me an example (perhaps in a private response, since I'm off
topic here) where one actually needs all cases in a large data set (large
being  1e6, say) to do a STATISTICAL analysis? By statistical I exclude,
say searching for some particular characteristic like an adverse event in a
medical or customer repair database, etc. Maybe a definition of
statistical is: anything that cannot be routinely done in a single pass
database query.
If the dimensionality of the data is large, you may need a large number
of cases too. An example from my own experience would be using quadratic
discriminant analysis (with regularization) for classifying symbols for
an OCR program. With 200 classes and 100 features, I'd really like many
millions of cases. I've been using about 20,000 per class or 4 million
in total, but if I had 40 million it would probably work better.
Compared to many applications in pattern recognition and data mining, I
think this is a fairly small example.
But Bert's caveats apply: you have 200 problems of size 20,000 since in 
QDA each class's distribution is estimated separately, and a single pass 
will give you the sufficient statistics however large the dataset is.

--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how many 7th of the month is there between two dates

2005-02-15 Thread Prof Brian Ripley
It is really easy using R's date and datetime classes:
st - as.Date(1998-12-17)
en - as.Date(2000-1-7)
st0 - st
# Get the 7th of the month before
st0 - as.POSIXlt(st); st0$mday - 7; st0$mon - st0$mon - 1
st0 - as.Date(st0)
ll - seq.Date(st0, en, by=month)
sum(ll  as.Date(st)  ll  en)
and use = etc depending what you mean by `between'.
On Tue, 15 Feb 2005, Omar Lakkis wrote:
This is a eaeir way to ask my prior question:
I want to caculate how many an exact day of the month there is between
two dates.
For example; How many 7th of the month is there between 1998/12/17
and 2000/1/7. To make the problem simple, the day of the month (7)
is the day in the 2nd date.
--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with R CMD Rd2dvi: Rd.sty not found

2005-02-15 Thread Gabor Grothendieck
Duncan Murdoch murdoch at stats.uwo.ca writes:

: 
: On Thu, 10 Feb 2005 21:27:03 + (UTC), Gabor Grothendieck
: ggrothendieck at myway.com wrote :
: 
: Tuszynski, Jaroslaw W. JAROSLAW.W.TUSZYNSKI at saic.com writes:
: 
: : 
: : Hi,
: : 
: : I run into a problem with R CMD Rd2dvi command: it gives me File 
`Rd.sty'
: : not found error (See the output message on the bottom). I get the same
: : error when running RCMD check. My system is: Windows 2000, R version
: : 2.0.1, MiKTeX version 2.4. I do have a Rd.sty file in R_HOME/share/texm
: : directory.
: : 
:  ...
: 
: There is some information on this at:
: 
: http://www.murdoch-sutherland.com/Rtools/miktex.html
: 
: The information there is slightly out of date:  the last version of
: Miktex that I've tried has broken that solution.  I asked the author
: about it, and he replied as below.
: 
: I think this is pretty poor behaviour on the part of Miktex, but in
: other respects I prefer it to fptex.  
: 
: For what you're doing, you need to set up your
: $R_HOME/bin/helpprint.bat file so that it makes use of the TEXINPUTS
: environment variable.  You want the pdftex command to have something
: like
: 
: -include-directory=%TEXINPUTS%
: 
: in it and then it will look in the right places for the includes.
: 
: Duncan Murdoch

I tried playing around with MiKTeX and got some advice on the TeX 
list and now am using this config.  This example assumes you have
put your localtexmf file in \localtexmf and are running
R 2.0.1 from \Program Files\R\rw2001; otherwise, make the obvious
changes.

1. Create a new tex subfolder of your \localtexmf\texmf folder:

md \localtexmf\texmf\tex

2. Copy your R .sty and .fd files into it:

cd \Program Files\R\rw2001\share\texmf
copy *.* \localtexmf\texmf\tex

3. Go into
 
Start | Programs | MiKTeX | MiKTeX Options | General

   and press Update Now and Refresh Now.   (I am not certain that this 
   step needs to be done but it can't hurt.)

#2 and #3 need to be repeated each time one installs a new version 
of R if the *.sty or *.fd files have changed but if they have not
changed then nothing at all needs to be done.  It has the advantage 
that it leaves all MiKTeX options at their defaults.  It represents
a fourth alternative to the three listed at:

   http://www.murdoch-sutherland.com/Rtools/miktex.html

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


Re: [R] Problem with R CMD Rd2dvi: Rd.sty not found

2005-02-15 Thread Gabor Grothendieck
Gabor Grothendieck ggrothendieck at myway.com writes:


 I tried playing around with MiKTeX and got some advice on the TeX 
 list and now am using this config.  This example assumes you have
 put your localtexmf file in \localtexmf and are running
 R 2.0.1 from \Program Files\R\rw2001; otherwise, make the obvious
 changes.

Sorry, there were some errors in my description of configuring
MiKTeX so that it finds the Rd.sty file and associated files.  
It should be:
 
1. Create a new tex subfolder of your \localtexmf folder:

md \localtexmf\tex

2. Copy your R .sty and .fd files into it:
 
 cd \Program Files\R\rw2001\share\texmf
 copy *.* \localtexmf\tex
 
3. Go into
 
 Start | Programs | MiKTeX | MiKTeX Options | General
 
and press Update Now and Refresh Now.   (I am not certain that this 
step needs to be done but it can't hurt.)

4.  You can check whether it is finding Rd.sty in the right place
with the command:

 findtexmf Rd.sty
 
#2 - #4 need to be repeated each time one installs a new version 
of R if the *.sty or *.fd files have changed but if they have not
changed then nothing at all needs to be done.  It has the advantage 
that it leaves all MiKTeX options at their defaults and does not
need a custom miktex.ini file.  It represents a fourth alternative 
to the three listed at:
 
http://www.murdoch-sutherland.com/Rtools/miktex.html

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


Re: [R] Problem with R CMD Rd2dvi: Rd.sty not found

2005-02-15 Thread Duncan Murdoch
On Tue, 15 Feb 2005 19:44:51 + (UTC), Gabor Grothendieck
[EMAIL PROTECTED] wrote :


I tried playing around with MiKTeX and got some advice on the TeX 
list and now am using this config.  This example assumes you have
put your localtexmf file in \localtexmf and are running
R 2.0.1 from \Program Files\R\rw2001; otherwise, make the obvious
changes.

Thanks, I'll put this on the web page (with the corrections from your
next message).

It's probably the best solution for most users, but it doesn't work
for me:  I need to have more than one R version on my machine at the
same time (I currently have R 2.0.1, R-patched, and R-devel; usually I
have a few old ones too, but I'm working on a laptop with limited
space.)  This solution assumes you have only one version installed.

I don't know what people developing LaTeX styles do:  presumably
they'd have multiple versions of the style online, testable in
multiple versions of LaTeX.

Duncan Murdoch

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


[R] Trellis barchart, column display order issue

2005-02-15 Thread Bock, Michael
I have searched the archives and instructions high and low but have not
found what I need.

I have a dataframe named Data with columns:
AdjResND0 - the numeric result
Parameter - the classification (chemical name)
Sort - the order I want the chemical names to appear, with leading zeros
so all are the same length
Client.Name - the sample name

I am trying to generate a series of 1 page barcharts, one for each
sample. The dataframe has been sorted by Client.name and sort
 I use the following command:

barchart(AdjResND0 ~ Parameter | Client.Name , Data,
   box.ratio = 0.8, ylab= (Concentration (mg/kg)),
   layout = c(0,1), scales = list(x=free,rot=90,cex = 0.5,
   axs = i,abbreviate = TRUE ) )

The parameters are listed alphabetic order from left to right in the bar
chart so I constructed a new variable
Label which is the sort and parameter variables concatenated together.

barchart(AdjResND0 ~ Label | Client.Name , Data,
   box.ratio = 0.8, ylab= (Concentration (mg/kg)),
   layout = c(0,1), scales = list(x=free,rot=90,cex = 0.5,
   axs = i,abbreviate = TRUE ) )

This has everything in the correct order but obviously I don't want the
column labels to have the sort order glued on the front. Any way to get
the order I want and the labels I want?

I am using :
R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

Under Windows XP

Also, I am as yet unable to figure out how to get R to spool the graphs
to a pdf file so I get all 30 graphs and I can save them for an
appendix. I just want to be able to save all the graphs for future use,
so I am not set on pdf or anything else. An example would be great! 



Thanks,

Mike



Michael J. Bock, PhD.
ARCADIS
24 Preble St. Suite 100
Portland, ME 04101
207.828.0046
fax 207.828.0062




[[alternative HTML version deleted]]

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


[R] Making a Package

2005-02-15 Thread [EMAIL PROTECTED]
Hello.
I have what I know to be a simple question, but never having done anything like 
this it is
pretty tough.
 
I'm trying to write an R package. I have a collection of functions that I 
loaded into R and
then used package.skeleton(). After editing everything in the resulting folder, 
call it
NewPackage, I tried to follow along with some instructions I found for Windows 
users.
 
I installed ActivePearl to the C drive, placed the unzipped Rtools folder, 
tools, there also
(is placing it there all that is necessary; I couldn't find anything to 
install tools), and
I'm using R 2.00 (also installed on the C drive) on a Win-XP machine.
 
My understaning is that (since I have no C, Fortran, etc., code) I can move the 
NewPackage
folder (with all of the edited material) to the C:\r\rw2000\src\library folder 
and then open
MS-Dos in C:\r\rw2000\src\gnuwin32 and type: make pkg-NewPackage. After that, a 
folder called NewPackage should be placed in the C:\r\rw2000\library and from 
there loaded into R and/or zipped and distributed. If everything I have said is 
correct (which it may not be) then I'm
stuck. When I type 'make pkg-NewPackage' in the C:\r\rw2000\src\gnuwin32 
directory I get
'make' is not recognized as an internal or external command, operable program 
or batch file.
 
I've tried to use Writing R Extensions, but I could only follow part of what 
it was saying
and got confused as to what was done on Windows and what was done on Unix 
machines.
I know this is probably an easy question, but it has proved difficult for me to 
figure out how
to make my own package.
Thanks, Ken


-


[[alternative HTML version deleted]]

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


Re: [R] Making a Package

2005-02-15 Thread Gabor Grothendieck
KKThird at Yahoo.Com kkthird at yahoo.com writes:

: 
: Hello.
: I have what I know to be a simple question, but never having done anything 
like this it is
: pretty tough.
: 
: I'm trying to write an R package. I have a collection of functions that I 
loaded into R and
: then used package.skeleton(). After editing everything in the resulting 
folder, call it
: NewPackage, I tried to follow along with some instructions I found for 
Windows users.
: 
: I installed ActivePearl to the C drive, placed the unzipped Rtools folder, 
tools, there also
: (is placing it there all that is necessary; I couldn't find anything 
to install tools), and
: I'm using R 2.00 (also installed on the C drive) on a Win-XP machine.
: 
: My understaning is that (since I have no C, Fortran, etc., code) I can move 
the NewPackage
: folder (with all of the edited material) to the C:\r\rw2000\src\library 
folder and then open
: MS-Dos in C:\r\rw2000\src\gnuwin32 and type: make pkg-NewPackage. After 
that, a folder called
: NewPackage should be placed in the C:\r\rw2000\library and from there loaded 
into R and/or zipped and
: distributed. If everything I have said is correct (which it may not be) then 
I'm
: stuck. When I type 'make pkg-NewPackage' in the C:\r\rw2000\src\gnuwin32 
directory I get
: 'make' is not recognized as an internal or external command, operable 
program or batch file.
: 
: I've tried to use Writing R Extensions, but I could only follow part of 
what it was saying
: and got confused as to what was done on Windows and what was done on Unix 
machines.
: I know this is probably an easy question, but it has proved difficult for me 
to figure out how
: to make my own package.
: Thanks, Ken


Make sure that:
- the tools and the R bin folders are in your path
- you have installed fptex or MiKTeX, perl and the Microsoft help compiler
  (MiKTeX is a bit harder to install but I otherwise prefer it.  If you
  are writing vignettes you must use MiKTeX.)
- you have read:
   Writing R Extensions Manual
   http://www.murdoch-sutherland.com/Rtools/

I am assuming here that your R installation is in \Program Files\R\rw

1. Assuming your source package tree is in \Rpkgs\mypackage
   then in the Windows cmd line:

cd \Rpkgs
Rcmd install mypackage

   which will install it to your \Program Files\R\rw\library\mypackage
   or if you want to install it to a separate library:

cd \Rpkgs
md library
Rcmd install -l library mypackage

2. Now in R:

library(mypackage)
... test it out ...

or if you installed it to a separate library:

library(mypackage, lib.loc = /Rpkgs/library)

3. Once it seems reasonably ok,  see if it passes Rcmd check:

cd \Rpkgs
Rcmd check mypackage

   and fix it up until it does.

4. Now create versions for UNIX and Windows that you can distribute:

cd \Rpkgs
Rcmd build mypackage
Rcmd build mypackage --binary

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


Re: [R] summary(aov(...)) into a string?

2005-02-15 Thread Prof Brian Ripley
It doesn't print anything: the summary.aov (or summary.aovlist) 
print method does.

?summary.aov tells you the structure of the objects they return.
On Tue, 15 Feb 2005, RenE J.V. Bertin wrote:
I'd like to annotate a plot with the output of summary(aov(model)), 
ideally just with the significant effects. I don't find a means to 
redirect what that command prints into a string. Is this possible, and 
if so, how?
--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Trellis barchart, column display order issue

2005-02-15 Thread Deepayan Sarkar
On Tuesday 15 February 2005 14:57, Bock, Michael wrote:
 I have searched the archives and instructions high and low but have
 not found what I need.

 I have a dataframe named Data with columns:
 AdjResND0 - the numeric result
 Parameter - the classification (chemical name)
 Sort - the order I want the chemical names to appear, with leading
 zeros so all are the same length
 Client.Name - the sample name

Try looking at 

levels(Data$Parameter)

I'll bet they are in alphabetical order. See ?factor for how to specify 
the levels explicitly. Alternatively, barring unforeseen complications, 
and assuming that you have a sufficiently modern version of R, you 
should be able to do 

barchart(AdjResND0 ~ reorder(Parameter, sort) | Client.Name, 
 Data, ...

and if that doesn't work as intended,

barchart(AdjResND0 ~ reorder(Parameter, 
 as.numeric(as.character(sort))) | Client.Name, 
 Data, ...

Deepayan

 I am trying to generate a series of 1 page barcharts, one for each
 sample. The dataframe has been sorted by Client.name and sort
  I use the following command:

 barchart(AdjResND0 ~ Parameter | Client.Name , Data,
box.ratio = 0.8, ylab= (Concentration (mg/kg)),
layout = c(0,1), scales = list(x=free,rot=90,cex = 0.5,
axs = i,abbreviate = TRUE ) )

 The parameters are listed alphabetic order from left to right in the
 bar chart so I constructed a new variable
 Label which is the sort and parameter variables concatenated
 together.

 barchart(AdjResND0 ~ Label | Client.Name , Data,
box.ratio = 0.8, ylab= (Concentration (mg/kg)),
layout = c(0,1), scales = list(x=free,rot=90,cex = 0.5,
axs = i,abbreviate = TRUE ) )

 This has everything in the correct order but obviously I don't want
 the column labels to have the sort order glued on the front. Any way
 to get the order I want and the labels I want?

 I am using :
 R : Copyright 2004, The R Foundation for Statistical Computing
 Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

 Under Windows XP

 Also, I am as yet unable to figure out how to get R to spool the
 graphs to a pdf file so I get all 30 graphs and I can save them for
 an appendix. I just want to be able to save all the graphs for future
 use, so I am not set on pdf or anything else. An example would be
 great!



 Thanks,

 Mike



 Michael J. Bock, PhD.
 ARCADIS
 24 Preble St. Suite 100
 Portland, ME 04101
 207.828.0046
 fax 207.828.0062

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


Re: [R] summary(aov(...)) into a string?

2005-02-15 Thread Gabor Grothendieck
RenE J.V. Bertin rjvbertin at hotmail.com writes:

: 
: Hello,
: 
: I'd like to annotate a plot with the output of summary(aov(model)), ideally 
just with the significant
: effects. I don't find a means to redirect what that command prints into a 
string.
: Is this possible, and if so, how?
: 

?capture.output

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


[R] Tcl/tk

2005-02-15 Thread Alexander . O . BETTINARDI
I am new to R so I apologize if this is a simple question

I have created a tkgrid with a button that, once pushed, will extract the
information from the grid, but I can not figure out the command to save the
entries from my grid.
Any thoughts?

Thanks

Alex Bettinardi
Transportation Analyst
TDD - Planning Section - TPAU
555 13th Street NE, Suite 2
Salem, OR 97301-4178
503.986.4398






[[alternative HTML version deleted]]

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


RE: [R] Making a Package

2005-02-15 Thread michael watson \(IAH-C\)
I follow the guide here and it never fails:
 
http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html
 
So if I have the MyPackage directory, that was created with package.skeleton 
and subsequently edited, I will cd to the directory that contains the MyPackage 
directory and:
 
R CMD INSTALL --build MyPackage
 
MyPackage_1.0.zip will be created.  Then install using the menus.

-Original Message- 
From: [EMAIL PROTECTED] on behalf of Gabor Grothendieck 
Sent: Tue 2/15/2005 9:59 PM 
To: r-help@stat.math.ethz.ch 
Cc: 
Subject: Re: [R] Making a Package



KKThird at Yahoo.Com kkthird at yahoo.com writes:

:
: Hello.
: I have what I know to be a simple question, but never having done 
anything
like this it is
: pretty tough.
:
: I'm trying to write an R package. I have a collection of functions 
that I
loaded into R and
: then used package.skeleton(). After editing everything in the 
resulting
folder, call it
: NewPackage, I tried to follow along with some instructions I found for
Windows users.
:
: I installed ActivePearl to the C drive, placed the unzipped Rtools 
folder,
tools, there also
: (is placing it there all that is necessary; I couldn't find anything
to install tools), and
: I'm using R 2.00 (also installed on the C drive) on a Win-XP machine.
:
: My understaning is that (since I have no C, Fortran, etc., code) I 
can move
the NewPackage
: folder (with all of the edited material) to the 
C:\r\rw2000\src\library
folder and then open
: MS-Dos in C:\r\rw2000\src\gnuwin32 and type: make pkg-NewPackage. 
After
that, a folder called
: NewPackage should be placed in the C:\r\rw2000\library and from there 
loaded
into R and/or zipped and
: distributed. If everything I have said is correct (which it may not 
be) then
I'm
: stuck. When I type 'make pkg-NewPackage' in the 
C:\r\rw2000\src\gnuwin32
directory I get
: 'make' is not recognized as an internal or external command, operable
program or batch file.
:
: I've tried to use Writing R Extensions, but I could only follow 
part of
what it was saying
: and got confused as to what was done on Windows and what was done on 
Unix
machines.
: I know this is probably an easy question, but it has proved difficult 
for me
to figure out how
: to make my own package.
: Thanks, Ken


Make sure that:
- the tools and the R bin folders are in your path
- you have installed fptex or MiKTeX, perl and the Microsoft help 
compiler
  (MiKTeX is a bit harder to install but I otherwise prefer it.  If you
  are writing vignettes you must use MiKTeX.)
- you have read:
   Writing R Extensions Manual
   http://www.murdoch-sutherland.com/Rtools/

I am assuming here that your R installation is in \Program 
Files\R\rw

1. Assuming your source package tree is in \Rpkgs\mypackage
   then in the Windows cmd line:

cd \Rpkgs
Rcmd install mypackage

   which will install it to your \Program 
Files\R\rw\library\mypackage
   or if you want to install it to a separate library:

cd \Rpkgs
md library
Rcmd install -l library mypackage

2. Now in R:

library(mypackage)
... test it out ...

or if you installed it to a separate library:

library(mypackage, lib.loc = /Rpkgs/library)

3. Once it seems reasonably ok,  see if it passes Rcmd check:

cd \Rpkgs
Rcmd check mypackage

   and fix it up until it does.

4. Now create versions for UNIX and Windows that you can distribute:

cd \Rpkgs
Rcmd build mypackage
Rcmd build mypackage --binary

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

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


Re: [R] summary(aov(...)) into a string?

2005-02-15 Thread Peter Dalgaard
Prof Brian Ripley [EMAIL PROTECTED] writes:

 It doesn't print anything: the summary.aov (or summary.aovlist) print
 method does.
 
 ?summary.aov tells you the structure of the objects they return.

Yes. but wouldn't capture.output() and par(family=mono) be
closer to the mark?
 
 On Tue, 15 Feb 2005, RenE J.V. Bertin wrote:
 
  I'd like to annotate a plot with the output of summary(aov(model)),
  ideally just with the significant effects. I don't find a means to
  redirect what that command prints into a string. Is this possible,
  and if so, how?


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


Re: [R] Tcl/tk

2005-02-15 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 I am new to R so I apologize if this is a simple question
 
 I have created a tkgrid with a button that, once pushed, will extract the
 information from the grid, but I can not figure out the command to save the
 entries from my grid.
 Any thoughts?

Several, all starting with What...

What is tkgrid (not the geometry manager surely)?
What information?
What form is it extracted in?
What entries?
What do you want to save it to?



-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


Re: [R] Problem with

2005-02-15 Thread Gabor Grothendieck


I am just in the middle of a conversation on the tex list but
just in case you are about to post anything to your web site
here is a slight simplification.  It consists of updating the 
MiKTeX file database using initexmf instead of the GUI so you 
don't have to move back and forth during the instructions.
The discussion there might correct or improve this further.
Regards.

---

1. Create a new tex subfolder of your \localtexmf folder:

md \localtexmf\tex

2. Copy your R .sty and .fd files into it, update the
   MiKTeX texmf file name database and check that Rd.sty
   is found in the correct place, viz. \localtexmf\tex:

 cd \Program Files\R\rw2001\share\texmf
 copy *.* \localtexmf\tex
 initexmf -u
 findtexmf Rd.sty
  
#2 should be repeated each time one installs a new version 
of R or any time the *.sty or *.fd files are changed.

(Actually nothing needs to be done if the .sty and .fd files 
have not changed from one version of R to another and the
initexmf command does not need to be run unless the filenames
themselves have changed even if their contents have; however,
none of these steps will hurt and its safest to do them all.)

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


RE: [R] Could anyone answer for the following question

2005-02-15 Thread Berton Gunter
options(graphics.record=TRUE) turns on graphics recording.
This can also be done from the History menu of the graphics window.

All subsequent plots to the graphics device will be saved.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Cuichang Zhao
 Sent: Tuesday, February 15, 2005 2:36 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Could anyone answer for the following question
 
  
 Hello , 
 could anyone answer for the following question for me:
  
  
 I am using R 2.0.1 under Windows XP. I want to write a function that 
 makes four graphs and stores each of them in graphics 
 history. When the 
 function finishes, in other words, I want its graphical output to be 
 stored in a way that I can look at it using PgUp and PgDn. I 
 think I need 
 commands I can put in a function that
 
 --clear graphics history
 --either turn on graphics history recording or store the current graph
 
 Can anyone explain how to do this?
 
 
 Thank you so much
  
 C-Ming
  
 Feb 15, 2005
 
   
 -
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


Re: [R] Could anyone answer for the following question

2005-02-15 Thread Gabor Grothendieck
Cuichang Zhao cuiczhao at yahoo.com writes:


: I am using R 2.0.1 under Windows XP. I want to write a function that 
: makes four graphs and stores each of them in graphics history. When the 
: function finishes, in other words, I want its graphical output to be 
: stored in a way that I can look at it using PgUp and PgDn. I think I need 
: commands I can put in a function that
: 
: --clear graphics history
: --either turn on graphics history recording or store the current graph


windows(record = TRUE) will turn on windows graphics history and savePlot will
save a windows plot in a file.   You can also turn it on manually by
clicking on the graphics window and making sure History | Record is 
checked.

(Its also possible to save the low level graphics that R displays
using the displaylist and you can search r-help for more info
on 'displaylist' but I don't think that is what you are looking for.)

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


RE: [R] reading a 40kb csv file in R

2005-02-15 Thread Mulholland, Tom
I think you may need to check the list for posts relating to memory, large 
datasets, etc
 http://cran.r-project.org/search.html

It would help those on the list, if you gave more details about the machine you 
are using. Given the vintage of R you areusing is considered quite old, there 
is the possibility that you are using a machine with 256 Mb of RAM in which 
case it is likely you have hit a barrier that requires you to think about 
alternative ways of processing your data.

The reason I suggest you serach the posts yourself rather than give advice is 
that there are many possibilities which depend on information you have that I 
don't, about other software you have such as sql databases or you may 
understand better than I do some of the posts about sparse matrices.

Tom

 -Original Message-
 From: Fairouz Makhlouf [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 16 February 2005 1:05 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] reading a 40kb csv file in R
 
 
 I am trying to read a matrix of  5000*2000 from a csv
 file of real numbers in R using the scan function. I
 am getting an error saying that R can not read a
 vector  32KB and it can't allocate a memory of 191 MB
 etc. 
 
 What should I do. I am using R1.7.1.
 
 Thanks
 
 =
 Thanks
 Fairouz Makhlouf
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


Re: [R] lattice multiple plots per page

2005-02-15 Thread Paul Murrell
Hi
Deepayan Sarkar wrote:
On Monday 14 February 2005 18:12, Jeff Jorgensen wrote:
Dear R-sters,
I was wondering if anyone has encountered the following issues.  I've
figured out how to get multiple levelplots [library(lattice)] on a
single plot.  However, when I add text (adding axis labels for the
entire four panel plot) the text is missing when I insert the *.eps
file I've created into my LaTeX document (via MikTeX-WinEdt).  And,
I've just upgraded to R v2.0.1 from v1.8.1 (Windows), and each
individual levelplot is smaller compared to the older R release.
Any clues as to 1) how I can recover the lost text, and 

Your use is incorrect, in the sense that the return value of 
grid.locator() is not a valid input of ltext. You could do the 
following to fix this, 

library(grid)
ltext(lapply(grid.locator(), convertX, native, TRUE),
  lab=x-axis label, where I click,cex=1.5)
ltext(lapply(grid.locator(), convertX, native, TRUE),
  lab = y-axis label, where I click,
  cex=1.5, srt=90)
 but that doesn't seem to help either. So, there seems to be a bug
 somewhere.
I think this has the same problem as the original code, which is that it 
attempts to use ltext() outside of a lattice panel function, so the 
native units assumed by ltext() could be inappropriate.

Within the top-level grid viewport, native units are (at least 
approximately) the native units of the device (i.e., pixels).  The 
original drawing on screen is occurring in terms of screen pixels, but 
when you do the dev.copy2eps(), native means something different and 
you end up drawing in terms of PostScript points (1/72 inches), so the 
locations may be different (especially if your screen is, say, 96 dpi).

 However, you presumably want something like

grid.text(x = .05, y = .5, lab=y-axis label, 
  default.units = npc, gp = gpar(cex=1.5), 
  rot = 90)
grid.text(x = .5, y = .05, lab=x-axis label, 
  default.units = npc, gp = gpar(cex=1.5))

for the last two steps, which seems to work. 

Right.  First of all, use grid.text() not ltext(), and secondly,  use 
npc coordinates (in fact, anything other than native should do), 
which should transform to the same location on the dev.copy2eps().

If you want to position the labels using a mouse click ...
xy - grid.locator(npc)
grid.text(xy$x, xy$y, lab=y-axis label,
  gp = gpar(cex=1.5), rot = 90)
xy - grid.locator(npc)
grid.text(xy$x, xy$y, lab=x-axis label,
  gp = gpar(cex=1.5))
... again using npc locations rather than native.
Paul

2) increase the size of each of the levelplots?

You need to change the following settings, in particular the entries 
that end with 'padding' (similarly for 'layout.heights').


str(trellis.par.get(layout.widths))
List of 13
 $ left.padding : num 1
 $ key.left : num 1
 $ key.ylab.padding : num 1
 $ ylab : num 1
 $ ylab.axis.padding: num 1
 $ axis.left: num 1
 $ axis.panel   : num 1
 $ panel: num 1
 $ between  : num 1
 $ axis.right   : num 1
 $ axis.key.padding : num 1
 $ key.right: num 1
 $ right.padding: num 1
Deepayan

Cheers,
Jeff Jorgensen
~~~
Sample code that illustrates what I'm trying to do:
#create a levelplot
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))
a-levelplot(z~x*y, grid, cuts = 50, xlab=, ylab=,
 colorkey = FALSE)
#create the multiple panel plot, here using all the same levelplot
trellis.par.set(list(background=list(col=white))) #white background
#using position to scale the plots up and to the right ~10%
#to make room for the axis labels
print(a,position=c(0.1,0.1,1,1),split=c(1,1,2,2),more=T)
print(a,position=c(0.1,0.1,1,1),split=c(1,2,2,2),more=T)
print(a,position=c(0.1,0.1,1,1),split=c(2,1,2,2),more=T)
print(a,position=c(0.1,0.1,1,1),split=c(2,2,2,2),more=F)
#commands that let you click where you want the labels centered
ltext(grid::grid.locator(),lab=x-axis label, where I click,cex=1.5)
ltext(grid::grid.locator(),lab=y-axis label, where I
click,cex=1.5,srt=90) #save device to an *.eps file, to be called
later by a \includegraphics command
dev.copy2eps(file=twobytwoplot.eps)

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

--
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html