Re: [R] How to increase memory for R on Soliars 10 with 16GB and 64bit R

2005-07-14 Thread Uwe Ligges
Dongseok Choi wrote:

 Thank you very much for your help!!
 Now, it runs without any problem.
 
 Is it going to be fixed in the next release?

Of course, Brian

 Thanks again,
 Dongseok
 
 
 
 
 Dongseok Choi, Ph.D.
 Assistant Professor
 Division of Biostatistics
 Department of Public Health  Preventive Medicine
 Oregon Health  Science University
 3181 SW Sam Jackson Park Road, CB-669
 Portland, OR 97239-3098
 TEL) 503-494-5336
 FAX) 503-494-4981
 [EMAIL PROTECTED]
 
 
Prof Brian Ripley [EMAIL PROTECTED] 07/13/05 12:03 AM 
 
 On Tue, 12 Jul 2005, Dongseok Choi wrote:
 
 
 My machine is SUN Java Workstation 2100 with 2 AMD Opteron CPUs and 16GB RAM.
 R is compiled as 64bit by using SUN compilers.
 I trying to fit quantile smoothing on my data and I got an message as below.


fit1-rqss(z1~qss(cbind(x,y),lambda=la1),tau=t1)

Error in as.matrix.csr(diag(n)) :
 
 cannot allocate memory block of size 2496135168
 
 The lengths of vector x and y are both 17664.
 I tried and found that the same command ran with x[1:16008] and y[1:16008].
 So, it looks to me a memory related problem, but I'm not sure how I can 
 allocate memory block.
  I read the command line option but not sure what do to with it.
  Could you help me on this?
 
 
 It is trying to allocate a single memory block of size over 2^31-1 bytes. 
 R internally uses ints for sizes of vectors and that is a limit (see 
 help(Memory-limits) ).  However, it is intended that on 64-bit systems 
 that there is a limit here of 8*(2^31-1) but there was a typo.  Please 
 change line 1534 of src/main/memory.c to
 
 #if SIZEOF_LONG  4
 
 and re-compile.


__
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 to increase memory for R on Soliars 10 with 16GB and 64bit R

2005-07-14 Thread Uwe Ligges
Uwe Ligges wrote:

 Dongseok Choi wrote:
 
 Thank you very much for your help!!
 Now, it runs without any problem.

 Is it going to be fixed in the next release?
 
 
 Of course, Brian

[hmmm, looks like some wrong shortcut has been used - and it must have 
been me who forgot to drink coffee before strating to post ...]


I meant to say: Of course, Brian already did, see the svn log:


r34947 | ripley | 2005-07-13 03:16:18 -0400 (Wed, 13 Jul 2005) | 1 line
Changed paths:
M /trunk/NEWS
M /trunk/src/main/memory.c

correct typo for R_alloc on 64-bit systems




Uwe Ligges




 Thanks again,
 Dongseok




 Dongseok Choi, Ph.D.
 Assistant Professor
 Division of Biostatistics
 Department of Public Health  Preventive Medicine
 Oregon Health  Science University
 3181 SW Sam Jackson Park Road, CB-669
 Portland, OR 97239-3098
 TEL) 503-494-5336
 FAX) 503-494-4981
 [EMAIL PROTECTED]


 Prof Brian Ripley [EMAIL PROTECTED] 07/13/05 12:03 AM 


 On Tue, 12 Jul 2005, Dongseok Choi wrote:


 My machine is SUN Java Workstation 2100 with 2 AMD Opteron CPUs and 
 16GB RAM.
 R is compiled as 64bit by using SUN compilers.
 I trying to fit quantile smoothing on my data and I got an message as 
 below.


 fit1-rqss(z1~qss(cbind(x,y),lambda=la1),tau=t1)


 Error in as.matrix.csr(diag(n)) :


 cannot allocate memory block of size 2496135168

 The lengths of vector x and y are both 17664.
 I tried and found that the same command ran with x[1:16008] and 
 y[1:16008].
 So, it looks to me a memory related problem, but I'm not sure how I 
 can allocate memory block.
  I read the command line option but not sure what do to with it.
  Could you help me on this?



 It is trying to allocate a single memory block of size over 2^31-1 
 bytes. R internally uses ints for sizes of vectors and that is a limit 
 (see help(Memory-limits) ).  However, it is intended that on 64-bit 
 systems that there is a limit here of 8*(2^31-1) but there was a 
 typo.  Please change line 1534 of src/main/memory.c to

 #if SIZEOF_LONG  4

 and re-compile.

 


__
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] texture in barplots?

2005-07-14 Thread Adrian Dusa
On Thursday 14 July 2005 00:51, Peter Dalgaard wrote:
 Adrian Dusa [EMAIL PROTECTED] writes:
  ...snip...

 This comes up every now and then, and while it seems that everyone
 thinks fill patterns would be nice to have, I suspect that every
 attempt to actually implement it have gotten killed in infancy.

 The thing that is tricky to design right is the cross-device issues.
 Only some devices support this at all, and when they do, the patterns
 tend to be device dependent too. Probably not impossible -- there are
 other bits of the device drivers that deal with missing capabilities,
 like string rotation and clipping -- just, well, tricky.

All clear then; I'll try to find some colors that are different even in BW, 
or maybe some grays.

 Um... Romania, I suppose? What city?

It's Bucharest; I have a different signature in English but I do forget to use 
it when sending e-mails abroad (bad habit).

Thank you,
Adrian

-- 
Adrian Dusa
Romanian Social Data Archive
University of Bucharest, Romania
1, Schitu Magureanu Bd.
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101


-- 
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://linux.bitdefender.com/

__
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] Coxph with factors

2005-07-14 Thread Kylie-Anne Richards
Hello,

I am fitting a coxph model with factors. I am running into problems when
using 'survfit'. I am unsure how R is treating the factors when I fit, say:
DATA-data.frame(time.sec,done,f.pom=factor(f.pom),po,vo)
final-coxph(Surv(time.sec,done)~f.pom*vo+po,data=DATA)
 final.surv-survfit((final), individual=T,conf.type=log-log)
 print(final.surv)

Also, when I trying using survfit with presepecified values for the
covariates and factor (i.e. '0' to get the baseline) I get an error message,
which I think is a result of my inability to specify the factors in the
correct manner.


I would very much appreciate if somebody can help me out.

Thanks very much,


Kylie

__
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] Efficient testing for +ve definiteness

2005-07-14 Thread Prof Brian Ripley
On Wed, 13 Jul 2005, Makram Talih wrote:

 Dear R-users,

 Is there a preferred method for testing whether a real symmetric matrix is
 positive definite? [modulo machine rounding errors.]

 The obvious way of computing eigenvalues via E - eigen(A, symmetric=T,
 only.values=T)$values and returning the result of !any(E = 0) seems
 less efficient than going through the LU decomposition invoked in
 determinant.matrix(A) and checking the sign and (log) modulus of the
 determinant.

 I suppose this has to do with the underlying C routines. Any thoughts or
 anecdotes?


It has to do with what exactly you want to test.  Knowing the determinant 
does not tell you if the matrix is close to non-positive definite or not.
For numerical work, a comparison of the smallest eigenvalue to the largest 
is usually the most useful indication of possible problems in 
computations.  An alternative is to try a Choleski decomposition, which 
may be faster but is less informative.

Given how fast eigenvalues can be computed by current algorithms (and note 
the comments in ?eigen) I would suggest not worrying about speed until you 
need to (probably never).

-- 
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] High resolution plots

2005-07-14 Thread Luis Tercero
Thanks for the pointer!  .wmf is far superior, I was just in the dark 
about the format and R's ability to produce it (An Introduction to R 
Device drivers does not mention it and I had obviously missed the 
deciding last two words in ?device 'windows')

Thanks again.

-Luis


Gabor Grothendieck wrote:



 On 7/13/05, *Luis Tercero* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 Dear R-help community,

 would any of you have a (preferably simple) example of a
 presentation-quality .png plot, i.e. one that looks like the .eps
 plots
 generated by R?  I am working with R 2.0.1 in WindowsXP and am having
 similar problems as Knut Krueger in printing high-quality
 plots.  I have
 looked at the help file and examples therein as well as others I have
 been able to find online but to no avail.  After many many tries I
 have
 to concede I cannot figure it out.

 I would be very grateful for your help.

  
  

 If you want the highest resolution use a vector format,
 not a bitmapped format such as png.   See:

 http://maths.newcastle.edu.au/~rking/R/help/04/02/1168.html 
 http://maths.newcastle.edu.au/%7Erking/R/help/04/02/1168.html

 for some background.


  

  


[[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] Pearson dispersion statistic

2005-07-14 Thread Smit, R. \(Robin\)
Thank you for your reply.

 

I am aware of the good reasons not to use the deviance estimate in
binomial, Poisson, and gamma families. 

However, for the inverse Gaussian, the choice seems to me less clear
cut. So I just wanted to compare two different options.

 

I have used the dispersion parameter to compute the standardized
deviance residuals:

summary(model.gamma)$deviance.resid /(summary(model.gamma)$dispersion *
(1 - hatvalues(model.gamma)))^0.5

 

I noticed differences with Genstat which outputs these stand. dev.
residuals directly, and they are explained by the automatic use of
deviance instead of Pearson. 

 

Kind regards,

Robin Smit

 

 

-Original Message-

From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ]

Sent: dinsdag 12 juli 2005 15:12

To: Smit, R. (Robin)

Cc: r-help@stat.math.ethz.ch

Subject: : Re: [R] Dispersion in glm (was (no subject))

 

Actually, glm() does not estimate the dispersion at all, so you will
need to be more specific.

For example, summary.glm() and predict.glm() use the Pearson statistic
if dispersion=NULL (the default) for most families. You can supply any
other value you choose, and the MASS package makes use of this for ML
estimation of the dispersion parameter (related to the shape) of the
gamma family.

There are rather good reasons (serious bias) not to use the deviance
estimate in the binomial and Poisson families (see the example plots in
MASS4), and good reasons not to use either in the gamma family. As the
Pearson and deviance estimates agree for the gaussian, that does leave
begging the question of why you want to do this. Further, McCullagh 
Nelder have general arguments why the Pearson estimate might always be
preferred to the deviance one. So that `another statastical package' 

appears to need justification for its choice.

 

On Mon, 11 Jul 2005, Smit, R. (Robin) wrote:

 The estimate of glm dispersion can be based on the deviance or on the 

 Pearson statistic.

 I have compared output from R glm() to another statastical package and


 it appears that R uses the Pearson statistic.

 I was wondering if it is possible to make use R the deviance instead 

 by modifying the glm(...) function?

 Thanks for your attention.

-- 

Brian D. Ripley, [EMAIL PROTECTED]

Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
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, UK Fax: +44 1865 272595

 


This e-mail and its contents are subject to the DISCLAIMER at 
http://www.tno.nl/disclaimer/email.html
[[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] Name for factor's levels with contr.sum

2005-07-14 Thread Prof Brian Ripley
One way to do this generally is to make a copy of contr.sum, rename it, 
and set the dimnames appropriately.

I think contr.treatment is misleading (it labels contrasts of two levels 
by just one of them), and Christoph's labels are informative but 
impractically long.  But if you want to label each contrast by the level 
it contrasts with the rest,

cont - array(0, c(lenglev, lenglev - 1),
   list(levels, levels[-lenglev]))

in a modified contr.sum will do it. E.g.

 z - factor(letters[1:3])
 contr.treatment(z)
   b c
a 0 0
b 1 0
c 0 1
 contr.sum(z)
   [,1] [,2]
a10
b01
c   -1   -1
 mycontr.sum(z)
a  b
a  1  0
b  0  1
c -1 -1




On Wed, 13 Jul 2005, Christoph Buser wrote:

 Dear Ghislain

 I do not know a general elegant solution, but for some
 applications the following example may be helpful:

 ## Artificial data for demonstration: group is fixed, species is random
 dat - data.frame(group = c(rep(A,20),rep(B,17),rep(C,24)),
  species = c(rep(sp1, 4), rep(sp2,5),   rep(sp3,5),
rep(sp4,6),  rep(sp5,2),  rep(sp6,5),  rep(sp7,3),
rep(sp8,3), rep(sp9,4), rep(sp10,6),  rep(sp11,6),
rep(sp12,6), rep(sp13,6)),
  area = rnorm(61))

 ## You can attach a contrast at your fixed factor of interest group
 ## Create the contrast you like to test (in our case contr.sum for 3
 ## levels)
 mat - contr.sum(3)
 ## You can add the names you want to see in the output
 ## Be carefull that you give the correct names to the concerned
 ## column. Otherwise there is the big danger of misinterpretation.
 colnames(mat) - c(: A against rest, : B against rest)
 ## Attatch the contrast at your factor group
 dat[,group] - C(dat[,group],mat)
 ## Now calculate the lme
 library(nlme)
 reg.lme - lme(area ~ group, data = dat, random = ~ 1|species)
 summary(reg.lme)

 Maybe someone has a better idea how to do it generally.

 Hope this helps

 Christoph Buser

 --
 Christoph Buser [EMAIL PROTECTED]
 Seminar fuer Statistik, LEO C13
 ETH (Federal Inst. Technology)8092 Zurich  SWITZERLAND
 phone: x-41-44-632-4673   fax: 632-1228
 http://stat.ethz.ch/~buser/
 --


 Ghislain Vieilledent writes:
  Good morning,
 
  I used in R contr.sum for the contrast in a lme model:
 
   options(contrasts=c(contr.sum,contr.poly))
   Septo5.lme-lme(Septo~Variete+DateSemi,Data4.Iso,random=~1|LieuDit)
   intervals(Septo5.lme)$fixed
  lower est. upper
  (Intercept) 17.0644033 23.106110 29.147816
  Variete1 9.5819873 17.335324 25.088661
  Variete2 -3.3794907 6.816101 17.011692
  Variete3 -0.5636915 8.452890 17.469472
  Variete4 -22.8923812 -10.914912 1.062558
  Variete5 -10.7152821 -1.865884 6.983515
  Variete6 0.2743390 9.492175 18.710012
  Variete7 -23.7943250 -15.070737 -6.347148
  Variete8 -21.7310554 -12.380475 -3.029895
  Variete9 -27.9782575 -17.480555 -6.982852
  DateSemi1 -5.7903419 -1.547875 2.694592
  DateSemi2 3.6571596 8.428417 13.199675
  attr(,label)
  [1] Fixed effects:
 
  How is it possible to obtain a return with the name of my factor's levels as
  with contr.treatment ?
 
  Thanks for you help.
 
  --
  Ghislain Vieilledent
  30, rue Bernard Ortet 31 500 TOULOUSE
  06 24 62 65 07
 
  [[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


-- 
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] High resolution plots

2005-07-14 Thread Knut Krueger


Peter Dalgaard schrieb:

What is the real issue here? Import trouble? If you're importing to
Word/PowerPoint, why not use the Windows metafile? Perhaps they are
too ugly compared to EPS by your taste?
  


My reason was
http://www.adobe.com/support/techdocs/328541.html

I tried to plot emf files with pagemaker (not even a cheep or freeware 
pprogramm) and the lyaout was corrupted.
I tried to use eps files the text was corrupted
and I do not know how to transfer the *.ps file to tiff.
Maybe there is any payware but if you have a layout application for more than 
700 Euro you don´t like to by any further application only to change the *.ps 
format.
So I am looking for any solution to increase the resolution.
Maybe I do not understand the meanings of res, width and heigh or it is not 
working as expected (see answer from 12 Jul 2005)
I still hope that Porf. Brian D. Ripley will answer to this question even 
though I got him on his nerves with a wrong answer. :-(

with regards
Knut Krueger
http://www.biostatistic.de

__
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] Ellipse Cosrrespondence Analysis(Internal Stability)

2005-07-14 Thread Aam Sudrajat
I'am a student of Educational Universiti of Indonesia.
I take Internal Stabiliti in Correespondence Analysis of Normal Distributerd 
Data for my final task.
 
I've had problem with ellipse contructing as STATISTICA 6.0 generate in 
Correspondence Analysis Session.
I thing the ellipse in bivariate normal distribution can be applied in the plot 
of correspondence analysis.
 
The ellipse is
t(X-Xbar)(inverse(Sigma))(X-Xbar)= chi-square(alfa,2)
and the probability is 
P[t(X-Xbar)(inverse(Sigma))(X-Xbar)= chi-square(alfa,2)]=1-alfa
 
The point outside the ellipse become supplementary points as the point outside 
the ellipse in the bivariate normal is outlier.
 
If i construct the ellipse from the row and column coordinates like
t(F-Fbar)(inverse(Sigma(F)))(F-Fbar)= chi-square(alfa,2),
 
wheter the ellipse valid? (for detecting outlier data)
 
How can i create the valid ellipse ?
Please Help Me.
Thanks to you all..




-

[[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] High resolution plots

2005-07-14 Thread Peter Dalgaard
Knut Krueger [EMAIL PROTECTED] writes:

 Peter Dalgaard schrieb:
 
 What is the real issue here? Import trouble? If you're importing to
 Word/PowerPoint, why not use the Windows metafile? Perhaps they are
 too ugly compared to EPS by your taste?
 
 
 My reason was
 http://www.adobe.com/support/techdocs/328541.html

Oh, lovely.
 
 I tried to plot emf files with pagemaker (not even a cheep or
 freeware pprogramm) and the lyaout was corrupted. I tried to use eps
 files the text was corrupted and I do not know how to transfer the
 *.ps file to tiff.

Stupid question: You did remember to close the graphics device when
you generated those plots (dev.off())? 

If an EPS file doesn't work with an Adobe product, there is some
reason to suspect that the file is corrupted or that there is an issue
with R's postscript driver. If you're seeing text corruption outside
the plot, then surely the E in EPS (for encapsulated) is not working
as intended. 

Did you try the pdf() driver? That usually comes out rather nicely in
connection with Acrobat/Distiller.

 Maybe there is any payware but if you have a layout application for
 more than 700 Euro you don´t like to by any further application only
 to change the *.ps format. So I am looking for any solution to
 increase the resolution. Maybe I do not understand the meanings of
 res, width and heigh or it is not working as expected (see answer
 from 12 Jul 2005) I still hope that Porf. Brian D. Ripley will
 answer to this question even though I got him on his nerves with a
 wrong answer. :-(
 
 with regards
 Knut Krueger
 http://www.biostatistic.de
 
 
 
 

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

__
R-help@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] High resolution plots

2005-07-14 Thread Knut Krueger


Peter Dalgaard schrieb:

Knut Krueger [EMAIL PROTECTED] writes:

  

Peter Dalgaard schrieb:



What is the real issue here? Import trouble? If you're importing to
Word/PowerPoint, why not use the Windows metafile? Perhaps they are
too ugly compared to EPS by your taste?

  

My reason was
http://www.adobe.com/support/techdocs/328541.html



Oh, lovely.
 

isn't it ? :-( 

Stupid question: You did remember to close the graphics device when
you generated those plots (dev.off())? 
  

the first idea was no I didn´t ... but I found my script and I did :-)

If an EPS file doesn't work with an Adobe product, there is some
reason to suspect that the file is corrupted or that there is an issue
with R's postscript driver. If you're seeing text corruption outside
the plot, then surely the E in EPS (for encapsulated) is not working
as intended. 
  

That's a normal behaviour in windows surrounding.

Did you try the pdf() driver? That usually comes out rather nicely in
connection with Acrobat/Distiller.
  

No I did not actually.
the plots are good enough for printing with an laser printer, but they 
are not good enough for the journal.
It is curious. one of them wants only pdf the other one wants tiff and 
wordperfect or word .. maybe the next one will receive old latin stone 
plates ;-)

Therefore  for one journal  it is enough to use the eps or bmp 
resolution with pdf file or just an pdf output, but for the next one I 
will need a tiff with 300 dpi at least.


 
with regards
Knut Krueger
http://www.biostatistic.de


[[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] Memory question

2005-07-14 Thread Kenneth Cabrera

Thank you Dr. Spencer Graves for your answer.

What kind of matrices? They come form an image of about 3000x5000, and
I need to generate arround 1024 matrices of the same size, they are not 
sparse

matrices.

What function can I use to, once generated one matrix, I could save into 
disk

and then use the same space for the following, and so on.

Thank you very much for your help

Kenneth

Spencer Graves wrote:

	  What kinds of matrices?  There are facilities in the Matrix and 
SparseM packages that might help for sparse matrices.  If they are N x k 
where N is large and k is not, can you compute something like the QR 
decomposition and get away with keeping only the R part for most of your 
matrices?


	  One could potentially define a class of matrices that are only kept 
in memory only when needed;  I think S-Plus may do that.  It would take 
a lot of work to make that work generally, but you might be able to 
accomplish what you need with a much smaller effort.


  spencer graves

Kenneth Roy Cabrera Torres wrote:

 


Hi R users and developers:

I want to know how can I save memory in R
for example:
 - saving on disk a matrix.
 - using again the matrix (changing their values)
 - saving again the matrix on disk in a different file.

The idea is that I have a process that generate several
matrices, but if I keep them all in memory it will overflow.

How can I save them in different files, so I use the same
amount of memory for each processed matrix?

Thank you for your help.

   



 

__
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] Name for factor's levels with contr.sum

2005-07-14 Thread Christoph Buser
This is exactly what I've been looking for (without success)
when I was speaking about a more elegant and general solution. 

I agree with your argument that labels might be misleading.  
Nevertheless if a user is aware what contr.sum calculates, it is
practical to have an annotation. 

Thank you very much for the solution.

Regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--



Prof Brian Ripley writes:
  One way to do this generally is to make a copy of contr.sum, rename it, 
  and set the dimnames appropriately.
  
  I think contr.treatment is misleading (it labels contrasts of two levels 
  by just one of them), and Christoph's labels are informative but 
  impractically long.  But if you want to label each contrast by the level 
  it contrasts with the rest,
  
   cont - array(0, c(lenglev, lenglev - 1),
 list(levels, levels[-lenglev]))
  
  in a modified contr.sum will do it. E.g.
  
   z - factor(letters[1:3])
   contr.treatment(z)
 b c
  a 0 0
  b 1 0
  c 0 1
   contr.sum(z)
 [,1] [,2]
  a10
  b01
  c   -1   -1
   mycontr.sum(z)
  a  b
  a  1  0
  b  0  1
  c -1 -1
  
  
  
  
  On Wed, 13 Jul 2005, Christoph Buser wrote:
  
   Dear Ghislain
  
   I do not know a general elegant solution, but for some
   applications the following example may be helpful:
  
   ## Artificial data for demonstration: group is fixed, species is random
   dat - data.frame(group = c(rep(A,20),rep(B,17),rep(C,24)),
species = c(rep(sp1, 4), rep(sp2,5),   rep(sp3,5),
  rep(sp4,6),  rep(sp5,2),  rep(sp6,5),  
   rep(sp7,3),
  rep(sp8,3), rep(sp9,4), rep(sp10,6),  
   rep(sp11,6),
  rep(sp12,6), rep(sp13,6)),
area = rnorm(61))
  
   ## You can attach a contrast at your fixed factor of interest group
   ## Create the contrast you like to test (in our case contr.sum for 3
   ## levels)
   mat - contr.sum(3)
   ## You can add the names you want to see in the output
   ## Be carefull that you give the correct names to the concerned
   ## column. Otherwise there is the big danger of misinterpretation.
   colnames(mat) - c(: A against rest, : B against rest)
   ## Attatch the contrast at your factor group
   dat[,group] - C(dat[,group],mat)
   ## Now calculate the lme
   library(nlme)
   reg.lme - lme(area ~ group, data = dat, random = ~ 1|species)
   summary(reg.lme)
  
   Maybe someone has a better idea how to do it generally.
  
   Hope this helps
  
   Christoph Buser
  
   --
   Christoph Buser [EMAIL PROTECTED]
   Seminar fuer Statistik, LEO C13
   ETH (Federal Inst. Technology) 8092 Zurich  SWITZERLAND
   phone: x-41-44-632-4673fax: 632-1228
   http://stat.ethz.ch/~buser/
   --
  
  
   Ghislain Vieilledent writes:
Good morning,
   
I used in R contr.sum for the contrast in a lme model:
   
 options(contrasts=c(contr.sum,contr.poly))
 Septo5.lme-lme(Septo~Variete+DateSemi,Data4.Iso,random=~1|LieuDit)
 intervals(Septo5.lme)$fixed
lower est. upper
(Intercept) 17.0644033 23.106110 29.147816
Variete1 9.5819873 17.335324 25.088661
Variete2 -3.3794907 6.816101 17.011692
Variete3 -0.5636915 8.452890 17.469472
Variete4 -22.8923812 -10.914912 1.062558
Variete5 -10.7152821 -1.865884 6.983515
Variete6 0.2743390 9.492175 18.710012
Variete7 -23.7943250 -15.070737 -6.347148
Variete8 -21.7310554 -12.380475 -3.029895
Variete9 -27.9782575 -17.480555 -6.982852
DateSemi1 -5.7903419 -1.547875 2.694592
DateSemi2 3.6571596 8.428417 13.199675
attr(,label)
[1] Fixed effects:
   
How is it possible to obtain a return with the name of my factor's 
levels as
with contr.treatment ?
   
Thanks for you help.
   
--
Ghislain Vieilledent
30, rue Bernard Ortet 31 500 TOULOUSE
06 24 62 65 07
   
 [[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
  
  
  -- 
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
  University of Oxford, 

Re: [R] unexpected par('pin') behaviour

2005-07-14 Thread Martin Maechler
 joerg == joerg van den hoff [EMAIL PROTECTED]
 on Wed, 13 Jul 2005 16:00:58 +0200 writes:

joerg hi everybody,
joerg I noticed the following: in one of my scripts 'layout' is used to 
joerg generate a (approx. square) grid of variable dimensions (depending 
on 
joerg no. of input files). if the no. of subplots (grid cells) becomes 
joerg moderately large  (say  9) I use a construct like

joerg   ###layout grid computation and set up occurs here###
joerg   ...
joerg   opar - par(no.readonly = T);
joerg   on.exit(par(opar))
joerg   par(mar=c(4.1, 4.1, 1.1, .1))
joerg   ###plotting occurs here
joerg   ...

joerg to reduce the figure margins to achieve a more
joerg compact display. apart from 'mar' no other par()
joerg setting is modified.

yet another example of using  par('no.readonly') when it's not
needed and inefficient.

Replacing the above by

###layout grid computation and set up occurs here###
...
 op - par(mar=c(4.1, 4.1, 1.1, .1))
 on.exit(par(op))
###plotting occurs here

will be much more efficient and even solve your problem with pin.

But then, yes, there might be another par() problem hidden in
your code / example, 
but unfortunately you have not specified reproducible code.


joerg this works fine until the total number of subplots becomes too large 
joerg (large depending on the current size of the X11() graphics device 
joerg window, e.g. 7 x 6 subplots for the default size fo x11()).

joerg I then get the error message (only _after_ all plots are correctly 
joerg displayed, i.e. obviously during execution of the above on.exit() 
call)

joerg Error in par(opar) :
joerg invalid value specified for graphics parameter pin

joerg and par(pin) yields:

joerg [1]  0.34864 -0.21419

you mean *after* all the plotting ,  not the pin values in
'opar', right?

joerg which indeed is invalid (negative 2nd component).

joerg I'm aware of this note from ?par:

joerg The effect of restoring all the (settable) graphics parameters as
joerg in the examples is hard to predict if the device has been resized.
joerg Several of them are attempting to set the same things in different
joerg ways, and those last in the alphabet will win.  In particular, the
joerg settings of 'mai', 'mar', 'pin', 'plt' and 'pty' interact, as do
joerg the outer margin settings, the figure layout and figure region
joerg size.

{{which shows you the known  but not widely known fact that
  traditional par() based graphics are ``flawed by design''
  and that's why there is the package grid for better 
  designed graphics
}}

joerg but my problem occurs without any resizing of the
joerg x11() window prior to resetting par to par(opar).

It still would be interesting to get a reproducible example
here, as the posting guide asks for.

Martin


joerg any ideas, what is going on?

joerg platform powerpc-apple-darwin7.9.0
joerg arch powerpc
joerg os   darwin7.9.0
joerg system   powerpc, darwin7.9.0
joerg status   Patched
^^^
I hope that this is not the basic problem 

joerg major2
joerg minor1.0
joerg year 2005
joerg month05
joerg day  12
joerg language R

joerg regards,

joerg joerg

__
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 to increase memory for R on Soliars 10 with 16GB and 64bit R

2005-07-14 Thread Liaw, Andy
 From: Uwe Ligges
 
 Uwe Ligges wrote:
 
  Dongseok Choi wrote:
  
  Thank you very much for your help!!
  Now, it runs without any problem.
 
  Is it going to be fixed in the next release?
  
  
  Of course, Brian
 
 [hmmm, looks like some wrong shortcut has been used - and it 
 must have 
 been me who forgot to drink coffee before strating to post ...]

Is this indication that R-help is more addictive than coffee?

Andy
 
 
 I meant to say: Of course, Brian already did, see the svn log:
 
 --
 --
 r34947 | ripley | 2005-07-13 03:16:18 -0400 (Wed, 13 Jul 
 2005) | 1 line
 Changed paths:
 M /trunk/NEWS
 M /trunk/src/main/memory.c
 
 correct typo for R_alloc on 64-bit systems
 
 
 
 
 Uwe Ligges
 
 
 
 
  Thanks again,
  Dongseok
 
 
 
 
  Dongseok Choi, Ph.D.
  Assistant Professor
  Division of Biostatistics
  Department of Public Health  Preventive Medicine
  Oregon Health  Science University
  3181 SW Sam Jackson Park Road, CB-669
  Portland, OR 97239-3098
  TEL) 503-494-5336
  FAX) 503-494-4981
  [EMAIL PROTECTED]
 
 
  Prof Brian Ripley [EMAIL PROTECTED] 07/13/05 
 12:03 AM 
 
 
  On Tue, 12 Jul 2005, Dongseok Choi wrote:
 
 
  My machine is SUN Java Workstation 2100 with 2 AMD 
 Opteron CPUs and 
  16GB RAM.
  R is compiled as 64bit by using SUN compilers.
  I trying to fit quantile smoothing on my data and I got 
 an message as 
  below.
 
 
  fit1-rqss(z1~qss(cbind(x,y),lambda=la1),tau=t1)
 
 
  Error in as.matrix.csr(diag(n)) :
 
 
  cannot allocate memory block of size 2496135168
 
  The lengths of vector x and y are both 17664.
  I tried and found that the same command ran with x[1:16008] and 
  y[1:16008].
  So, it looks to me a memory related problem, but I'm not 
 sure how I 
  can allocate memory block.
   I read the command line option but not sure what do to with it.
   Could you help me on this?
 
 
 
  It is trying to allocate a single memory block of size over 2^31-1 
  bytes. R internally uses ints for sizes of vectors and 
 that is a limit 
  (see help(Memory-limits) ).  However, it is intended 
 that on 64-bit 
  systems that there is a limit here of 8*(2^31-1) but there was a 
  typo.  Please change line 1534 of src/main/memory.c to
 
  #if SIZEOF_LONG  4
 
  and re-compile.
 
  
 
 
 __
 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] High resolution plots

2005-07-14 Thread Peter Dalgaard
Knut Krueger [EMAIL PROTECTED] writes:

 Peter Dalgaard schrieb:
 
 Knut Krueger [EMAIL PROTECTED] writes:
 
 
 Peter Dalgaard schrieb:
 
 
 What is the real issue here? Import trouble? If you're importing to
 Word/PowerPoint, why not use the Windows metafile? Perhaps they are
 too ugly compared to EPS by your taste?
 
 
 My reason was
 http://www.adobe.com/support/techdocs/328541.html
 
 
 Oh, lovely.
 
 isn't it ? :-(
 
 Stupid question: You did remember to close the graphics device when
  you generated those plots (dev.off())?
 the first idea was no I didn´t ... but I found my script and I did :-)
 
 If an EPS file doesn't work with an Adobe product, there is some
 reason to suspect that the file is corrupted or that there is an issue
 with R's postscript driver. If you're seeing text corruption outside
 the plot, then surely the E in EPS (for encapsulated) is not working
  as intended.
 That's a normal behaviour in windows surrounding.
 
 Did you try the pdf() driver? That usually comes out rather nicely in
 connection with Acrobat/Distiller.
 
 No I did not actually.
 the plots are good enough for printing with an laser printer, but they
 are not good enough for the journal.
 It is curious. one of them wants only pdf the other one wants tiff and
 wordperfect or word .. maybe the next one will receive old latin stone
 plates ;-)
 
 Therefore  for one journal  it is enough to use the eps or bmp
 resolution with pdf file or just an pdf output, but for the next one I
 will need a tiff with 300 dpi at least.

It's still a bit weird if they want a bitmapped format, given the
difficulty of scaling such beasts, but what was ever wrong with
installing ghostscript and doing 

bitmap(my.tiff, tiff24nc, res=300)

?



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

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

2005-07-14 Thread Ginters
I'm a beginner in R and, therefore, I don't know how serious my trouble is.
After running a script:

 **

*t**-c(14598417794,649693)*

*data**=data.frame(read.spss(C:\\Ginters\\Kalibracija\\cal_data.sav))*

*Xs=**as.matrix(data[,1:2])
* 

*koef**=data.frame(read.spss(C:\\Ginters\\Kalibracija\\f.sav))
* 

*piks=**as.matrix(koef[,1**])*

*g=regressionestimator(Xs,piks,t)*

I get:

*Error: cannot allocate vector of size 1614604 Kb
In addition: Warning messages:
1: Reached total allocation of 255Mb: see help(memory.size) 
2: Reached total allocation of 255Mb: see help(memory.size) *

My OS is Win 2000 Proffesional.
Those 2 objects are of sizes

* object.size(Xs)
[1] 805404
 object.size(piks)
[1] 115128*

accordingly. The 2 files use only 142KB and 60KB accordingly.
Why does memory need so much (1.6 GB) space? How can I enlarge it? Is it 
possible to allocate a part of memory used to the hard drive? Or, is the 
trouble only with my script?
 Best regards,
Ginters

[[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] Memory question

2005-07-14 Thread Prof Brian Ripley
On Thu, 14 Jul 2005, Kenneth Cabrera wrote:

 Thank you Dr. Spencer Graves for your answer.

 What kind of matrices? They come form an image of about 3000x5000, and
 I need to generate arround 1024 matrices of the same size, they are not 
 sparse
 matrices.

 What function can I use to, once generated one matrix, I could save into disk
 and then use the same space for the following, and so on.

You can use either save or .saveRDS/serialize followed by rm() and gc(). 
You cannot use the same space, but you can free up the space.

Then when you need the data again, load/.readRDS/unserialize can pull the 
object back.  (If you arrange this right the object will only go into a 
temporary frame and so only be needed one at a time.)


 Thank you very much for your help

 Kenneth

 Spencer Graves wrote:

What kinds of matrices?  There are facilities in the Matrix and 
 SparseM packages that might help for sparse matrices.  If they are N x k 
 where N is large and k is not, can you compute something like the QR 
 decomposition and get away with keeping only the R part for most of your 
 matrices?
 
One could potentially define a class of matrices that are only kept 
 in memory only when needed;  I think S-Plus may do that.  It would take a 
 lot of work to make that work generally, but you might be able to 
 accomplish what you need with a much smaller effort.
 
spencer graves
 
 Kenneth Roy Cabrera Torres wrote:
 
 
 Hi R users and developers:
 
 I want to know how can I save memory in R
 for example:
  - saving on disk a matrix.
  - using again the matrix (changing their values)
  - saving again the matrix on disk in a different file.
 
 The idea is that I have a process that generate several
 matrices, but if I keep them all in memory it will overflow.
 
 How can I save them in different files, so I use the same
 amount of memory for each processed matrix?
 
 Thank you for your help.
 
 
 
 


-- 
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] memory problem

2005-07-14 Thread Duncan Murdoch
On 7/14/2005 7:19 AM, Ginters wrote:
 I'm a beginner in R and, therefore, I don't know how serious my trouble is.
 After running a script:
 
  **
 
 *t**-c(14598417794,649693)*
 
 *data**=data.frame(read.spss(C:\\Ginters\\Kalibracija\\cal_data.sav))*
 
 *Xs=**as.matrix(data[,1:2])
 * 
 
 *koef**=data.frame(read.spss(C:\\Ginters\\Kalibracija\\f.sav))
 * 
 
 *piks=**as.matrix(koef[,1**])*
 
 *g=regressionestimator(Xs,piks,t)*
 
 I get:
 
 *Error: cannot allocate vector of size 1614604 Kb
 In addition: Warning messages:
 1: Reached total allocation of 255Mb: see help(memory.size) 
 2: Reached total allocation of 255Mb: see help(memory.size) *
 
 My OS is Win 2000 Proffesional.
 Those 2 objects are of sizes
 
 * object.size(Xs)
 [1] 805404
 object.size(piks)
 [1] 115128*
 
 accordingly. The 2 files use only 142KB and 60KB accordingly.
 Why does memory need so much (1.6 GB) space? How can I enlarge it? Is it 
 possible to allocate a part of memory used to the hard drive? Or, is the 
 trouble only with my script?

This sounds like a problem with the regressionestimator function, which 
I think comes from the sampling package.  You'll need to contact the 
maintainer of the package to find out why it needs so much memory, and 
whether there's a way to get what you want without it.

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] help: how to change the size of a window after it has been created

2005-07-14 Thread wu sz
Hello,

I wish to plot some figures in a window in turn, but the size of these
figures is different, so how can I change the size of the window by
resetting the parameters before each plotting?

Thank you,
Shengzhe

__
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] Plotting greek symbols in plot titles, labels, etc.

2005-07-14 Thread Roy Werkman

Hi,

Can anyone please tell me how to use the escape sequences (e.g. \\*a for
alfa) for plotting Greek symbols in for example plot titles? I have read
the reference manual, but can't seem to get it to work.

Thanx!

Roy


-- 
The information contained in this communication and any atta...{{dropped}}

__
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] Plotting greek symbols in plot titles, labels, etc.

2005-07-14 Thread Roger D. Peng
Take a look at '?plotmath'.

-roger

Roy Werkman wrote:
 Hi,
 
 Can anyone please tell me how to use the escape sequences (e.g. \\*a for
 alfa) for plotting Greek symbols in for example plot titles? I have read
 the reference manual, but can't seem to get it to work.
 
 Thanx!
 
 Roy
 
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

__
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] help: how to change the size of a window after it has been created

2005-07-14 Thread Roger D. Peng
Not sure you can do this.  You might have to launch separate 
graphics windows.

-roger

wu sz wrote:
 Hello,
 
 I wish to plot some figures in a window in turn, but the size of these
 figures is different, so how can I change the size of the window by
 resetting the parameters before each plotting?
 
 Thank you,
 Shengzhe
 
 __
 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
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

__
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] help: how to change the size of a window after it has been created

2005-07-14 Thread Marc Schwartz
On Thu, 2005-07-14 at 14:38 +0200, wu sz wrote:
 Hello,
 
 I wish to plot some figures in a window in turn, but the size of these
 figures is different, so how can I change the size of the window by
 resetting the parameters before each plotting?
 
 Thank you,
 Shengzhe

Other than dragging a plot window with a mouse, I do not think that
there is a way to change the size of an open display device via code
(though somebody will no doubt correct me if I am wrong).

See ?Devices

Depending upon your OS, there is likely a 'width' and 'height' argument
for the screen display device for newly opened devices.

For example, under systems using X, where X11() is the screen device:

X11(width = 11, height = 8)
plot(1:10)

X11(width = 5, height = 5)
barplot(1:5)

In the above example, two separate plot windows will be created.

If you want to only have one open at a time, you can close the device
first using dev.off() before the subsequent plots. However, you lose the
current plot as soon as you close it.

X11(width = 11, height = 8)
plot(1:10)
dev.off()

X11(width = 5, height = 5)
barplot(1:5)
dev.off()

HTH,

Marc Schwartz

__
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] help: how to change the size of a window after it has been created

2005-07-14 Thread Anon.
Marc Schwartz wrote:
 On Thu, 2005-07-14 at 14:38 +0200, wu sz wrote:
 
Hello,

I wish to plot some figures in a window in turn, but the size of these
figures is different, so how can I change the size of the window by
resetting the parameters before each plotting?

Thank you,
Shengzhe
 
 
 Other than dragging a plot window with a mouse, I do not think that
 there is a way to change the size of an open display device via code
 (though somebody will no doubt correct me if I am wrong).
 

Perhaps some lateral thinking is called for.  Rather than change the 
size of the window, how about changing the size of the plotting region 
within the window.  For example:

split.screen(matrix(c(0,0.5, 0,1,  0.5,1,0,1), ncol=4, byrow=T))
plot(1:5)
close.screen(all=T)

split.screen(matrix(c(0,0.5, 0,0.5,  0.5,1,0.5,1), ncol=4, byrow=T))
plot(1:5)
close.screen(all=T)

Bob

-- 
Bob O'Hara

Dept. of Mathematics and Statistics
P.O. Box 68 (Gustaf Hällströmin katu 2b)
FIN-00014 University of Helsinki
Finland

Telephone: +358-9-191 51479
Mobile: +358 50 599 0540
Fax:  +358-9-191 51400
WWW:  http://www.RNI.Helsinki.FI/~boh/
Journal of Negative Results - EEB: http://www.jnr-eeb.org

__
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] Fieller's Conf Limits and EC50's

2005-07-14 Thread Ravi Varadhan
Hi,

I didn't verify your formulas for Fieller's method of computing the
confidence interval. A slightly simpler approach is to use the Delta method
to compute the CI.  It is also valid for any link function.  It yields a
simpler formula for the variance of EC50 (for any link function):

varEC50 - 1/b1^2 * (var.b0 + EC50^2*var.b1 + 2*EC50*cov.b0.b1)

So, you can compute the CIs as:

LCL - EC50 - zalpha.2 * sqrt(varEC50)
UCL - EC50 + zalpha.2 * sqrt(varEC50)

This works for any EC_p, where p is the probability of getting a positive
response, and for link function.  The CI from the Delta method should be
very nearly the same as that obtained using Fieller's method for EC50.  For
smaller probabilities (e.g., p  0.1), CIs for the EC_p values obtained
using the two methods can be slightly different.

Ravi.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:r-help-
 [EMAIL PROTECTED] On Behalf Of Stephen B. Cox
 Sent: Wednesday, July 13, 2005 12:43 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Fieller's Conf Limits and EC50's
 
 Folks
 
 I have modified an existing function to calculate 'ec/ld/lc' 50 values
 and their associated Fieller's confidence limits.  It is based on
 EC50.calc (writtien by John Bailer)  - but also borrows from the dose.p
 (MASS) function.  My goal was to make the original EC50.calc function
 flexible with respect to 1) probability at which to calculate the
 expected dose, and 2) the link function.  I would appreciate comments
 about the validity of doing so!  In particular - I want to make sure
 that the confidence limit calculations are still valid when changing the
 link function.
 
 ec.calc-function(obj,conf.level=.95,p=.5) {
 
  # calculates confidence interval based upon Fieller's thm.
  # modified version of EC50.calc found in PB Fig 7.22
  # now allows other link functions, using the calculations
  # found in dose.p (MASS)
  # SBC 19 May 05
 
 call - match.call()
 
  coef = coef(obj)
  vcov = summary.glm(obj)$cov.unscaled
  b0-coef[1]
  b1-coef[2]
  var.b0-vcov[1,1]
  var.b1-vcov[2,2]
  cov.b0.b1-vcov[1,2]
  alpha-1-conf.level
  zalpha.2 - -qnorm(alpha/2)
  gamma - zalpha.2^2 * var.b1 / (b1^2)
  eta = family(obj)$linkfun(p)  #based on calcs in VR's dose.p
 
  EC50 - (eta-b0)/b1
 
  const1 - (gamma/(1-gamma))*(EC50 + cov.b0.b1/var.b1)
 
  const2a - var.b0 + 2*cov.b0.b1*EC50 + var.b1*EC50^2 -
 gamma*(var.b0 - cov.b0.b1^2/var.b1)
 
  const2 - zalpha.2/( (1-gamma)*abs(b1) )*sqrt(const2a)
 
  LCL - EC50 + const1 - const2
  UCL - EC50 + const1 + const2
 
  conf.pts - c(LCL,EC50,UCL)
  names(conf.pts) - c(Lower,EC50,Upper)
 
  return(conf.pts,conf.level,call=call)
  }
 
 
 Thanks
 
 Stephen Cox
 
 __
 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] Keeping memory usage low for a big script

2005-07-14 Thread Ken Termiso
Hi all,

I've got a script that I run on several computers, some with much less ram 
than others, and I would like to try and keep the memory usage as low as 
possible. The script creates variables to store intermediate results of 
calculations, and then at the end writes a text file with the results of the 
calculations.

Is a quick and dirty way to accomplish this to use rm() to delete objects no 
longer in use, and then run gc()? ...or is there a better way?

Thanks in advance,
Ken

__
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] Where's iris?

2005-07-14 Thread Ruben Roa
 -Original Message-
 From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
 Sent: 13 July 2005 20:30
 To: Ruben Roa
 Cc: R-help@stat.math.ethz.ch
 Subject: Re: [R] Where's iris?
 
 
 On 7/13/05, Ruben Roa [EMAIL PROTECTED] wrote:
  Hi:
  Where is the iris data set actually
  located in the R 2.1.0 folder (under W XP)?
  Is it a text file or it is a binary file?
  Ruben
 
 Uwe has already explained how to get it in text
 form; however, if you are curious about its original
 format in R then its actually stored in iris.R as 
 R source code which you can view at:
 
   https://svn.r-project.org/R/trunk/src/library/datasets/data/iris.R
 
 (or download the entire R source and get it from there).

The iris.R in the website and the iris.R i get from dump(iris,file=iris.R)
from R 2.1.0 W XP are different (the file from dump() describes the factors 
using 
structure(as.integer(c()),.Label=c(),class=factor) 
whereas the file in the website uses 
gl=(,,label=c()),
but the difference did not matter. I wanted to emulate the file format in a txt 
*.R file with my own data and i could do it with the most helpful advice by you 
and Uwe. Thank you!
Ruben

__
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] Keeping memory usage low for a big script

2005-07-14 Thread Duncan Murdoch
On 7/14/2005 9:46 AM, Ken Termiso wrote:
 Hi all,
 
 I've got a script that I run on several computers, some with much less ram 
 than others, and I would like to try and keep the memory usage as low as 
 possible. The script creates variables to store intermediate results of 
 calculations, and then at the end writes a text file with the results of the 
 calculations.
 
 Is a quick and dirty way to accomplish this to use rm() to delete objects no 
 longer in use, and then run gc()? ...or is there a better way?

Using rm() is good.  gc() will run automatically as needed; the main 
reason to run it yourself is just to make calculation timings more 
reproducible.  It will also affect memory fragmentation, most likely 
beneficially, but not necessarily...

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] Fwd: Re: Problem installing R packages

2005-07-14 Thread J-C. Marioni
Hi,

I am trying to install the R libraries rmutil and repeated on a Mac OS 
X version 10.4.1 (which has the latest version of the Mac Developer tools 
installed) and I am having trouble compiling the libraries.

The error message I receive is as follows (I have only included the error 
message when I try and install the rmutil library):




* Installing *source* package 'rmutil' ... ** libs gcc-3.3 -no-cpp-precomp 
-I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include 
-fno-common -g -O2 -c cutil.c -o cutil.o gcc-3.3 -no-cpp-precomp 
-I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include 
-fno-common -g -O2 -c dist.c -o dist.o g77 -fno-common -g -O2 -c gettvc.f 
-o gettvc.o gcc-3.3 -no-cpp-precomp 
-I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include 
-fno-common -g -O2 -c romberg.c -o romberg.o gcc-3.3 -no-cpp-precomp 
-I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include 
-fno-common -g -O2 -c toms614.c -o toms614.o gcc-3.3 -bundle 
-flat_namespace -undefined suppress -o rmutil.so cutil.o dist.o gettvc.o 
romberg.o toms614.o -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 
-lg2c -lSystem
 package successfully installed ld: dist.o has external relocation 
entries in non-writable section (__TEXT,__text) for symbols: restFP saveFP 
make: *** [rmutil.so] Error 1 ERROR: compilation failed for package 
'rmutil'

..

I contacted Jim Lindsey (the package author) who wasn't able to suggest a 
solution. Hence, does anyone have an idea what could be causing this error 
or does anyone have a Mac binary for these libraries?

Thanks,

John Marioni

-- 
John Marioni
PhD Student
Computational Biology Group
Department of Applied Mathematics and Theoretical Physics
University of Cambridge
Wilberforce Road, Cambridge, CB3 0WA

Email: [EMAIL PROTECTED]
Phone: +44 (0)1223 763391

__
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] Plotting greek symbols in plot titles, labels, etc.

2005-07-14 Thread Don MacQueen
Type
demo(plotmath)
at the R prompt.

At 2:45 PM +0200 7/14/05, Roy Werkman wrote:
Hi,

Can anyone please tell me how to use the escape sequences (e.g. \\*a for
alfa) for plotting Greek symbols in for example plot titles? I have read
the reference manual, but can't seem to get it to work.

Thanx!

Roy

At 8:49 AM -0400 7/14/05, Roger D. Peng wrote:
Take a look at '?plotmath'.

-roger
Roy Werkman wrote:
   Hi,

  Can anyone please tell me how to use the escape sequences (e.g. \\*a for
  alfa) for plotting Greek symbols in for example plot titles? I have read
  the reference manual, but can't seem to get it to work.

  Thanx!

  Roy



-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

__
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] read.xport

2005-07-14 Thread Nelson, Gary (FWE)
I am trying to import data from a SAS XPORT file that contains 24 SAS files.
When I use the read.xport procedure only about 16 data frames (components)
are created.  Any suggestions?

 

 

*

Gary A. Nelson, Ph.D

Massachusetts Division of Marine Fisheries

30 Emerson Avenue

Gloucester, MA 01930

Phone: (978) 282-0308 x114

Fax: (617) 727-3337

Email: [EMAIL PROTECTED]

 


[[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] maps drawing

2005-07-14 Thread Christoph Buser
There is also the package maptools if you want or need to read
ESRI shapefiles.

Regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--


m p writes:
  Hello,
  is there a package in R that would allow map drawing:
  coastlines, country/state boundaries, maybe
  topography,
  rivers etc?
  Thanks for any guidance,
  Mark
  
  __
  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] maps drawing

2005-07-14 Thread ecoinfo
GIS-related packages in R:

 ade4 -- Analysis of Environmental Data : Exploratory and Euclidean methods 
in Environmental sciences

adehabitat -- Analysis of habitat selection by animals

fields -- Tools for spatial data

GRASS -- Interface between GRASS 5.0 geographical information system and R

Mapdata -- Extra Map Databases 

Mapproj -- Map Projections 

Maps -- Draw Geographical Maps 

Maptools -- tools for reading and handling shapefiles 

Maptree -- Mapping, pruning, and graphing tree models 

PBSmapping -- PBS Mapping 2

Shapefiles -- Read and Write ESRI Shapefiles

Sp -- classes and methods for spatial data

Spatial -- Functions for Kriging and Point Pattern Analysis 

Spatstat -- Spatial Point Pattern analysis, model-fitting and simulation

Spdep -- Spatial dependence: weighting schemes, statistics and models

 etc.


On 7/13/05, m p [EMAIL PROTECTED] wrote: 
 
 Hello,
 is there a package in R that would allow map drawing:
 coastlines, country/state boundaries, maybe
 topography,
 rivers etc?
 Thanks for any guidance,
 Mark
 
 __
 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
 



-- 
Xiaohua Dai, Dr.

* Postdoctoral in elephant-tree ecosystem simulation
 * Vegetation community analysis with GIS
* Animal movement and foraging study using GIS
-
Centre for Systems Research, Durban Institute of Technology
P.O.Box 953, Durban 4000, South Africa
Tel: +27-31-2042737(O) Fax: +27-31-2042736(O)
Mobile: +27-723682954
Personal Blog: http://www.blog.edu.cn/blog.asp?name=ecoinformatics

[[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] unexpected par('pin') behaviour

2005-07-14 Thread joerg van den hoff
Martin Maechler wrote:
joerg == joerg van den hoff [EMAIL PROTECTED]
on Wed, 13 Jul 2005 16:00:58 +0200 writes:
 
 
 joerg hi everybody,
 joerg I noticed the following: in one of my scripts 'layout' is used to 
 joerg generate a (approx. square) grid of variable dimensions (depending 
 on 
 joerg no. of input files). if the no. of subplots (grid cells) becomes 
 joerg moderately large  (say  9) I use a construct like
 
 joerg   ###layout grid computation and set up occurs here###
 joerg   ...
 joerg   opar - par(no.readonly = T);
 joerg   on.exit(par(opar))
 joerg   par(mar=c(4.1, 4.1, 1.1, .1))
 joerg   ###plotting occurs here
 joerg   ...
 
 joerg to reduce the figure margins to achieve a more
 joerg compact display. apart from 'mar' no other par()
 joerg setting is modified.
 
 yet another example of using  par('no.readonly') when it's not
 needed and inefficient.

might be. but at least it is immune against modifying some more 'par' 
settings in the course of modfications  at some other place in the 
programm. inefficiency: should be at the ppm level of total cpu-usage in 
my case, :-). what's so bad with copying back and forth this moderately 
large vector?
 
 Replacing the above by
 
 ###layout grid computation and set up occurs here###
 ...
  op - par(mar=c(4.1, 4.1, 1.1, .1))
  on.exit(par(op))
 ###plotting occurs here
 

 will be much more efficient and even solve your problem with pin.
 
right (solves the problem). I'll adopt this change for the time being. 
thank you.

 But then, yes, there might be another par() problem hidden in
 your code / example, 
 but unfortunately you have not specified reproducible code.
 
 
 joerg this works fine until the total number of subplots becomes too 
 large 
 joerg (large depending on the current size of the X11() graphics 
 device 
 joerg window, e.g. 7 x 6 subplots for the default size fo x11()).
 
 joerg I then get the error message (only _after_ all plots are correctly 
 joerg displayed, i.e. obviously during execution of the above on.exit() 
 call)
 
 joerg Error in par(opar) :
 joerg invalid value specified for graphics parameter pin
 
 joerg and par(pin) yields:
 
 joerg [1]  0.34864 -0.21419
 
 you mean *after* all the plotting ,  not the pin values in
 'opar', right?

yes
 
 joerg which indeed is invalid (negative 2nd component).
 
 joerg I'm aware of this note from ?par:
 
 joerg The effect of restoring all the (settable) graphics parameters as
 joerg in the examples is hard to predict if the device has been resized.
 joerg Several of them are attempting to set the same things in different
 joerg ways, and those last in the alphabet will win.  In particular, the
 joerg settings of 'mai', 'mar', 'pin', 'plt' and 'pty' interact, as do
 joerg the outer margin settings, the figure layout and figure region
 joerg size.
 
 {{which shows you the known  but not widely known fact that
   traditional par() based graphics are ``flawed by design''
   and that's why there is the package grid for better 
   designed graphics

... which seems to my simple mind a lot more complicated to come to 
terms with than the graphics package. I understand that grid is more 
powerful but the subset of functionality provided by 'graphics' seems 
more difficult to use in 'grid'. wrong or right?
 }}
 
 joerg but my problem occurs without any resizing of the
 joerg x11() window prior to resetting par to par(opar).
 
 It still would be interesting to get a reproducible example
 here, as the posting guide asks for.
 
===cut
graphics.off()

f - function(n=7, m=6) {
nm - n*m
layout(matrix(1:(nm),n,m))
opar - par(no.readonly = T)
on.exit(par(opar))
par(mar = c(4.1, 4.1, 1.1, 0.1))
for (i in 1:nm) plot(i, pch=(i-1)%%25+1)
layout(1)
}
f(5) #good
par('pin')
f()  #bad (at least for x11() default size)
par('pin')
===cut
 Martin

thanks for bothering.
joerg
 
 
 joerg any ideas, what is going on?
 
 joerg platform powerpc-apple-darwin7.9.0
 joerg arch powerpc
 joerg os   darwin7.9.0
 joerg system   powerpc, darwin7.9.0
 joerg status   Patched
   ^^^
 I hope that this is not the basic problem 
no, don't think so. that concerned the MacOS GUI, I believe.
 
 joerg major2
 joerg minor1.0
 joerg year 2005
 joerg month05
 joerg day  12
 joerg language R
 
 joerg regards,
 
 joerg joerg
 


__
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

2005-07-14 Thread Thomas Lumley
On Thu, 14 Jul 2005, Duncan Murdoch wrote:

 On 7/14/2005 7:19 AM, Ginters wrote:
 Why does memory need so much (1.6 GB) space? How can I enlarge it? Is it
 possible to allocate a part of memory used to the hard drive? Or, is the
 trouble only with my script?

 This sounds like a problem with the regressionestimator function, which
 I think comes from the sampling package.  You'll need to contact the
 maintainer of the package to find out why it needs so much memory, and
 whether there's a way to get what you want without it.



You can do regression calibration of sampling weights using the 
calibrate() function in the survey package. That might use less memory.


-thomas

__
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] Fwd: Re: Problem installing R packages

2005-07-14 Thread Prof Brian Ripley
What Fortran compiler (g77) are you using, obtained from where?  See

http://www.astro.gla.ac.uk/users/norman/note/2004/restFP/

Your lines are wrapped in ways that make parsing impossible, but my guess 
at the link line does not include -lcc_dynamic.

See also the list archives, e.g.

http://tolstoy.newcastle.edu.au/R/help/05/06/7345.html

and of course the r-sig-mac list for the mysteries of MacOS X.  People 
seem to be moving to gcc4/gfortran on that platform.


On Thu, 14 Jul 2005, J-C. Marioni wrote:

 Hi,

 I am trying to install the R libraries rmutil and repeated on a Mac OS
 X version 10.4.1 (which has the latest version of the Mac Developer tools
 installed) and I am having trouble compiling the libraries.

 The error message I receive is as follows (I have only included the error
 message when I try and install the rmutil library):

 


 * Installing *source* package 'rmutil' ... ** libs gcc-3.3 -no-cpp-precomp
 -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include
 -fno-common -g -O2 -c cutil.c -o cutil.o gcc-3.3 -no-cpp-precomp
 -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include
 -fno-common -g -O2 -c dist.c -o dist.o g77 -fno-common -g -O2 -c gettvc.f
 -o gettvc.o gcc-3.3 -no-cpp-precomp
 -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include
 -fno-common -g -O2 -c romberg.c -o romberg.o gcc-3.3 -no-cpp-precomp
 -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include
 -fno-common -g -O2 -c toms614.c -o toms614.o gcc-3.3 -bundle
 -flat_namespace -undefined suppress -o rmutil.so cutil.o dist.o gettvc.o
 romberg.o toms614.o -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2
 -lg2c -lSystem
 package successfully installed ld: dist.o has external relocation
 entries in non-writable section (__TEXT,__text) for symbols: restFP saveFP
 make: *** [rmutil.so] Error 1 ERROR: compilation failed for package
 'rmutil'

 ..

 I contacted Jim Lindsey (the package author) who wasn't able to suggest a
 solution. Hence, does anyone have an idea what could be causing this error
 or does anyone have a Mac binary for these libraries?

 Thanks,

 John Marioni

 -- 
 John Marioni
 PhD Student
 Computational Biology Group
 Department of Applied Mathematics and Theoretical Physics
 University of Cambridge
 Wilberforce Road, Cambridge, CB3 0WA

 Email: [EMAIL PROTECTED]
 Phone: +44 (0)1223 763391

 __
 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


[R] DSC 2005 registration

2005-07-14 Thread Thomas Lumley

Early registration discount for DSC 2005: Directions in Statistical 
Computing, August 13-14, in Seattle closes on July 18.

Registration is online, from the conference web page at
   http://depts.washington.edu/dsc2005/

Titles and abstracts for presentations are at
  http://depts.washington.edu/dsc2005/program.html

-thomas

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

__
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] Coxph with factors

2005-07-14 Thread Dieter Menne
Kylie-Anne Richards kar at itga.com.au writes:

 
 I am fitting a coxph model with factors. I am running into problems when
 using 'survfit'. I am unsure how R is treating the factors when I fit, say:
 DATA-data.frame(time.sec,done,f.pom=factor(f.pom),po,vo)
 final-coxph(Surv(time.sec,done)~f.pom*vo+po,data=DATA)
  final.surv-survfit((final), individual=T,conf.type=log-log)
  print(final.surv)


Better chances to get a reply when you tell us what problems you are running 
into.

Dieter Menne

__
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] stripchart usage and alternatives

2005-07-14 Thread Dieter Menne
Mike R mike.rstat at gmail.com writes:

.
 stripchart(r~u,vertical=TRUE,pch=21)
 stripchart(rm~levels(uf),vertical=TRUE,pch=3,add=TRUE)
 
 the above code creates a scatter plot of nominal data
 
 are there alternatives to generate the same or similar
 kind of figure? 

How about stripplot in lattice/trellis?


Dieter

__
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] Fwd: Re: Problem installing R packages

2005-07-14 Thread J-C. Marioni

We used the Fortran compiler that came from the customised option when 
installing from the mac dmg

g77 --version 

GNU Fortran (GCC) 3.4.2

We will look into the links you provided.

Thanks,

John



On Jul 14 2005, Prof Brian Ripley wrote:

 What Fortran compiler (g77) are you using, obtained from where?  See
 
 http://www.astro.gla.ac.uk/users/norman/note/2004/restFP/
 
 Your lines are wrapped in ways that make parsing impossible, but my guess 
 at the link line does not include -lcc_dynamic.
 
 See also the list archives, e.g.
 
 http://tolstoy.newcastle.edu.au/R/help/05/06/7345.html
 
 and of course the r-sig-mac list for the mysteries of MacOS X.  People 
 seem to be moving to gcc4/gfortran on that platform.
 
 
 On Thu, 14 Jul 2005, J-C. Marioni wrote:
 
  Hi,
 
  I am trying to install the R libraries rmutil and repeated on a 
  Mac OS X version 10.4.1 (which has the latest version of the Mac 
  Developer tools installed) and I am having trouble compiling the 
  libraries.
 
  The error message I receive is as follows (I have only included the 
  error message when I try and install the rmutil library):
 
  
 
 
  * Installing *source* package 'rmutil' ... ** libs gcc-3.3 
  -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/include 
  -I/usr/local/include -fno-common -g -O2 -c cutil.c -o cutil.o gcc-3.3 
  -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/include 
  -I/usr/local/include -fno-common -g -O2 -c dist.c -o dist.o g77 
  -fno-common -g -O2 -c gettvc.f -o gettvc.o gcc-3.3 -no-cpp-precomp 
  -I/Library/Frameworks/R.framework/Resources/include 
  -I/usr/local/include -fno-common -g -O2 -c romberg.c -o romberg.o 
  gcc-3.3 -no-cpp-precomp 
  -I/Library/Frameworks/R.framework/Resources/include 
  -I/usr/local/include -fno-common -g -O2 -c toms614.c -o toms614.o 
  gcc-3.3 -bundle -flat_namespace -undefined suppress -o rmutil.so 
  cutil.o dist.o gettvc.o romberg.o toms614.o 
  -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c -lSystem
  package successfully installed ld: dist.o has external 
  relocation entries in non-writable section (__TEXT,__text) for symbols: 
  restFP saveFP make: *** [rmutil.so] Error 1 ERROR: compilation failed 
  for package 'rmutil'
 
  ..
 
  I contacted Jim Lindsey (the package author) who wasn't able to 
  suggest a solution. Hence, does anyone have an idea what could be 
  causing this error or does anyone have a Mac binary for these 
  libraries?
 
  Thanks,
 
  John Marioni
 
  -- 
  John Marioni
  PhD Student
  Computational Biology Group
  Department of Applied Mathematics and Theoretical Physics
  University of Cambridge
  Wilberforce Road, Cambridge, CB3 0WA
 
  Email: [EMAIL PROTECTED]
  Phone: +44 (0)1223 763391
 
  __ 
  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] New Package: TeachingDemos

2005-07-14 Thread Greg Snow
This is to announce the new package TeachingDemos now available on
CRAN.

This is a collection of functions that I have used to demonstrate
different ideas in various classes taught.  Some of the first ones I
wrote just to help me visualize what was happening, they latter were
usefull in teaching others (both in a 1 on 1 setting, and in classroom
type settings).  

A few examples (more are available in the package):

loess.demo:  This was one of the first I wrote, mainly for myself, but
others have liked it also.  This function creates a scatterplot and
shows the loess fit, then when you click on a point in the plot it shows
the window around that point, the weights used for the local regression
at that point and the local regression used to predict at that point. 
Additional clicks will show the same info for other x-values.

vis.gamma, vis.binom, vis.norm, and vis.t:  These functions plot the
given distribution (and related distributions) then creates a Tk slider
box that allows you to change the parameters to see how the distribution
function changes.  With overlayed plots you can also see the
relationship between related distributions.

put.points.demo:  Start with a scatterplot that shows the correlation
coefficient and least squares line, then add, delete, move points
interactively to see how the correlation and regression line change.

Hopefully others will find these demonstrations useful, let me know if
you have any suggestions for additional demonstrations or improvements
on the current ones.


Greg Snow, Ph.D.
Statistical Data Center, LDS Hospital
Intermountain Health Care
[EMAIL PROTECTED]
(801) 408-8111

__
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] A statistical modeling problem

2005-07-14 Thread Ravi Varadhan
Hi,

 

This is not an R related question and I apologize for that, but given the
brain power of the R community it is hard for me to resist posting this
here.

 

I have a problem where each participant is shown a series of visual cues
(displayed on a computer screen in a random order) and asked to respond by
pressing a button (from a finite number of buttons) that corresponds to the
correct answer.  The data is of the form (r_ij , t_ij), where r_ij = 1
indicates correct response by the i-th subject on the j-th cue, and t_ij is
the time taken to respond.  Are there statistical models to describe this
set up?  Any references or suggestions would be greatly appreciated.

 

Thanks very much,

Ravi.


[[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] read.xport

2005-07-14 Thread bogdan romocea
How about avoiding SAS XPORT altogether and exporting everything in
the simple, clean, non-proprietary, extremely reliable,
platform-independent ... etc text format (CSV, tab delimited etc)?


 -Original Message-
 From: Nelson, Gary (FWE) [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, July 14, 2005 10:31 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] read.xport
 
 
 I am trying to import data from a SAS XPORT file that 
 contains 24 SAS files.
 When I use the read.xport procedure only about 16 data 
 frames (components)
 are created.  Any suggestions?
 
  
 
  
 
 **
 ***
 
 Gary A. Nelson, Ph.D
 
 Massachusetts Division of Marine Fisheries
 
 30 Emerson Avenue
 
 Gloucester, MA 01930
 
 Phone: (978) 282-0308 x114
 
 Fax: (617) 727-3337
 
 Email: [EMAIL PROTECTED]
 
  
 
 
   [[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] read.xport

2005-07-14 Thread Frank E Harrell Jr
bogdan romocea wrote:
 How about avoiding SAS XPORT altogether and exporting everything in
 the simple, clean, non-proprietary, extremely reliable,
 platform-independent ... etc text format (CSV, tab delimited etc)?

I hope the problem is fixed in the latest version of foreign (no version 
info was given).  In case it's not, you may want to look at the 
sasxport.get function in the Hmisc package.

Frank

 
 
 
-Original Message-
From: Nelson, Gary (FWE) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 14, 2005 10:31 AM
To: r-help@stat.math.ethz.ch
Subject: [R] read.xport


I am trying to import data from a SAS XPORT file that 
contains 24 SAS files.
When I use the read.xport procedure only about 16 data 
frames (components)
are created.  Any suggestions?

 

 

**
***

Gary A. Nelson, Ph.D

Massachusetts Division of Marine Fisheries

30 Emerson Avenue

Gloucester, MA 01930

Phone: (978) 282-0308 x114

Fax: (617) 727-3337

Email: [EMAIL PROTECTED]

 


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


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

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


Re: [R] plot the number of replicates at the same point

2005-07-14 Thread Kerry Bush
Thank you for thinking about the problem for me.
However, I have found that your method doesn't work at
all.

You may test the following example:

x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
x1=rep(x1,4)
x2=rep(x2,4)
temp=data.frame(x1,x2)
temp1=table(temp)
plot(temp$x1,temp$x2,cex=0)
text(as.numeric(rownames(temp1)),
as.numeric(colnames(temp1)), temp1)

what I got here is not what I wanted. You may compare
with 
plot(x1,x2)

I actually want some plots similar to what SAS proc
plot produced.

Does anybody have a clue of how to do this easily in
R?

--- Jean Eid [EMAIL PROTECTED] wrote:

 You can do the following (don't know it this is the
 most efficient way but
 it works)
 
 temp-read.table(your file to read the data,
 header=T)
 temp1-table(temp)
 plot(temp$x, temp$y, cex=0)
 text(as.numeric(rownames(temp1)),
 as.numeric(colnames(temp1)), temp1)
 
 HTH
 
 
 On Wed, 13 Jul 2005, Kerry Bush wrote:
 
  Dear R-helper,
I want to plot the following-like data:
 
  x y
  1 1
  1 1
  1 2
  1 3
  1 3
  1 4
  ..
 
  In the plot that produced, I don't want to show
 the
  usual circles or points. Instead, I want to show
 the
  number of replicates at that point. e.g. at the
  position of (1,1), there are 2 obsevations, so a
  number '2' will be displayed in the plot.
  Is my narrative clear? Is there a way to make the
 plot
  in R?
 
  __
  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] Calculate of data frame

2005-07-14 Thread Zhang, Fan
Hello,
 
I have a dataframe which I read from a file:
 
df - readtable(myFile);
 
The dataframe has 4 columns: model, count, value and date where
model and date are made of charactors and count and value are
numbers. An example is like:
modelcountvaluedate
A420.87/1/2005
A310.27/2/2005
B714.27/1/2005
B16.2  7/2/2005
A2117/1/2005
B965.2 7/2/2005
 
Now I want to get the total count and value for each model/date pair,
like
modelcountvaluedate
A631.87/1/2005
A310.27/2/2005
B714.27/1/2005
B1067.4  7/2/2005
 
Anyone can tell me how to do this?
 
Thanks.
 
Fan

[[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] Error running lme.

2005-07-14 Thread John Sorkin
I am trying to fit lme using R 2.1.1 under Windows 2k. 
I am getting the following message noted below. 
Any suggestions that would help me correct my error would be greatly
appreciated.
Thanks,
John
 
 fit1lme-lme(Velocity~time,data=gate)
Error in getGroups.data.frame(dataMix, groups) : 
Invalid formula for groups

 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC
 
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
 
410-605-7119 
- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

[[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] read.xport

2005-07-14 Thread Nelson, Gary \(FWE\)
I have the latest version of foreign, but it still doesn't work.  I
quickly tried the Hmisc package, but the same issue arose.  I will delve
into the Hmisc package further.

Thanks.
-Original Message-
From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 14, 2005 11:46 AM
To: bogdan romocea
Cc: Nelson, Gary (FWE); R-help@stat.math.ethz.ch
Subject: Re: [R] read.xport


bogdan romocea wrote:
 How about avoiding SAS XPORT altogether and exporting everything in 
 the simple, clean, non-proprietary, extremely reliable, 
 platform-independent ... etc text format (CSV, tab delimited etc)?

I hope the problem is fixed in the latest version of foreign (no version

info was given).  In case it's not, you may want to look at the 
sasxport.get function in the Hmisc package.

Frank

 
 
 
-Original Message-
From: Nelson, Gary (FWE) [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 14, 2005 10:31 AM
To: r-help@stat.math.ethz.ch
Subject: [R] read.xport


I am trying to import data from a SAS XPORT file that
contains 24 SAS files.
When I use the read.xport procedure only about 16 data 
frames (components)
are created.  Any suggestions?

 

 

**
***

Gary A. Nelson, Ph.D

Massachusetts Division of Marine Fisheries

30 Emerson Avenue

Gloucester, MA 01930

Phone: (978) 282-0308 x114

Fax: (617) 727-3337

Email: [EMAIL PROTECTED]

 


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


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

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


[R] Partek has Dunn-Sidak Multiple Test Correction. Is this the same/similar to any of R's p.adjust.methods?

2005-07-14 Thread Earl F. Glynn
The Partek package (www.partek.com) allows only two selections for Multiple
Test Correction:  Bonferroni and Dunn-Sidak.  Can anyone suggest why Partek
implemented Dunn-Sidak and not the other methods that R has?  Is there any
particular advantage to the Dunn-Sidak method?
R knows about these methods (in R 2.1.1):

 p.adjust.methods
[1] holm hochberg hommel bonferroni BH BY fdr
[8] none

BH is Benjamini  Hochberg (1995) and is also called fdr (I wish R's
documentation said this clearly).  BY is Benjamini  Yekutieli (2001).

I found a few hits from Google on Dunn-Sidak, but I'm curious if anyone can
tell me on a conservative-liberal scale, where the Dunn-Sidak method
falls? My guess is it's less conservative than Bonferroni (but aren't all
the other methods?), but how does it compare to the other methods?

A limited numerical experiment suggested this order to me:  bonferroni (most
conservative), hochberg and holm about the same, BY, BH (also called fdr),
and then none.

Thanks for any of  thoughts on this.

efg

__
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] East Asian language

2005-07-14 Thread Nan Lin
Dear all,

I just installed R 2.1.1. The installation program automatically recognized 
my Windows XP was using Chinese language, so now my R console displays 
everything in Chinese. How can I still let R console display in English 
without modifying my Window XP language setup? Thank you so much!

Best,

Nan

__
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] Does R have ANOVA permutation tests?

2005-07-14 Thread Lu Yuefeng
Hi list,

Does anybody know if R has functions to do the ANOVA permutation
test?  I googled and found R has the vegan package to do ANOVA like
permutation test for Constrained Correspondence Analysis. But does R
have a function for general ANOVA-like permutation tests? Thanks in
advance!

Yuefeng

__
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] Calculate of data frame

2005-07-14 Thread Peter Dalgaard
Zhang, Fan [EMAIL PROTECTED] writes:

 Now I want to get the total count and value for each model/date pair,
 like
 modelcountvaluedate
 A631.87/1/2005
 A310.27/2/2005
 B714.27/1/2005
 B1067.4  7/2/2005
  
 Anyone can tell me how to do this?

 aggregate(df[,c(count,value)],df[,c(date,model)],sum)
  date model count value
1 7/1/2005 A 6  31.8
2 7/2/2005 A 3  10.2
3 7/1/2005 B 7  14.2
4 7/2/2005 B10  71.4


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

__
R-help@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] plot the number of replicates at the same point

2005-07-14 Thread Deepayan Sarkar
On 7/14/05, Kerry Bush [EMAIL PROTECTED] wrote:
 Thank you for thinking about the problem for me.
 However, I have found that your method doesn't work at
 all.
 
 You may test the following example:
 
 x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
 x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
 x1=rep(x1,4)
 x2=rep(x2,4)
 temp=data.frame(x1,x2)
 temp1=table(temp)
 plot(temp$x1,temp$x2,cex=0)
 text(as.numeric(rownames(temp1)),
 as.numeric(colnames(temp1)), temp1)
 
 what I got here is not what I wanted. You may compare
 with
 plot(x1,x2)
 
 I actually want some plots similar to what SAS proc
 plot produced.
 
 Does anybody have a clue of how to do this easily in
 R?

Try this:


x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
x1=rep(x1,4)
x2=rep(x2,4)
temp=data.frame(x1,x2)

foo - subset(as.data.frame(table(temp)), Freq  0)
foo$x1 - as.numeric(as.character(foo$x1))
foo$x2 - as.numeric(as.character(foo$x2))

with(foo, plot(x1, x2, type = n))
with(foo, text(x1, x2, lab = Freq))


-Deepayan

__
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] Error running lme.

2005-07-14 Thread Doran, Harold
John

Your model is not properly specified for lme. You have not included any
random effects or a grouping variable. Let me assume just for sake of
argument that you want to include a random effect for the intercept and
for time. Your lme specification would be 

 fm1 - lme(Velocity~time, random=~time|ID, gate)

Where ID is a grouping variable. 

I would encourage you to work with lmer, which is now found in the
Matrix package. The call to lmer differs slightly from lme,

 fm1 - lmer(Velocity~time + (time|ID), gate) 

I hope this is helpful,
Harold

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Sorkin
Sent: Thursday, July 14, 2005 1:05 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Error running lme.

I am trying to fit lme using R 2.1.1 under Windows 2k. 
I am getting the following message noted below. 
Any suggestions that would help me correct my error would be greatly
appreciated.
Thanks,
John
 
 fit1lme-lme(Velocity~time,data=gate)
Error in getGroups.data.frame(dataMix, groups) : 
Invalid formula for groups

 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC
 
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR)
Baltimore, MD 21201-1524
 
410-605-7119
-- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

[[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] East Asian language

2005-07-14 Thread Uwe Ligges
Nan Lin wrote:

 Dear all,
 
 I just installed R 2.1.1. The installation program automatically recognized 
 my Windows XP was using Chinese language, so now my R console displays 
 everything in Chinese. How can I still let R console display in English 
 without modifying my Window XP language setup? Thank you so much!


E.g. by setting the envrionment variable
   LANGUAGE=en

Uwe Ligges


 Best,
 
 Nan
 
 __
 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] plot the number of replicates at the same point

2005-07-14 Thread Marc Schwartz (via MN)
On Thu, 2005-07-14 at 12:30 -0500, Deepayan Sarkar wrote:
 On 7/14/05, Kerry Bush [EMAIL PROTECTED] wrote:
  Thank you for thinking about the problem for me.
  However, I have found that your method doesn't work at
  all.
  
  You may test the following example:
  
  x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
  x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
  x1=rep(x1,4)
  x2=rep(x2,4)
  temp=data.frame(x1,x2)
  temp1=table(temp)
  plot(temp$x1,temp$x2,cex=0)
  text(as.numeric(rownames(temp1)),
  as.numeric(colnames(temp1)), temp1)
  
  what I got here is not what I wanted. You may compare
  with
  plot(x1,x2)
  
  I actually want some plots similar to what SAS proc
  plot produced.
  
  Does anybody have a clue of how to do this easily in
  R?
 
 Try this:
 
 
 x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
 x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
 x1=rep(x1,4)
 x2=rep(x2,4)
 temp=data.frame(x1,x2)
 
 foo - subset(as.data.frame(table(temp)), Freq  0)
 foo$x1 - as.numeric(as.character(foo$x1))
 foo$x2 - as.numeric(as.character(foo$x2))
 
 with(foo, plot(x1, x2, type = n))
 with(foo, text(x1, x2, lab = Freq))
 
 
 -Deepayan


Great solution Deepayan. I was just in the process of working on
something similar.

One quick modification is that the two plot()/text() functions can be
combined into:

  with(foo, plot(x1, x2, pch = as.character(Freq)))

Best regards,

Marc Schwartz

__
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] Fwd: Re: East Asian language

2005-07-14 Thread Baoqiang Cao


 Original message 
Date: Thu, 14 Jul 2005 19:50:41 +0200
From: Uwe Ligges [EMAIL PROTECTED]  
Subject: Re: [R] East Asian language  
To: Nan Lin [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch

Nan Lin wrote:

 Dear all,
 
 I just installed R 2.1.1. The installation program
automatically recognized 
 my Windows XP was using Chinese language, so now my R
console displays 
 everything in Chinese. How can I still let R console
display in English 
 without modifying my Window XP language setup? Thank you so
much!


E.g. by setting the envrionment variable
   LANGUAGE=en

Or, like what I did, change XP language setting back to
English from the control panel.

Uwe Ligges


 Best,
 
 Nan
 
 __
 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-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] Efficient testing for +ve definiteness

2005-07-14 Thread Spencer Graves
  To reinforce Prof. Ripley's comment that, Knowing the determinant 
does not tell you if the matrix is close to non-positive definite, note 
that the determinant of the negative of the identity matrix, (-diag(k)), 
is (-1)^k;  if k is even, the determinant is positive.  This silly 
example connects to real cases, as for example a 3x3 matrix of rank 1 
with eigenvalues (1, -1e-20, -1e-21).  The last two eigenvalues are 
buried in the noise relative to the largest (under standard double 
precision arithmatec).

  spencer graves

Prof Brian Ripley wrote:

 On Wed, 13 Jul 2005, Makram Talih wrote:
 
 
Dear R-users,

Is there a preferred method for testing whether a real symmetric matrix is
positive definite? [modulo machine rounding errors.]

The obvious way of computing eigenvalues via E - eigen(A, symmetric=T,
only.values=T)$values and returning the result of !any(E = 0) seems
less efficient than going through the LU decomposition invoked in
determinant.matrix(A) and checking the sign and (log) modulus of the
determinant.

I suppose this has to do with the underlying C routines. Any thoughts or
anecdotes?
 
 
 
 It has to do with what exactly you want to test.  Knowing the determinant 
 does not tell you if the matrix is close to non-positive definite or not.
 For numerical work, a comparison of the smallest eigenvalue to the largest 
 is usually the most useful indication of possible problems in 
 computations.  An alternative is to try a Choleski decomposition, which 
 may be faster but is less informative.
 
 Given how fast eigenvalues can be computed by current algorithms (and note 
 the comments in ?eigen) I would suggest not worrying about speed until you 
 need to (probably never).
 

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
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] Fwd: Re: East Asian language

2005-07-14 Thread Uwe Ligges
Baoqiang Cao wrote:

 
  Original message 
 
Date: Thu, 14 Jul 2005 19:50:41 +0200
From: Uwe Ligges [EMAIL PROTECTED]  
Subject: Re: [R] East Asian language  
To: Nan Lin [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch

Nan Lin wrote:


Dear all,

I just installed R 2.1.1. The installation program
 
 automatically recognized 
 
my Windows XP was using Chinese language, so now my R
 
 console displays 
 
everything in Chinese. How can I still let R console
 
 display in English 
 
without modifying my Window XP language setup? Thank you so
 
 much!
 

E.g. by setting the envrionment variable
  LANGUAGE=en

 
 Or, like what I did, change XP language setting back to
 English from the control panel.

No, please read the question...

Uwe Ligges


 
 
Uwe Ligges



Best,

Nan

__
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-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] Using system to run a stand alone program that requires input in Windows

2005-07-14 Thread Dr Carbon
Under Windows I want to run a stand alone program that takes a number
of commands from the user. I've been running the program from the
command line using 

C:\Data\ foo.exe  params.txt

where foo is the program is params.txt is a text file with a few lines
(9) of parameters.

I want to run this from R using system a la:

system(foo.exe, input = params.txt)

but that doesn't do it. What am I missing?

platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.0
year 2005   
month04 
day  18 
language R

__
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 system to run a stand alone program that requires input in Windows

2005-07-14 Thread Uwe Ligges
Dr Carbon wrote:

 Under Windows I want to run a stand alone program that takes a number
 of commands from the user. I've been running the program from the
 command line using 
 
 C:\Data\ foo.exe  params.txt
 
 where foo is the program is params.txt is a text file with a few lines
 (9) of parameters.
 
 I want to run this from R using system a la:
 
 system(foo.exe, input = params.txt)

 but that doesn't do it. What am I missing?

You misinterpreted input:

   system(foo.exe  params.txt)

should be sufficient. See also ?shell.

Uwe Ligges





 platform i386-pc-mingw32
 arch i386   
 os   mingw32
 system   i386, mingw32  
 status  
 major2  
 minor1.0
 year 2005   
 month04 
 day  18 
 language R
 
 __
 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] Calculate of data frame

2005-07-14 Thread Zhang, Fan
Thanks for your answer, Peter. Now I have a new data frame which is sorted by 
(model,date) pair. Since the sorting is done to charactors, I have 7/1/2005 
followed by 7/10/2005 instead of 7/2/2005. How can I do the aggregation and at 
the same time, make the result sorted the way I want (i.e, 7/1/2005 followd by 
7/2/2005)? 

Thanks,

Fan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: Thursday, July 14, 2005 1:29 PM
To: Zhang, Fan
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Calculate of data frame

Zhang, Fan [EMAIL PROTECTED] writes:

 Now I want to get the total count and value for each model/date pair, 
 like
 modelcountvaluedate
 A631.87/1/2005
 A310.27/2/2005
 B714.27/1/2005
 B1067.4  7/2/2005
  
 Anyone can tell me how to do this?

 aggregate(df[,c(count,value)],df[,c(date,model)],sum)
  date model count value
1 7/1/2005 A 6  31.8
2 7/2/2005 A 3  10.2
3 7/1/2005 B 7  14.2
4 7/2/2005 B10  71.4


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

__
R-help@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 system to run a stand alone program that requires input in Windows

2005-07-14 Thread Dr Carbon
system(foo.exe  params.txt)

Alas that hangs just opens a window with foo.exe;  params.txt is not
passed to it. That's why I thought input might work. Any other ideas.
I'm trying to think of a DOS program that requires input to test this.

__
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] Partek has Dunn-Sidak Multiple Test Correction. Is this the same/similar to any of R's p.adjust.methods?

2005-07-14 Thread Peter Dalgaard
Earl F. Glynn [EMAIL PROTECTED] writes:

 The Partek package (www.partek.com) allows only two selections for Multiple
 Test Correction:  Bonferroni and Dunn-Sidak.  Can anyone suggest why Partek
 implemented Dunn-Sidak and not the other methods that R has?  Is there any
 particular advantage to the Dunn-Sidak method?
 R knows about these methods (in R 2.1.1):
 
  p.adjust.methods
 [1] holm hochberg hommel bonferroni BH BY fdr
 [8] none
 
 BH is Benjamini  Hochberg (1995) and is also called fdr (I wish R's
 documentation said this clearly).  BY is Benjamini  Yekutieli (2001).
 
 I found a few hits from Google on Dunn-Sidak, but I'm curious if anyone can
 tell me on a conservative-liberal scale, where the Dunn-Sidak method
 falls? My guess is it's less conservative than Bonferroni (but aren't all
 the other methods?), but how does it compare to the other methods?

As far as I gather, D-S is exact for independent tests, conservative
for comparisons of group means, and liberal for mutually exclusive
tests (in which case Bonferroni is exact). It is always less
conservative than Bonferroni, but the difference is small for typical
significance levels: when the Bonferroni level is p, the D-S level is

   1 - (1-p/N)^N

and if you put p=0.05 and vary N you'll find that it varies from 0.05
at N=1 down to 0.04877 at N=10. (Exercise for the students: what
is the limit as N goes to infinity?)

The three H-methods play a somewhat different game, basically by only
requiring multiple-testing adjustment for non-significant tests.  The
FDR methods play yet differently by allowing the per test level to
increase with the number of significant tests.
 
 A limited numerical experiment suggested this order to me:  bonferroni (most
 conservative), hochberg and holm about the same, BY, BH (also called fdr),
 and then none.
 
 Thanks for any of  thoughts on this.

I'd expect the differences to be fairly small in scenarios where the
global null hypothesis is true (excluding none). The main difference
comes in when some of the nulls are actually false. Also, it depends
on your definitions: With the exception of BY and none the
p.adjust methods agree on the smallest adjusted p value, so have the
same familywise error rate under the global null. If you count the
total number of rejected tests, then you get a difference due to
cascading in the non-bonferroni cases.

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

__
R-help@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 system to run a stand alone program that requires input in Windows

2005-07-14 Thread Dr Carbon
Well, I'm confused because I tried to cook up an exaple and it appears
to work as I think it should. If I have a simple script named
myInput.bat:
@echo off
echo Enter y
set /p Input=
if /i %Input%==y (goto Proceed)
echo y not entered
exit /b
:Proceed
echo y entered

and a text file with just a y in it called y.txt then this works:
  system(myInput  y.txt, show.output.on.console = T)
Enter y
y entered
  

So, I'm baffled.

__
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] read.xport

2005-07-14 Thread Prof Brian Ripley
On Thu, 14 Jul 2005, Nelson, Gary (FWE) wrote:

 I have the latest version of foreign, but it still doesn't work.  I

Are you sure: a new version was released a few hours ago?  It may not 
answer your question, but please do give actual version numbers (as the 
posting guide asks).

-- 
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] Using system to run a stand alone program that requires input in Windows

2005-07-14 Thread Prof Brian Ripley
You want shell() not system(), I suspect, as you specified a shell command 
and I gather you are using Windows (not `DOS').

On Thu, 14 Jul 2005, Dr Carbon wrote:

system(foo.exe  params.txt)

 Alas that hangs just opens a window with foo.exe;  params.txt is not
 passed to it. That's why I thought input might work. Any other ideas.
 I'm trying to think of a DOS program that requires input to test this.

-- 
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] test for difference in the order of self generated sequence

2005-07-14 Thread Kaiya Liu
Hello,

I have an experiment in which we ask subjects to generate a list of thoughts
after being exposed to a stimuli. The thoughts were then coded into two
categories (e.g. A  B). The objective is to show that the order in which
thoughts are generated is affected by the experimental conditions. Can
somebody tell me what functions in R can help me do the test or point me to
the appropriate reference? Thanks!

Example data: Subject 1 in condition 1 generated 5 thoughts. The first,
second, and 5th thought is in category A, thought 3 and 4 are in category B.
Subject 2 only generated 4 thoughts.

---Condition-A-B
n1   11, 2, 5  3, 4
n2   23, 4  1, 2
---

Kaiya Liu

__
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] read.xport

2005-07-14 Thread Frank E Harrell Jr
Nelson, Gary (FWE) wrote:
 I have the latest version of foreign, but it still doesn't work.  I
 quickly tried the Hmisc package, but the same issue arose.  I will delve
 into the Hmisc package further.

This is disappointing as we rely on read.xport quite a bit.

You can use the option with sasxport.get that reads csv files. The help 
file has a URL with a full howto.

Frank

 
 Thanks.
 -Original Message-
 From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, July 14, 2005 11:46 AM
 To: bogdan romocea
 Cc: Nelson, Gary (FWE); R-help@stat.math.ethz.ch
 Subject: Re: [R] read.xport
 
 
 bogdan romocea wrote:
 
How about avoiding SAS XPORT altogether and exporting everything in 
the simple, clean, non-proprietary, extremely reliable, 
platform-independent ... etc text format (CSV, tab delimited etc)?
 
 
 I hope the problem is fixed in the latest version of foreign (no version
 
 info was given).  In case it's not, you may want to look at the 
 sasxport.get function in the Hmisc package.
 
 Frank
 
 


-Original Message-
From: Nelson, Gary (FWE) [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 14, 2005 10:31 AM
To: r-help@stat.math.ethz.ch
Subject: [R] read.xport


I am trying to import data from a SAS XPORT file that
contains 24 SAS files.
When I use the read.xport procedure only about 16 data 
frames (components)
are created.  Any suggestions?





**
***

Gary A. Nelson, Ph.D

Massachusetts Division of Marine Fisheries

30 Emerson Avenue

Gloucester, MA 01930

Phone: (978) 282-0308 x114

Fax: (617) 727-3337

Email: [EMAIL PROTECTED]




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

 
 
 


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

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


[R] visual event programming in R

2005-07-14 Thread Edgar Acuna

 Hello, 
 One of my students is building a visual environment for the package dprep  
developed by my research group at the University of  Puerto Rico. 
 The environment will be in the style of the Orange (specifically channels 
and tokens design) and  Weka (specifically Knowledge flow environment) 
machine learning/data mining software.  She is using only the tools provided 
by tcl/tk  (active tcl). 
 I wonder if somebody else has built such kind of  environment for a R 
package, and which tools has used? 
 
 Best, 
 Edgar Acuna 
 CASTLE group 
 UPR-Mayaguez 


--
Open WebMail Project (http://openwebmail.org)

__
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] plot the number of replicates at the same point

2005-07-14 Thread Deepayan Sarkar
On 7/14/05, Marc Schwartz (via MN) [EMAIL PROTECTED] wrote:
 On Thu, 2005-07-14 at 12:30 -0500, Deepayan Sarkar wrote:
  On 7/14/05, Kerry Bush [EMAIL PROTECTED] wrote:
   Thank you for thinking about the problem for me.
   However, I have found that your method doesn't work at
   all.
  
   You may test the following example:
  
   x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
   x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
   x1=rep(x1,4)
   x2=rep(x2,4)
   temp=data.frame(x1,x2)
   temp1=table(temp)
   plot(temp$x1,temp$x2,cex=0)
   text(as.numeric(rownames(temp1)),
   as.numeric(colnames(temp1)), temp1)
  
   what I got here is not what I wanted. You may compare
   with
   plot(x1,x2)
  
   I actually want some plots similar to what SAS proc
   plot produced.
  
   Does anybody have a clue of how to do this easily in
   R?
 
  Try this:
 
 
  x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
  x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
  x1=rep(x1,4)
  x2=rep(x2,4)
  temp=data.frame(x1,x2)
 
  foo - subset(as.data.frame(table(temp)), Freq  0)
  foo$x1 - as.numeric(as.character(foo$x1))
  foo$x2 - as.numeric(as.character(foo$x2))
 
  with(foo, plot(x1, x2, type = n))
  with(foo, text(x1, x2, lab = Freq))
 
 
  -Deepayan
 
 
 Great solution Deepayan. I was just in the process of working on
 something similar.
 
 One quick modification is that the two plot()/text() functions can be
 combined into:
 
   with(foo, plot(x1, x2, pch = as.character(Freq)))

Only as long as all(Freq  10) (I've been bitten by this before. :-) ).

Deepayan

__
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] plot the number of replicates at the same point

2005-07-14 Thread Marc Schwartz (via MN)
On Thu, 2005-07-14 at 15:08 -0500, Deepayan Sarkar wrote:
 On 7/14/05, Marc Schwartz (via MN) [EMAIL PROTECTED] wrote:
  On Thu, 2005-07-14 at 12:30 -0500, Deepayan Sarkar wrote:
   On 7/14/05, Kerry Bush [EMAIL PROTECTED] wrote:
Thank you for thinking about the problem for me.
However, I have found that your method doesn't work at
all.
   
You may test the following example:
   
x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
x1=rep(x1,4)
x2=rep(x2,4)
temp=data.frame(x1,x2)
temp1=table(temp)
plot(temp$x1,temp$x2,cex=0)
text(as.numeric(rownames(temp1)),
as.numeric(colnames(temp1)), temp1)
   
what I got here is not what I wanted. You may compare
with
plot(x1,x2)
   
I actually want some plots similar to what SAS proc
plot produced.
   
Does anybody have a clue of how to do this easily in
R?
  
   Try this:
  
  
   x1=c(0.6,0.4,.4,.4,.2,.2,.2,0,0)
   x2=c(0.4,.2,.4,.6,0,.2,.4,0,.2)
   x1=rep(x1,4)
   x2=rep(x2,4)
   temp=data.frame(x1,x2)
  
   foo - subset(as.data.frame(table(temp)), Freq  0)
   foo$x1 - as.numeric(as.character(foo$x1))
   foo$x2 - as.numeric(as.character(foo$x2))
  
   with(foo, plot(x1, x2, type = n))
   with(foo, text(x1, x2, lab = Freq))
  
  
   -Deepayan
  
  
  Great solution Deepayan. I was just in the process of working on
  something similar.
  
  One quick modification is that the two plot()/text() functions can be
  combined into:
  
with(foo, plot(x1, x2, pch = as.character(Freq)))
 
 Only as long as all(Freq  10) (I've been bitten by this before. :-) ).
 
 Deepayan


D'oh!

Indeed you are correct, since 'pch' is a single character:

  plot(1:20, pch = as.character(1:20))

as opposed to:

  plot(1:20, type = n)
  text(1:20, lab = 1:20)

Thanks for the correction.

Marc

__
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] read.xport

2005-07-14 Thread Nelson, Gary (FWE)
Sorry about the version.  I have version 0.8-8 of foreign. I downloaded
(and installed) it this afternoon.  The XPORT files were created in SAS
using PROC COPY.  I used the code:
temp-read.xport(c:/temp/int82ag.xpt).  I still get only 16 file of
the 24 SAS placed into the XPORT file. The XPORT files come from
ftp://cusk.nmfs.noaa.gov/mrfss/intercept/ag/ if anyone wants to try it.
I used the .xpt in int82ag.zip and it appears they were created using
SASV5XPT.




-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 14, 2005 2:01 PM
To: Nelson, Gary (FWE)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] read.xport


On Thu, 14 Jul 2005, Nelson, Gary (FWE) wrote:

 I have the latest version of foreign, but it still doesn't work.  I

Are you sure: a new version was released a few hours ago?  It may not 
answer your question, but please do give actual version numbers (as the 
posting guide asks).

-- 
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] integer codes of factors

2005-07-14 Thread Mike R
  U = c(b, b, b, c, d, e, e)

  F1 = factor( U, levels=c(a, b, c, d, e) )

  as.numeric(F1) 
  [1] 2 2 2 3 4 5 5 

Here, the integer code of b in F1 is 2

  K = factor( levels(F1) )
  as.numeric(K)
  [1] 1 2 3 4 5
  K
  [1] a b c d e
  Levels: a b c d e

And again, the integer code of b in K is 2. Great!

I am wondering how modify that usage such that the correspondence between 
the two numeric vectors can this be trusted.  for example, the correspondence 
can be corrupted by placing the a at the end:

  F2 = factor( U, levels=c(b, c, d, e, a) )
 
  as.numeric(F2) 
  [1] 1 1 1 2 3 4 4

Placing the a at the end changed the integer code of b in F2 to 1, which is 
not a problem. But ..

  K = factor( levels(F2) )
  as.numeric( K )
  [1] 2 3 4 5 1
  K
  [1] b c d e a
  Levels: a b c d e

But the integer code of b in K is now 2, which does not correspond to its code
in F2.

One would think that ordered=TRUE ought to avoid the corruption, but it does not
seem to accomplish that:

  K = factor(  levels(F2), ordered=TRUE ) 
  as.numeric(K)
  [1] 2 3 4 5 1
  K
  [1] b c d e a
  Levels: a  b  c  d  e

But the integer code of b in K is still 2.

However, corruption can be avoided with this idiom:

  K = factor(  levels(F2), levels=levels(F2) )
  as.numeric(K)
  [1] 1 2 3 4 5
  K
  [1] b c d e a
  Levels: b c d e a

Now the integer code of b in K is 1, which, as desired, is in
correspondence with
its code in F2.

__
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] read.xport

2005-07-14 Thread Peter Dalgaard
Frank E Harrell Jr [EMAIL PROTECTED] writes:

 Nelson, Gary (FWE) wrote:
  I have the latest version of foreign, but it still doesn't work.  I
  quickly tried the Hmisc package, but the same issue arose.  I will delve
  into the Hmisc package further.
 
 This is disappointing as we rely on read.xport quite a bit.

Indeed. Can SAS read everyhting in the XPORT lib? If so, what can we
do to figure out what goes wrong in read.xport. Can you paraphrase the
situation using simulated data and put the file somewhere?


snippage
 -Original Message-
 From: Nelson, Gary (FWE) [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 14, 2005 10:31 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] read.xport
 
 
 I am trying to import data from a SAS XPORT file that
 contains 24 SAS files.
 When I use the read.xport procedure only about 16 data 
 frames (components)
 are created.  Any suggestions?
 
 
 
 
 
 **
 ***
 
 Gary A. Nelson, Ph.D
 
 Massachusetts Division of Marine Fisheries
 
 30 Emerson Avenue
 
 Gloucester, MA 01930
 
 Phone: (978) 282-0308 x114
 
 Fax: (617) 727-3337
 
 Email: [EMAIL PROTECTED]
 
 
 
 
[[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
 
  
  
  
 
 
 -- 
 Frank E Harrell Jr   Professor and Chair   School of Medicine
   Department of Biostatistics   Vanderbilt University
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

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

__
R-help@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] question from environmental statistics

2005-07-14 Thread pantd


Dear R users
I want to knw if there is a way in which a raw dataset can be modelled by some
distribution. besides the gof test is there any test involving gamma or
lognormal that would fit the data.

thank you

-dev

__
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] read.xport

2005-07-14 Thread Peter Dalgaard
Peter Dalgaard [EMAIL PROTECTED] writes:

 Frank E Harrell Jr [EMAIL PROTECTED] writes:
 
  Nelson, Gary (FWE) wrote:
   I have the latest version of foreign, but it still doesn't work.  I
   quickly tried the Hmisc package, but the same issue arose.  I will delve
   into the Hmisc package further.
  
  This is disappointing as we rely on read.xport quite a bit.
 
 Indeed. Can SAS read everyhting in the XPORT lib? If so, what can we
 do to figure out what goes wrong in read.xport. Can you paraphrase the
 situation using simulated data and put the file somewhere?

Lines crossed... Gary anwered the last bits already, and I can confirm
both that SAS will read all 24 elements, whereas lookup.xport leaves
off 7 of them - in the middle. Specifically:

 names(lookup.xport(int82ag.xpt))
 [1] I1_821  I1_822  I1_823 I1_824  I1_825  I1_826   I2_821
 [8] I2_822  I2_823  I2_824  I2_825 I2_826  GP4_822  GP4_823
[15] GP4_824 GP4_825 GP4_826

whereas PROC CONTENTS shows

 grep 'Data Set Name' readxport.lst | awk '{print $4}'
FOO.I1_821
FOO.I1_822
FOO.I1_823
FOO.I1_824
FOO.I1_825
FOO.I1_826
FOO.I2_821
FOO.I2_822
FOO.I2_823
FOO.I2_824
FOO.I2_825
FOO.I2_826
FOO.I3_821
FOO.I3_822
FOO.I3_823
FOO.I3_824
FOO.I3_825
FOO.I3_826
FOO.GP4_821
FOO.GP4_822
FOO.GP4_823
FOO.GP4_824
FOO.GP4_825
FOO.GP4_826

Notice that all the I3's and GP4_821 has gone AWOL in lookup.xport

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

__
R-help@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] plot the number of replicates at the same point

2005-07-14 Thread Jim Lemon

Hi all,

This is nowhere near as elegant as Deepayan's solution, but I read the 
spec as plotting symbols except where there were overlays. You are 
welcome to improve the following...


Jim
count.overplot-function(x,y,tol=NULL,...) {
 if(missing(x))
  stop(Usage: count.overplot(x,y,tol=NULL,...))
 dimx-dim(x)
 # if x is a data frame or matrix with at least two columns, split it
 if(missing(y)  !is.null(dimx)) {
  y-x[,2]
  x-x[,1]
 }
 xlen-length(x)
 if(xlen != length(y)) stop(x and y must be the same length.)
 if(is.null(tol)) tol-c((max(x)-min(x))/1000,(max(y)-min(y))/1000)
 flags-1:xlen
 xsep-ysep-xdup-ydup-xydup-rep(0,xlen)
 nsep-ndup-0
 for(i in 1:xlen) {
  if(!is.na(flags[i])) {
   dups-abs(x - x[i]) = tol[1]  abs(y - y[i]) = tol[2]
   ndups-sum(dups)
   if(ndups  1) {
ndup-ndup+1
xydup-ndups
xdup[ndup]-x[i]
ydup[ndup]-y[i]
   }
   else {
nsep-nsep+1
xsep[nsep]-x[i]
ysep[nsep]-y[i]
   }
  }
  flags[dups]-NA
 }
 plot(xsep[1:nsep],ysep[1:nsep],...)
 text(xdup[1:ndup],ydup[1:ndup],xydup[1:ndup])
}
__
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] Variance components from lm?

2005-07-14 Thread Steve Ellison
I often use simple nested random-effect models for interlaboratory data.
The variance components are important things to know.

Is there an R function or package that gets variance components from lm
objects? Or can someone point me to a method of doing so?

__
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] plot the number of replicates at the same point

2005-07-14 Thread Gabor Grothendieck
See ?sunflowerplot for a graphic indication of 
the number of replications at each point.

__
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] Variance components from lm?

2005-07-14 Thread Spencer Graves
  Under normal circumstances, 'RSiteSearch(variance components)' 
would likely identify lme in package nlme and lmer in package lme4.  I 
recommend lme, as it comes with a fairly complete set of helper 
functions described in Pinheiro and Bates (2000) Mixed-Effect Models in 
S and S-Plus (Springer).  lmer is Doug Bates' next generation product 
currently under development and lacking some of the helper functions 
available with lme.

  spencer graves
p.s.  I said, Under normal circumstances, because when I tried 
RSiteSearch just now, it didn't work.  When I went to 
www.r-project.org - Search - R site search, I got Computer 
trouble, July 13, 2005.  When it works (which is 99.7% of the time), it 
is my favorite tool for finding things about R for which I don't already 
know where to look.

Steve Ellison wrote:

 I often use simple nested random-effect models for interlaboratory data.
 The variance components are important things to know.
 
 Is there an R function or package that gets variance components from lm
 objects? Or can someone point me to a method of doing so?
 
 __
 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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
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] Calculation of group summaries

2005-07-14 Thread Seeliger . Curt
Several people suggested specific functions (by, tapply, sapply and
others); thanks for not blowing off a simple question regarding how to
do the following SQL in R:
   select year,
  site_id,
  visit_no,
  mean(undercut) AS meanUndercut,
  count(undercut) AS nUndercut,
  std(undercut) AS stdUndercut
   from channelMorphology
   group by year, site_id, visit_no
   ;

I'd spent quite a bit of time with the suggested functions earlier but
had no luck as I'd misread the docs and put the entire dataframe where
it only wants the columns to be processed.  Sometimes it's the simplest
of things.

This has lead to another confoundment-- sd() acts differently than
mean() for some reason, at least with R 1.9.0.  For some reason, means
generate NA results and a warning message for each group:

  argument is not numeric or logical: returning NA in:
mean.default(data[x, ], ...)

Of course, the argument is numeric, or there'd be no sd value.  Or more
likely, I'm still missing something really basic. If I wrap the value in
as.numeric() things work fine.  Why should I have to do this for mean
and median, but not sd? The code below should reproduce this error

  # Fake data for demo:
  nsites-6
  yearList-1999:2001
  fakesub-as.data.frame(cbind(
 year =rep(yearList,nsites/length(yearList),each=11)
,site_id  =rep(c('site1','site2'),each=11*nsites)
,visit_no =rep(1,11*2*nsites)
,transect =rep(LETTERS[1:11],nsites,each=2)
,transdir =rep(c('LF','RT'),11*nsites)
,undercut =abs(rnorm(11*2*nsites,10))
,angle=runif(11*2*nsites,0,180)
))

  # Create group summaries:
  sdmets-by(fakesub$undercut
,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
,sd
)
  nmets-by(fakesub$undercut
   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
   ,length
   )
  xmets-by(fakesub$undercut
   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
   ,mean
   )
   xmets-by(as.numeric(fakesub$undercut)
   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
   ,mean
   )

  # Put site id values (year, site_id and visit_no) into results:
  # List unique id combinations as a list of lists.  Then
  # reorganize that into 3 vectors for final results.
  # Certainly, there MUST be a better way...
  foo-strsplit(unique(paste(fakesub$year
,fakesub$site_id
,fakesub$visit_no
,sep='#'))
   ,split='#'
   )
  year-list()
  for(i in 1:length(foo)) {year-rbind(year,foo[[i]][1])}
  site_id-list()
  for(i in 1:length(foo)) {site_id-rbind(site_id,foo[[i]][2])}
  visit_no-list()
  for(i in 1:length(foo)) {visit_no-rbind(visit_no,foo[[i]][3])}

  # Final result, more or less
  data.frame(cbind(a=year,b=site_id,c=visit_no,sdmets,nmets,xmets))


cur

--
Curt Seeliger, Data Ranger
CSC, EPA/WED contractor
541/754-4638
[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] Variance components from lm?

2005-07-14 Thread Liaw, Andy
 From: Spencer Graves
 
 Under normal circumstances, 'RSiteSearch(variance 
 components)' 
 would likely identify lme in package nlme and lmer in 
 package lme4.  I 
 recommend lme, as it comes with a fairly complete set of helper 
 functions described in Pinheiro and Bates (2000) Mixed-Effect 
 Models in 
 S and S-Plus (Springer).  lmer is Doug Bates' next 
 generation product 
 currently under development and lacking some of the helper functions 
 available with lme.
 
 spencer graves
 p.s.  I said, Under normal circumstances, because when I tried 
 RSiteSearch just now, it didn't work.  When I went to 
 www.r-project.org - Search - R site search, I got Computer 
 trouble, July 13, 2005.  When it works (which is 99.7% of 
 the time), it 
 is my favorite tool for finding things about R for which I 
 don't already 
 know where to look.

The server (graciously created and maintained by Prof. Jonathan Baron)
crashed and a hard drive failure.  I was told it would likely be
back online next Monday.

I missed this search engine, too, as I've grown to depend on it quite
a bit.

Cheers,
Andy
 
 Steve Ellison wrote:
 
  I often use simple nested random-effect models for 
 interlaboratory data.
  The variance components are important things to know.
  
  Is there an R function or package that gets variance 
 components from lm
  objects? Or can someone point me to a method of doing so?
  
  __
  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
 
 -- 
 Spencer 
 Graves, PhD
 Senior Development Engineer
 PDF Solutions, Inc.
 333 West San Carlos Street Suite 700
 San Jose, CA 95110, USA
 
 [EMAIL PROTECTED]
 www.pdf.com http://www.pdf.com
 Tel:  408-938-4420
 Fax: 408-280-7915
 
 __
 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] question from environmental statistics

2005-07-14 Thread Francisco J. Zagmutt
Take a look at this document by Vito Ricci: 
http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf

Did you try RSiteSearch(Fit distribution) or a Google search?  That will 
lead you to fit.dist{gnlm} and fitdistr{MASS}

Cheers

Francisco


From: [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] question from environmental statistics
Date: Thu, 14 Jul 2005 14:06:45 -0700



Dear R users
I want to knw if there is a way in which a raw dataset can be modelled by 
some
distribution. besides the gof test is there any test involving gamma or
lognormal that would fit the data.

thank you

-dev

__
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] Calculation of group summaries

2005-07-14 Thread Gabor Grothendieck
1. Try using more spaces so your code is easier to read.

2. Use data.frame to define your data frame (since the method
in your post creates data frames of factors rather than
the desired classes).  

3. Given the appropriate function, f, a single 'by' statement rbind'ed
together, as shown, will create the result.

nsites - 6
yearList - 1999:2001
fakesub - data.frame(
year = rep(yearList, nsites/length(yearList), each = 11),
site_id  = rep(c('site1','site2'), each = 11*nsites),
visit_no = rep(1, 11*2*nsites),
transect = rep(LETTERS[1:11], nsites, each = 2),
transdir = rep(c('LF','RT'), 11*nsites),
undercut = abs(rnorm(11*2*nsites, 10)),
angle= runif(11*2*nsites, 0, 180)
)


f - function(x) cbind(year = x[1,1], site_id = x[1,2], visit_no = x[1,3], 
mean = mean(x[,6]), sd = sd(x[,6]), length = length(x[,6]))
do.call(rbind, by(fakesub, fakesub[,1:3], f))





On 7/14/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Several people suggested specific functions (by, tapply, sapply and
 others); thanks for not blowing off a simple question regarding how to
 do the following SQL in R:
select year,
   site_id,
   visit_no,
   mean(undercut) AS meanUndercut,
   count(undercut) AS nUndercut,
   std(undercut) AS stdUndercut
from channelMorphology
group by year, site_id, visit_no
;
 
 I'd spent quite a bit of time with the suggested functions earlier but
 had no luck as I'd misread the docs and put the entire dataframe where
 it only wants the columns to be processed.  Sometimes it's the simplest
 of things.
 
 This has lead to another confoundment-- sd() acts differently than
 mean() for some reason, at least with R 1.9.0.  For some reason, means
 generate NA results and a warning message for each group:
 
  argument is not numeric or logical: returning NA in:
 mean.default(data[x, ], ...)
 
 Of course, the argument is numeric, or there'd be no sd value.  Or more
 likely, I'm still missing something really basic. If I wrap the value in
 as.numeric() things work fine.  Why should I have to do this for mean
 and median, but not sd? The code below should reproduce this error
 
  # Fake data for demo:
  nsites-6
  yearList-1999:2001
  fakesub-as.data.frame(cbind(
 year =rep(yearList,nsites/length(yearList),each=11)
,site_id  =rep(c('site1','site2'),each=11*nsites)
,visit_no =rep(1,11*2*nsites)
,transect =rep(LETTERS[1:11],nsites,each=2)
,transdir =rep(c('LF','RT'),11*nsites)
,undercut =abs(rnorm(11*2*nsites,10))
,angle=runif(11*2*nsites,0,180)
))
 
  # Create group summaries:
  sdmets-by(fakesub$undercut
,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
,sd
)
  nmets-by(fakesub$undercut
   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
   ,length
   )
  xmets-by(fakesub$undercut
   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
   ,mean
   )
   xmets-by(as.numeric(fakesub$undercut)
   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
   ,mean
   )
 
  # Put site id values (year, site_id and visit_no) into results:
  # List unique id combinations as a list of lists.  Then
  # reorganize that into 3 vectors for final results.
  # Certainly, there MUST be a better way...
  foo-strsplit(unique(paste(fakesub$year
,fakesub$site_id
,fakesub$visit_no
,sep='#'))
   ,split='#'
   )
  year-list()
  for(i in 1:length(foo)) {year-rbind(year,foo[[i]][1])}
  site_id-list()
  for(i in 1:length(foo)) {site_id-rbind(site_id,foo[[i]][2])}
  visit_no-list()
  for(i in 1:length(foo)) {visit_no-rbind(visit_no,foo[[i]][3])}
 
  # Final result, more or less
  data.frame(cbind(a=year,b=site_id,c=visit_no,sdmets,nmets,xmets))
 
 
 cur
 
 --
 Curt Seeliger, Data Ranger
 CSC, EPA/WED contractor
 541/754-4638
 [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] Calculation of group summaries

2005-07-14 Thread Gabor Grothendieck
There was an error in my code (after advising you to use data.frame
rather than cbind I used it myself!).  Here it is again:


nsites - 6
yearList - 1999:2001
fakesub - data.frame(
year = rep(yearList, nsites/length(yearList), each = 11),
site_id  = rep(c('site1','site2'), each = 11*nsites),
visit_no = rep(1, 11*2*nsites),
transect = rep(LETTERS[1:11], nsites, each = 2),
transdir = rep(c('LF','RT'), 11*nsites),
undercut = abs(rnorm(11*2*nsites, 10)),
angle= runif(11*2*nsites, 0, 180)
)


f - function(x) data.frame(year = x[1,1], site_id = x[1,2], visit_no = x[1,3], 
mean = mean(x[,6]), sd = sd(x[,6]), length = length(x[,6]))
do.call(rbind, by(fakesub, fakesub[,1:3], f))



On 7/14/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 1. Try using more spaces so your code is easier to read.
 
 2. Use data.frame to define your data frame (since the method
 in your post creates data frames of factors rather than
 the desired classes).
 
 3. Given the appropriate function, f, a single 'by' statement rbind'ed
 together, as shown, will create the result.
 
 nsites - 6
 yearList - 1999:2001
 fakesub - data.frame(
year = rep(yearList, nsites/length(yearList), each = 11),
site_id  = rep(c('site1','site2'), each = 11*nsites),
visit_no = rep(1, 11*2*nsites),
transect = rep(LETTERS[1:11], nsites, each = 2),
transdir = rep(c('LF','RT'), 11*nsites),
undercut = abs(rnorm(11*2*nsites, 10)),
angle= runif(11*2*nsites, 0, 180)
 )
 
 
 f - function(x) cbind(year = x[1,1], site_id = x[1,2], visit_no = x[1,3],
mean = mean(x[,6]), sd = sd(x[,6]), length = length(x[,6]))
 do.call(rbind, by(fakesub, fakesub[,1:3], f))
 
 
 
 
 
 On 7/14/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Several people suggested specific functions (by, tapply, sapply and
  others); thanks for not blowing off a simple question regarding how to
  do the following SQL in R:
 select year,
site_id,
visit_no,
mean(undercut) AS meanUndercut,
count(undercut) AS nUndercut,
std(undercut) AS stdUndercut
 from channelMorphology
 group by year, site_id, visit_no
 ;
 
  I'd spent quite a bit of time with the suggested functions earlier but
  had no luck as I'd misread the docs and put the entire dataframe where
  it only wants the columns to be processed.  Sometimes it's the simplest
  of things.
 
  This has lead to another confoundment-- sd() acts differently than
  mean() for some reason, at least with R 1.9.0.  For some reason, means
  generate NA results and a warning message for each group:
 
   argument is not numeric or logical: returning NA in:
  mean.default(data[x, ], ...)
 
  Of course, the argument is numeric, or there'd be no sd value.  Or more
  likely, I'm still missing something really basic. If I wrap the value in
  as.numeric() things work fine.  Why should I have to do this for mean
  and median, but not sd? The code below should reproduce this error
 
   # Fake data for demo:
   nsites-6
   yearList-1999:2001
   fakesub-as.data.frame(cbind(
  year =rep(yearList,nsites/length(yearList),each=11)
 ,site_id  =rep(c('site1','site2'),each=11*nsites)
 ,visit_no =rep(1,11*2*nsites)
 ,transect =rep(LETTERS[1:11],nsites,each=2)
 ,transdir =rep(c('LF','RT'),11*nsites)
 ,undercut =abs(rnorm(11*2*nsites,10))
 ,angle=runif(11*2*nsites,0,180)
 ))
 
   # Create group summaries:
   sdmets-by(fakesub$undercut
 ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
 ,sd
 )
   nmets-by(fakesub$undercut
,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
,length
)
   xmets-by(fakesub$undercut
,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
,mean
)
xmets-by(as.numeric(fakesub$undercut)
,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
,mean
)
 
   # Put site id values (year, site_id and visit_no) into results:
   # List unique id combinations as a list of lists.  Then
   # reorganize that into 3 vectors for final results.
   # Certainly, there MUST be a better way...
   foo-strsplit(unique(paste(fakesub$year
 ,fakesub$site_id
 ,fakesub$visit_no
 ,sep='#'))
,split='#'
)
   year-list()
   for(i in 1:length(foo)) {year-rbind(year,foo[[i]][1])}
   site_id-list()
   for(i in 1:length(foo)) {site_id-rbind(site_id,foo[[i]][2])}
   visit_no-list()
   for(i in 1:length(foo)) {visit_no-rbind(visit_no,foo[[i]][3])}
 
   # Final result, more or less
   data.frame(cbind(a=year,b=site_id,c=visit_no,sdmets,nmets,xmets))
 
 
  cur
 
  --
  Curt Seeliger, Data Ranger
  CSC, 

Re: [R] test for difference in the order of self generated sequence

2005-07-14 Thread Spencer Graves
  Have you considered glmmPQL in library(MASS)?

  spencer graves

Kaiya Liu wrote:

 Hello,
 
 I have an experiment in which we ask subjects to generate a list of thoughts
 after being exposed to a stimuli. The thoughts were then coded into two
 categories (e.g. A  B). The objective is to show that the order in which
 thoughts are generated is affected by the experimental conditions. Can
 somebody tell me what functions in R can help me do the test or point me to
 the appropriate reference? Thanks!
 
 Example data: Subject 1 in condition 1 generated 5 thoughts. The first,
 second, and 5th thought is in category A, thought 3 and 4 are in category B.
 Subject 2 only generated 4 thoughts.
 
 ---Condition-A-B
 n1   11, 2, 5  3, 4
 n2   23, 4  1, 2
 ---
 
 Kaiya Liu
 
 __
 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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
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] problems with nls function

2005-07-14 Thread Yimeng Lu
Hello,

I was trying to fit a generalized logistic curve and my code for testing
if the function nls is working is like this
###
#define the generalized logistic curve function
glogit=function(a, b, c, m, t, x)

{

tmp = 1/(1 + t * exp(-b * (x - m)))^(1/t)

model.func = a + tmp * c

#define the gradient vector

Z = cbind(1, c*(x-m)*tmp^(t+1)*exp(-b*(x-m)), tmp, -c*b*exp(-b*(x-m)) 
*temp^(t+1), -c*tmp*(1/t)* (log(tmp) + tmp^(-t) * exp(-b(x-m

attr(model.func,gradient)=Z

model.func

}



a= 0

b=3

c=6

m=2

t=0.75

x=c(1:10)

y=a + c/(1 + t * exp(-b * (x - m)))^(1/t) + rnorm(16, sd=0.01)

plot(data.frame(x=x, y=y), type = p, col = red)

nls(y ~ glogit(a, b, c, m, t, x), data=data.frame(y=y,x=x), start=list(a=1, 
b=2, c=3, m=1, t=0, x), trace=T)

#End.

When I ran this code, I got the error Error in assign(i, temp, envir = env) : 
attempt to use zero-length variable name.   What does this error mean?  How 
should I fix it?



Many thanks.

Hanna Lu

Dept. of Biostatistics

Columbia University

[[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] integer codes of factors

2005-07-14 Thread Spencer Graves
  What's the problem?  As suggested by the help page, the numeric codes 
are assigned in the order the names appear in the levels argument. 
Consider the following example from the help page plus a minor 
modification:

   (ff - factor(substring(statistics, 1:10, 1:10), levels=letters))
  [1] s t a t i s t i c s
Levels: a b c d e f g h i j k l m n o p q r s t u v w x y z
 
  as.numeric(ff)
  [1] 19 20  1 20  9 19 20  9  3 19
  (ff - factor(substring(statistics, 1:10, 1:10), levels=letters[3:1]))
  [1] NA NA aNA NA NA NA NA cNA
Levels: c b a
  as.numeric(ff)
  [1] NA NA  3 NA NA NA NA NA  1 NA

  I highly recommend Venable and Ripley (2002) Modern Applied 
Statistics with S (Springer) and V  R (2000) S Programming (Springer).

  spencer graves

Mike R wrote:

   U = c(b, b, b, c, d, e, e)
 
   F1 = factor( U, levels=c(a, b, c, d, e) )
 
   as.numeric(F1) 
   [1] 2 2 2 3 4 5 5 
 
 Here, the integer code of b in F1 is 2
 
   K = factor( levels(F1) )
   as.numeric(K)
   [1] 1 2 3 4 5
   K
   [1] a b c d e
   Levels: a b c d e
 
 And again, the integer code of b in K is 2. Great!
 
 I am wondering how modify that usage such that the correspondence between 
 the two numeric vectors can this be trusted.  for example, the correspondence 
 can be corrupted by placing the a at the end:
 
   F2 = factor( U, levels=c(b, c, d, e, a) )
  
   as.numeric(F2) 
   [1] 1 1 1 2 3 4 4
 
 Placing the a at the end changed the integer code of b in F2 to 1, which 
 is 
 not a problem. But ..
 
   K = factor( levels(F2) )
   as.numeric( K )
   [1] 2 3 4 5 1
   K
   [1] b c d e a
   Levels: a b c d e
 
 But the integer code of b in K is now 2, which does not correspond to its 
 code
 in F2.
 
 One would think that ordered=TRUE ought to avoid the corruption, but it does 
 not
 seem to accomplish that:
 
   K = factor(  levels(F2), ordered=TRUE ) 
   as.numeric(K)
   [1] 2 3 4 5 1
   K
   [1] b c d e a
   Levels: a  b  c  d  e
 
 But the integer code of b in K is still 2.
 
 However, corruption can be avoided with this idiom:
 
   K = factor(  levels(F2), levels=levels(F2) )
   as.numeric(K)
   [1] 1 2 3 4 5
   K
   [1] b c d e a
   Levels: b c d e a
 
 Now the integer code of b in K is 1, which, as desired, is in
 correspondence with
 its code in F2.
 
 __
 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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
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] problems with nls function

2005-07-14 Thread Yimeng Lu
Sorry that I specified the x as 
x=c(0, 0.4, 0.7, 1, 1.4, 1.6, 1.8, 2:10)

The error message is the same.

Thanks.

Hanna

  - Original Message - 
  From: Yimeng Lu 
  To: r-help@stat.math.ethz.ch 
  Sent: Thursday, July 14, 2005 11:19 PM
  Subject: problems with nls function


  Hello,

  I was trying to fit a generalized logistic curve and my code for testing
  if the function nls is working is like this
  ###
  #define the generalized logistic curve function
  glogit=function(a, b, c, m, t, x)

  {

  tmp = 1/(1 + t * exp(-b * (x - m)))^(1/t)

  model.func = a + tmp * c

  #define the gradient vector

  Z = cbind(1, c*(x-m)*tmp^(t+1)*exp(-b*(x-m)), tmp, -c*b*exp(-b*(x-m)) 
*temp^(t+1), -c*tmp*(1/t)* (log(tmp) + tmp^(-t) * exp(-b(x-m

  attr(model.func,gradient)=Z

  model.func

  }



  a= 0

  b=3

  c=6

  m=2

  t=0.75

  x=c(1:10)

  y=a + c/(1 + t * exp(-b * (x - m)))^(1/t) + rnorm(16, sd=0.01)

  plot(data.frame(x=x, y=y), type = p, col = red)

  nls(y ~ glogit(a, b, c, m, t, x), data=data.frame(y=y,x=x), start=list(a=1, 
b=2, c=3, m=1, t=0, x), trace=T)

  #End.

  When I ran this code, I got the error Error in assign(i, temp, envir = env) 
: attempt to use zero-length variable name.   What does this error mean?  How 
should I fix it?



  Many thanks.

  Hanna Lu

  Dept. of Biostatistics

  Columbia University

[[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] A statistical modeling problem

2005-07-14 Thread Spencer Graves
  Let's do the simplest things first:  I'd start with normal 
probability plots of log(t_ij).  If that all looked sensible, I'd then 
use lme to model log(t_ij) with subject as a random effect and 
(probably) que as a fixed effect.

  Then I'd probably try something like glmmPQL in library(MASS) to 
leverage whatever I got into logistic regression models with, again, 
subject as a random effect and que and log(t_ij) as possible explanatory 
variables.

  Regarding lme, I highly recommend Pinheiro and Bates (2000) 
Mixed-Effect Models in S and S-Plus (Springer).  For glmmPQL, see 
Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. 
(Springer).  I'd also search the archives for generalized linear mixed 
models, as there are other R packages that offer related capabilities.

  spencer graves

Ravi Varadhan wrote:

 Hi,
 
  
 
 This is not an R related question and I apologize for that, but given the
 brain power of the R community it is hard for me to resist posting this
 here.
 
  
 
 I have a problem where each participant is shown a series of visual cues
 (displayed on a computer screen in a random order) and asked to respond by
 pressing a button (from a finite number of buttons) that corresponds to the
 correct answer.  The data is of the form (r_ij , t_ij), where r_ij = 1
 indicates correct response by the i-th subject on the j-th cue, and t_ij is
 the time taken to respond.  Are there statistical models to describe this
 set up?  Any references or suggestions would be greatly appreciated.
 
  
 
 Thanks very much,
 
 Ravi.
 
 
   [[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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
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] problems with nls function

2005-07-14 Thread Gabor Grothendieck
The start list should only contain parameters, not x.  Also
your function appears to have multiple errors including
reference to temp (presumably intended as tmp?)
and b(x-m) which presumably should be b*(x-m).

On 7/14/05, Yimeng Lu [EMAIL PROTECTED] wrote:
 Sorry that I specified the x as
 x=c(0, 0.4, 0.7, 1, 1.4, 1.6, 1.8, 2:10)
 
 The error message is the same.
 
 Thanks.
 
 Hanna
 
  - Original Message -
  From: Yimeng Lu
  To: r-help@stat.math.ethz.ch
  Sent: Thursday, July 14, 2005 11:19 PM
  Subject: problems with nls function
 
 
  Hello,
 
  I was trying to fit a generalized logistic curve and my code for testing
  if the function nls is working is like this
  ###
  #define the generalized logistic curve function
  glogit=function(a, b, c, m, t, x)
 
  {
 
  tmp = 1/(1 + t * exp(-b * (x - m)))^(1/t)
 
  model.func = a + tmp * c
 
  #define the gradient vector
 
  Z = cbind(1, c*(x-m)*tmp^(t+1)*exp(-b*(x-m)), tmp, -c*b*exp(-b*(x-m)) 
 *temp^(t+1), -c*tmp*(1/t)* (log(tmp) + tmp^(-t) * exp(-b(x-m
 
  attr(model.func,gradient)=Z
 
  model.func
 
  }
 
 
 
  a= 0
 
  b=3
 
  c=6
 
  m=2
 
  t=0.75
 
  x=c(1:10)
 
  y=a + c/(1 + t * exp(-b * (x - m)))^(1/t) + rnorm(16, sd=0.01)
 
  plot(data.frame(x=x, y=y), type = p, col = red)
 
  nls(y ~ glogit(a, b, c, m, t, x), data=data.frame(y=y,x=x), start=list(a=1, 
 b=2, c=3, m=1, t=0, x), trace=T)
 
  #End.
 
  When I ran this code, I got the error Error in assign(i, temp, envir = env) 
 : attempt to use zero-length variable name.   What does this error mean?  
 How should I fix it?
 
 
 
  Many thanks.
 
  Hanna Lu
 
  Dept. of Biostatistics
 
  Columbia University
 
[[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] Variance components from lm?

2005-07-14 Thread Spencer Graves
  Yes, I'm very thankful for the support of Prof. Jonathan Baron and 
all the others who have contributed their time, creative energies and 
(for some) money to make R what it is today.  It is beyond the budgets 
of most people on this planet to purchase licenses for every piece of 
statistical software that purports to do anything useful, not to mention 
the amount of time required to install and learn how to use 
fundamentally incompatible software, overcome the sometimes near 
impossiblity of porting data between the different platforms, etc.  It 
is therefore an enormous contribution to have this common platform that 
includes capabilities to perform a increasing porportion of the 
statistical analyses that people in different disciplines have found 
useful.

  Indeed, this is not only a service to the statistical community, it 
is an enormous contribution to the future of humanity, because it makes 
it easier for people to learn a variety of statistical techniques, 
thereby making it easier for them to get better answers to the questions 
that concern them -- and through their increased statistical literacy, 
making it easier for them effectively pressure others to improve the 
quality of their problem solving through better collection and analysis 
of data.

  spencer graves

Liaw, Andy wrote:

From: Spencer Graves

Under normal circumstances, 'RSiteSearch(variance 
components)' 
would likely identify lme in package nlme and lmer in 
package lme4.  I 
recommend lme, as it comes with a fairly complete set of helper 
functions described in Pinheiro and Bates (2000) Mixed-Effect 
Models in 
S and S-Plus (Springer).  lmer is Doug Bates' next 
generation product 
currently under development and lacking some of the helper functions 
available with lme.

spencer graves
p.s.  I said, Under normal circumstances, because when I tried 
RSiteSearch just now, it didn't work.  When I went to 
www.r-project.org - Search - R site search, I got Computer 
trouble, July 13, 2005.  When it works (which is 99.7% of 
the time), it 
is my favorite tool for finding things about R for which I 
don't already 
know where to look.
 
 
 The server (graciously created and maintained by Prof. Jonathan Baron)
 crashed and a hard drive failure.  I was told it would likely be
 back online next Monday.
 
 I missed this search engine, too, as I've grown to depend on it quite
 a bit.
 
 Cheers,
 Andy
  
 
Steve Ellison wrote:


I often use simple nested random-effect models for 

interlaboratory data.

The variance components are important things to know.

Is there an R function or package that gets variance 

components from lm

objects? Or can someone point me to a method of doing so?

__
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

-- 
Spencer 
Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
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



 
 
 
 
 --
 Notice:  This e-mail message, together with any attachment...{{dropped}}

__
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