Re: Windows versus Unix packages in CRAN (Was Re: [R] Rmetrics)

2004-05-20 Thread Janusz Kawczak
And it seems that this vicious circle continues forever. Before
posting these kind of messages can you please read the INSTRUCTIONS.
fBasics_190.10051.zip is a COMPILED version of the package, not
a source as you claim to be!

It works with no problems; well, at least under Linux.

Janusz.

Richard A. O'Keefe wrote:

 Prof Brian Ripley [EMAIL PROTECTED] wrote:
 mkdir fBasics
 unzip fBasics.zip -d fBasics
 rm fBasics/src/*.o
 R CMD check fBasics

 and that took me about 3 minutes.

 Now me, I just did

 unzip -a fBasics_190.10051.zip
 R CMD INSTALL fBasics
 rm -rf fBasics

 in a naive and trusting manner.  It took me considerably longer than 3
 minutes to learn that this was what I should do, and when I did learn,
 I wondered if it's this simple, why can't R CMD INSTALL do it?

 Now I discover that it isn't that simple.  The installation apparently
 went smoothly.  This is R, right?  Never occurred to me that there might
 be problems.

 Now, B-G--R!  It turns out that core stuff is supplied as .dll files,
 which of course my UltraSPARC can do nothing with.

 The author of the Rmetrics code has a perfect right to provide his code
 in any form he wants under any conditions he wants (subject to GPL c).
 In particular, if he wants to provide a distribution which only works under
 Windows, that's perfectly OK.

 **BUT** when a distribution is peculiar to one operating system, that really
 should be highlighted in big bold letters:  this is a WINDOWS BINARY
 version, so that people who can't use Windows .DLL files are spared a day
 of trying to figure out how to unpack and of doing an installation which
 reports no errors at all and of them finding that things do not work.

 There is *NOTHING* on http://www.itp.phys.ethz.ch/econophysics/R/download.htm
 that says Windows only.  Click on I acceptand the page you arrive at has
 nothing in the text anywhere that says Windows only or what to do if not
 Windows.  (The http://.../R/bin/windows/contrib/1.9 address of the page
 was, in retrospect, a big clue, sigh.)

 It would of course be nice if the developers had done

 R CMD check fBasics

 But if you go into the Sources directory, which I suppose you must have,
 for each of {fBasics,fExtremes,fOptions,fSeries} there is an
 xxx-00check.log.txt, so they _did_ run R CMD check.

 and sorted out the errors, then
 R CMD build fBasics

 Those same check logs show errors (like failure to build .dvi files).

 Will it work if I download the Sources packages?

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

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


Re: [R] symbol size in plot

2004-05-20 Thread Petr Pikal


On 19 May 2004 at 12:04, Ulrich Leopold wrote:

 Dear list,
 
  I have been reading the archives already but I do not manage to plot
 the correct size of symbols without running into other problems.
 
 When I use the syntax below I get the size of symbols and text right
 but the text overlays on top of the axis rather than be in the right
 position when you using the defaults for plot. Furthermore the ticks
 of the axis appear to be too small. Is there a way of getting things
 correct like in the default plot?

Hi

I am not sure what do you want to accomplish. What is wrong on default plot.
If you want to shrink just points use cex in

par(mfrow=c(2,2))
plot(x,y, pch=16, cex=0.2)

and if you want to enlarge some characters in plot use cex.axis or cex 
according to par help page

e.g.

plot(x,y, pch=16, cex=0.2, cex.lab=2, cex.axis=2)

par(mfrow=c(2,2))
plot(1:10,1:10)
plot(1:10,1:10, cex=.2)
plot(1:10,1:10, cex=.2, cex.axis=2)
plot(1:10,1:10, cex=.2, cex.axis=2, cex.lab=2)

I suppose that in your definition of par you first shrink all points and characters in 
plot to 0.2 of their default size and then you increase the size of some 5 times e.g. 
to the default size, but I may be wrong.

Cheers
Petr



 
 
 par(mfrow=c(2,2),cex=0.2, cex.main=5, cex.sub=5, cex.axis=5,pch=16)
 plot(x,y)
 
 
 
 Regards, Ulrich
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] Finding indices where

2004-05-20 Thread Petr Pikal


On 19 May 2004 at 13:26, Ravi Varadhan wrote:

 Hi:
 
 Suppose I have the following vector:
 
  x - c(1,4:8,11,13:14,17,19,23:28,35:38)
  x
  [1]  1  4  5  6  7  8  11 13 14 17 19 23 24 25 26 27 28 35 36 37 38 
 
 
 and I would like to pick out the first and last indices of all the
 consecutive runs of integers, where the length of a run is no
 smaller than a specified value, say, nmin.  That is, in the above
 example, for nmin=4, I would like to get the following 3 by 2 matrix:
 
 4 8
 23 28
 35 38
 
 For nmin=5, I would get the following 2 by 2 matrix
 
 4 8
 23 28
 
 and for nmin=6, I would get the following 1 by 2 matrix
 
 23 28
 
 Is there an efficient and elegant way to do this?

Hallo
not complete maybe not ellegant but

y-rle(diff(x))
res1-x[(cumsum(y$length))[y$length1]]+1
res2-res1-y$length[y$length1]

gives you the numbers you want in two vectors (res1,  res2). Than you can do 
any formating and selection you want.

Cheers
Petr

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

Petr Pikal
[EMAIL PROTECTED]

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


[R] function for running MS-DOS from R

2004-05-20 Thread bang jeong sook
I had downloaded the program that runs on MS-DOS.
Is it possible for MS-DOS to be run in R such as WinBugs1.4?
I wonder whether there is the R function for running MS-DOS from R.
_
.   MSN  .
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] quadratic problem with quadratic constraint

2004-05-20 Thread David Khabie-Zeitoune
Sure -- just use a Lagrangian multiplier to bring the constraint into the objective 
function and then use a QP routine like quadproog (in the quadprog library). You will 
need to run an *outer* optimisation to find the value of the Langrangian multiplier.

-Original Message-
From: Ramzi TEMANNI [mailto:[EMAIL PROTECTED] 
Sent: 14 May 2004 11:27
To: [EMAIL PROTECTED]
Subject: [R] quadratic problem with quadratic constraint


Hi all,
Can we solve Quadratic Program with Quadratic Constraint in R ?




Regards,

TEMANNI Ramzi
DEA Student
LimBio
http://www.limbio-paris13.org
UFR de Santé, Médecine et Biologie Humaine (SMBH) 
Léonard de Vinci 74, rue Marcel Cachin
93017 Bobigny Cedex
France.
Tél : 01.48.38.73.07
Tél : 06.21.43.27.59
[EMAIL PROTECTED]
http://temanni.ramzi.free.fr

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

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


Re: [R] function for running MS-DOS from R

2004-05-20 Thread Gabor Grothendieck
bang jeong sook quietroom78 at hotmail.com writes:

 
 I had downloaded the program that runs on MS-DOS.
 Is it possible for MS-DOS to be run in R such as WinBugs1.4?
 I wonder whether there is the R function for running MS-DOS from R.

On my XP system this works:

R system(cmd)

to drop into the Windows command line and exit at the
Windows command line get you back.  

One can slso do this:

R system(cmd /c dir  listing.txt)
R listing - readLines(listing.txt)

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


R: [R] column sorting a matrix with indices returned

2004-05-20 Thread Vito Muggeo
A possible solution is using apply + order:

 apply(x,2,order)
 [,1] [,2] [,3]
[1,]323
[2,]132
[3,]211
 apply(x,2,function(x)x[order(x)])
 [,1] [,2] [,3]
[1,]235
[2,]347
[3,]468


best,
vito


- Original Message -
From: Rajarshi Guha [EMAIL PROTECTED]
To: R [EMAIL PROTECTED]
Sent: Thursday, May 20, 2004 4:11 PM
Subject: [R] column sorting a matrix with indices returned


 Hi,
   I'm trying to translate some Matlab code to R and I'm trying to
 implement the behavior of Matlab's sort() which when applied to a matrix
 will sort the columns returning the column  sorted matrix as well as a
 matrix of permuted indices.

 Doing:

  x - matrix(c(3,4,2,6,3,4,8,7,5), nr=3)
  x
  [,1] [,2] [,3]
 [1,]368
 [2,]437
 [3,]245

 What I want after sorting x are two matrices:

 (the column sorted x)
 2 3 5
 3 4 7
 4 6 8

 and (the index matrix)
 3 2 3
 1 3 2
 2 1 1

 Doing,
  sx - apply(x, c(2), sort, index.return=T)

 results in sx being a series of lists. I know I could then go through
 the list and create a sorted matrix and an index matrix.

 But is there a neater way to do this?

 Thanks,

 ---
 Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net
 GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
 ---
 Accuracy, n.:
 The vice of being right

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

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


Re: [R] column sorting a matrix with indices returned

2004-05-20 Thread Rajarshi Guha
On Thu, 2004-05-20 at 10:11, Rajarshi Guha wrote:
 Hi,
   I'm trying to translate some Matlab code to R and I'm trying to
 implement the behavior of Matlab's sort() which when applied to a matrix
 will sort the columns returning the column  sorted matrix as well as a
 matrix of permuted indices.
 
 Doing:
 
  x - matrix(c(3,4,2,6,3,4,8,7,5), nr=3)
  x
  [,1] [,2] [,3]
 [1,]368
 [2,]437
 [3,]245
 
 What I want after sorting x are two matrices:
 
 (the column sorted x)
 2 3 5
 3 4 7
 4 6 8
 
 and (the index matrix)
 3 2 3
 1 3 2
 2 1 1

I worked out a way:

sorted - apply(x, c(2), sort, index.return=T)

sortedmatrix - matrix(unlist(lapply(sorted, function(x) { x$x })),
nr=length(sortstruct))

sortedindices - matrix(unlist(lapply(sorted, function(x) { x$ix })),
nr=length(sorted))

Is this efficient, as the matrices will be large  (or can it be made
into a 1 liner)?


---
Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
---
A man is known by the company he organizes.
-- Ambrose Bierce

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


RE: [R] mixed models for analyzing survey data with unequal selec tion probability

2004-05-20 Thread Baskin, Robert
Han-Lin

I don't think I have seen a reply so I will suggest that maybe you could try
a different approach than what you are thinking about doing.  I believe the
current best practice is to use the weights as a covariate in a regression
model - and bytheway - the weights are the inverse of the probabilities of
selection - not the probabilities.

Fundamentally, there is a difficulty in making sense out of 'random effects'
in a finite population setting.

(plagiarized from some unknown source)
See:  9. Pfeffermann, D. , Skinner, C. J. , Holmes, D. J. , Goldstein, H. ,
and Rasbash, J.  (1998), ``Weighting for unequal selection probabilities in
multilevel models (Disc: p41-56)'', Journal of the Royal Statistical
Society, Series B, Methodological, 60 , 23-40 

which refers back to:
29. Pfeffermann, D. , and LaVange, L.  (1989), ``Regression models for
stratified multi-stage cluster samples'', Analysis of Complex Surveys,
237-260 

If you don't like statistical papers, then see section 4.5 of 8. Korn,
Edward Lee , and Graubard, Barry I.  (1999), ``Analysis of health surveys'',
John Wiley  Sons (New York; Chichester)  They explain the idea of using
weights in a model fairly simply.

Bob


-Original Message-
From: Han-Lin Lai [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 19, 2004 12:47 PM
To: [EMAIL PROTECTED]
Subject: [R] mixed models for analyzing survey data with unequal selection
probability

Hi,

I need the help on this topic because this is out of my statistical
trianing as biologist.  Here is my brief description of the problem.

I have a survey that VESSELs are selected at random with the probability
of p(j).  Then the tows within the jth VESSEL are sampled at random with
probability of p(i|j).  I write my model as

y = XB + Zb + e
where XB is fixed part, Zb is for random effect (VESSEL) and e is
within-vessel error.

I feel that I should weight the Zb part by p(j) and the e-part by
p(i,j)=p(j)*p(i|j). Is this a correct weighting?

How can I implement the weightings in nlme (or lme)?  I think that
p(i,j) can be specified by nlme(..., weights=p(i,j),...)?  Where is p(j)
to be used in nlme?

I appreciate anyone can provide examples and literature for this
problem.

Cheers!
Han

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


RE: [R] mixed models for analyzing survey data with unequal selec tion probability

2004-05-20 Thread Thomas Lumley
On Thu, 20 May 2004, Baskin, Robert wrote:

 Han-Lin

 I don't think I have seen a reply so I will suggest that maybe you could try
 a different approach than what you are thinking about doing.  I believe the
 current best practice is to use the weights as a covariate in a regression
 model - and bytheway - the weights are the inverse of the probabilities of
 selection - not the probabilities.

 Fundamentally, there is a difficulty in making sense out of 'random effects'
 in a finite population setting.

I would have thought that it matters why you are fitting a mixed model.
Often people use mixed models when they are just interested in inference
about the mean and need to model the covariances to get valid standard
errors. In that situation you could use an ordinary survey regression to
get a design-based result.

If you are actually interested in variance components then you need some
other approach, and putting the weights into the model as a covariate will
presumably give a valid model-based result (since the weights carry all
the biased sampling information --- like a propensity score).  Presumably
this is also more efficient.

However, it could well be that you don't want those variables in the
model. If the sampling depends on a variable Z correlated with Y and X and
you want to model the distribution of Y given X, not the distribution of Y
given X and Z, you are still in trouble.


-thomas



 (plagiarized from some unknown source)
 See:  9. Pfeffermann, D. , Skinner, C. J. , Holmes, D. J. , Goldstein, H. ,
 and Rasbash, J.  (1998), ``Weighting for unequal selection probabilities in
 multilevel models (Disc: p41-56)'', Journal of the Royal Statistical
 Society, Series B, Methodological, 60 , 23-40 

 which refers back to:
 29. Pfeffermann, D. , and LaVange, L.  (1989), ``Regression models for
 stratified multi-stage cluster samples'', Analysis of Complex Surveys,
 237-260 

 If you don't like statistical papers, then see section 4.5 of 8. Korn,
 Edward Lee , and Graubard, Barry I.  (1999), ``Analysis of health surveys'',
 John Wiley  Sons (New York; Chichester)  They explain the idea of using
 weights in a model fairly simply.

 Bob


 -Original Message-
 From: Han-Lin Lai [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 19, 2004 12:47 PM
 To: [EMAIL PROTECTED]
 Subject: [R] mixed models for analyzing survey data with unequal selection
 probability

 Hi,

 I need the help on this topic because this is out of my statistical
 trianing as biologist.  Here is my brief description of the problem.

 I have a survey that VESSELs are selected at random with the probability
 of p(j).  Then the tows within the jth VESSEL are sampled at random with
 probability of p(i|j).  I write my model as

 y = XB + Zb + e
 where XB is fixed part, Zb is for random effect (VESSEL) and e is
 within-vessel error.

 I feel that I should weight the Zb part by p(j) and the e-part by
 p(i,j)=p(j)*p(i|j). Is this a correct weighting?

 How can I implement the weightings in nlme (or lme)?  I think that
 p(i,j) can be specified by nlme(..., weights=p(i,j),...)?  Where is p(j)
 to be used in nlme?

 I appreciate anyone can provide examples and literature for this
 problem.

 Cheers!
 Han

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


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

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


[R] 'start' argument for fitdistr()

2004-05-20 Thread Jonathan Wang
Could someone please help me understand the 'start' argument for fitdistr(), perhaps 
with a couple of examples?  (The examples in the online Help are ones that do not 
require 'start'.)
 
JTW

[[alternative HTML version deleted]]

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


Re: [R] POSIX to ts and back to POSIX

2004-05-20 Thread Jason Turner
On Wed, May 19, 2004 at 03:24:38PM -0400, [EMAIL PROTECTED] wrote:
 I am trying to use POSIX datetime objects rather than chron datetime
 objects but am having difficulty with POSIX in a time series.  My
 question:  Once a POSIXct vector is bound to a time series, is there a
 function to convert back to POSIXct?  The following code demonstrates
 what I am trying to do.
 
  ts(as.POSIXct(strptime(tmp,%m/%d/%Y %H:%M:%S)),freq=1440)
 Time Series:
 Start = c(1, 1)
 End = c(1, 10)
 Frequency = 1440
  [1] 1074022572 1074022632 1074022693 1074022753 1074022813 1074022874
 1074022934 1074022994 1074023055 1074023115
 attr(,tzone)
 [1]
...

for the reverse process, something like

## UNTESTED!
yourts - ts(as.POSIXct(strptime(tmp,%m/%d/%Y %H:%M:%S)),freq=1440)
ISOdate(1970,1,1,0,0,0,UTC) + time(yourts)

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

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


[R] Help with hclust() and plot()

2004-05-20 Thread michael watson (IAH-C)

Hi

When I use plot(hclust(dist..)...)...) etc to create a dendrogram of a
hierarchial cluster analysis, I end up with a vertical tree.  What do I
need to do to get a horizontal tree?

Also, my users are used to seeing trees who's leaves all end at the
same place (eg. Like in minitab).  Is this possible in R?

Thanks

Mick

Michael Watson
Head of Informatics
Institute for Animal Health,
Compton Laboratory,
Compton,
Newbury,
Berkshire RG20 7NN
UK

Phone : +44 (0)1635 578411 ext. 2535
Mobile: +44 (0)7990 827831
E-mail: [EMAIL PROTECTED]

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


Re: [R] Help with hclust() and plot()

2004-05-20 Thread Sundar Dorai-Raj

michael watson (IAH-C) wrote:
Hi
When I use plot(hclust(dist..)...)...) etc to create a dendrogram of a
hierarchial cluster analysis, I end up with a vertical tree.  What do I
need to do to get a horizontal tree?
Also, my users are used to seeing trees who's leaves all end at the
same place (eg. Like in minitab).  Is this possible in R?
Thanks
Mick
Mick,
  If you use as.dendrogram first then the plot method for dendrograms 
has a horizontal option:

data(USArrests)
hc - hclust(dist(USArrests), ave)
dend1 - as.dendrogram(hc)
plot(dend1, horiz = TRUE)
This also puts the leave at the end.
R version 1.9.0, 2004-05-06
Windows 2000
--sundar
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] irregular time series

2004-05-20 Thread Jason Turner
On Thu, May 20, 2004 at 02:23:46PM +0930, McClatchie, Sam (PIRSA-SARDI) wrote:
[long time series, broken in two with a gap]
 I realise that I could just break each series into two segments and
 cross-correlate with the shorter series, but I'd rather deal with the whole
 series to increase the nyquist frequency. I think the its function in the
 irregular time series package will create a class its object with the right
 time stamps, but can this then be used in the same was as a class ts object
 for the correlation and spectral anayses?  

its does some nice things for storing, plotting, and manipulating
irregular time series, but isn't long on the analysis.

A few options:

1) Analyze the two sub-series separately.
2) There is some merit to de-mean or de-trending both series,
zero-padding the shorter so its length matches the longer, and 
performing spectral analysis that way.  Frequencies near zero
should be treated with suspicion, however.
3) Jim Lindsey has some continuous ARMA and Kalman filter routines
on his site (Google for Lindsey and rmutil, which is the
name of one of those packages).
4) I'm working on an R version of the Lomb periodogram, which
was built for irregular series, but I've no guarantees when I'll
roll it up - rather busy most days.  I do remember seeing an S
version on someone's web page, but that was a while ago, and it
was the direct or slow method.

Hope that helps

Jason



-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

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


Re: [R] Repeated measures ANOVA

2004-05-20 Thread Jason Turner
On Wed, May 19, 2004 at 11:11:46PM -0600, GIDEON WASSERBERG wrote:
 Dear friends
 
 I am not sure that I am conducting this analysis correctly. 
 I would really appreciate if someone can verify what I've done.

 I conducted repeated measures ANOVA for some bugs data. 
 These bugs were measured repeatedly over 32 weeks at the 
 same trapping plots. I want to test a full model for the 
 effect of time (week) (the within subject variable), 
 and the main effects are: place, station,species, and all 
 the interactions thereof.

Since there's likely some serious time and location dependence 
here, I suggest you get a copy of Pinheiro and Bates.

@Book{PinheiroBates2000,
  author =   {Jos\'e C. Pinheiro and Douglas M. Bates},
  title =Mixed-Effects Models in S and S-PLUS,
  publisher ={Springer-Verlag},
  year = {2000},
  address =  {New York}
}

Since performing statistical consulting for free is a 
dangerous prescedent to the profession, I'll leave it
at that :)

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

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


[R] write in fixed format

2004-05-20 Thread Perez Martin, Agustin
DeaR useRs:

I have a problem, because I have a file in fixed width format and I can read
it with 'read.fwf' and after I can use these data to do generate new columns
(variables) and when I am going to write this set of data (data.frame) I
can't find a function which storages my data.frame in fixed width format.

Can you help me?
Thanks in advance.

Agustín Pérez
Universidad Miguel Hernández de Elche.

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


Re: [R] mixed models for analyzing survey data with unequal selec tion probability

2004-05-20 Thread Spencer Graves
 Cassel, Sarndal and Wretman (1977) Foundations of Inference in 
Survey Sampling (Krieger) insisted that for infinite population 
inference (what Deming called an 'analytic study'), the sampling 
probabilities should be ignored UNLESS they related somehow to something 
of interest in the model.  In other words, is the sampling informative 
or noninformative?  If noninformative, the sampling probabilities do not 
appear in the likelihood and therefore should not affect inference.  As 
I recall, Cassel, Sarndal and Wretman said that if stratified random 
sampling is used, and if the stratification system is included in the 
model, then the sampling is noninformative, and the sampling 
probabilities should not affect inference. 

 From this paradigm, using weights inversely proportional to 
sampling probabilities is (primarily?) a tool for finite population 
inference -- what Deming called an 'enumerative study'.  For an 
enumerative study, the purpose is to make inference about a fixed, 
finite population, e.g., how to feed the people in Japan who would 
otherwise starve within the next week or month, which was the situation 
when Deming directed a survey there shortly after World War II.  For an 
analytic study, the purpose is more long term, e.g., how to design a 
national alimentary system to feed the people who will be there 10 or 30 
years from now.  Since most of my work has dealt processed that will 
create the future, rather than dealing with fixed, finite populations, I 
have ignored sampling probabilities in most of my work (though I have 
not worked much recently with sample surveys). 

 Is this still consistent with current thinking?  Is it feasible to 
summarize in a few words what Pferrermann, Korn et al. say about this? 

 Thanks,
 spencer graves
Thomas Lumley wrote:
On Thu, 20 May 2004, Baskin, Robert wrote:
 

Han-Lin
I don't think I have seen a reply so I will suggest that maybe you could try
a different approach than what you are thinking about doing.  I believe the
current best practice is to use the weights as a covariate in a regression
model - and bytheway - the weights are the inverse of the probabilities of
selection - not the probabilities.
Fundamentally, there is a difficulty in making sense out of 'random effects'
in a finite population setting.
   

I would have thought that it matters why you are fitting a mixed model.
Often people use mixed models when they are just interested in inference
about the mean and need to model the covariances to get valid standard
errors. In that situation you could use an ordinary survey regression to
get a design-based result.
If you are actually interested in variance components then you need some
other approach, and putting the weights into the model as a covariate will
presumably give a valid model-based result (since the weights carry all
the biased sampling information --- like a propensity score).  Presumably
this is also more efficient.
However, it could well be that you don't want those variables in the
model. If the sampling depends on a variable Z correlated with Y and X and
you want to model the distribution of Y given X, not the distribution of Y
given X and Z, you are still in trouble.
-thomas

 

(plagiarized from some unknown source)
See:  9. Pfeffermann, D. , Skinner, C. J. , Holmes, D. J. , Goldstein, H. ,
and Rasbash, J.  (1998), ``Weighting for unequal selection probabilities in
multilevel models (Disc: p41-56)'', Journal of the Royal Statistical
Society, Series B, Methodological, 60 , 23-40 
which refers back to:
29. Pfeffermann, D. , and LaVange, L.  (1989), ``Regression models for
stratified multi-stage cluster samples'', Analysis of Complex Surveys,
237-260 
If you don't like statistical papers, then see section 4.5 of 8. Korn,
Edward Lee , and Graubard, Barry I.  (1999), ``Analysis of health surveys'',
John Wiley  Sons (New York; Chichester)  They explain the idea of using
weights in a model fairly simply.
Bob
-Original Message-
From: Han-Lin Lai [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 19, 2004 12:47 PM
To: [EMAIL PROTECTED]
Subject: [R] mixed models for analyzing survey data with unequal selection
probability
Hi,
I need the help on this topic because this is out of my statistical
trianing as biologist.  Here is my brief description of the problem.
I have a survey that VESSELs are selected at random with the probability
of p(j).  Then the tows within the jth VESSEL are sampled at random with
probability of p(i|j).  I write my model as
y = XB + Zb + e
where XB is fixed part, Zb is for random effect (VESSEL) and e is
within-vessel error.
I feel that I should weight the Zb part by p(j) and the e-part by
p(i,j)=p(j)*p(i|j). Is this a correct weighting?
How can I implement the weightings in nlme (or lme)?  I think that
p(i,j) can be specified by nlme(..., weights=p(i,j),...)?  Where is p(j)
to be used in nlme?
I appreciate anyone can provide examples and literature for this
problem.

RE: [R] Help with hclust() and plot()

2004-05-20 Thread michael watson (IAH-C)
Hi

Thanks for that!  BUT if I use as.dendrogram, I can't use my labels
anymore!

plot(hclust(...etc), labels=p[,1])

Works fine.  But:

plot(as.dendrogram(hclust(...etc)), labels=p[,1]) 

Gives me errors:

Error in axis(side, at, labels, tick, line, pos, outer, font, vfont,
lty,  :
location and label lengths differ, 6 != 24

I have 24 labels.  I have no idea where it gets 6 from!

My 'dendrogram' has '2 branches and 24 members total'.

SOOO, how do I get my dendrogram horizontal, or vertical for that
matter, with useful labels instead of 1,2,3,4,5,etc

Thanks in advance for your help!

Mick

-Original Message-
From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED] 
Sent: 20 May 2004 16:49
To: michael watson (IAH-C)
Cc: R-Help (E-mail)
Subject: Re: [R] Help with hclust() and plot()




michael watson (IAH-C) wrote:
 Hi
 
 When I use plot(hclust(dist..)...)...) etc to create a dendrogram of a

 hierarchial cluster analysis, I end up with a vertical tree.  What do 
 I need to do to get a horizontal tree?
 
 Also, my users are used to seeing trees who's leaves all end at the 
 same place (eg. Like in minitab).  Is this possible in R?
 
 Thanks
 
 Mick
 

Mick,
   If you use as.dendrogram first then the plot method for dendrograms 
has a horizontal option:

data(USArrests)
hc - hclust(dist(USArrests), ave)
dend1 - as.dendrogram(hc)
plot(dend1, horiz = TRUE)

This also puts the leave at the end.

R version 1.9.0, 2004-05-06
Windows 2000

--sundar

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


[R] R 1.8.1 - 1.9.0 incompatability: Underscore in syntactically valid names

2004-05-20 Thread Michael A. Miller
Dear R-gang,

I have a question about handling underscores in names in R 1.8.1
and 1.9.0.  I recently installed 1.9.0 on a machine and found
that many codes no longer work as a result of the changed
behavior in make.names.

I have numerous data files that have dashes, periods and
underscores in the header row.  I've got numerous R codes that
read those files with read.table and read.csv and then use the
names expecting the underscores and dashes to be changed to
periods in the column names.  Since this no longer happens in
1.9.0, lots of codes are failing.  One way to work around this is
to repair a lot of codes to take this backward incompatibility
into account (both R scripts and data sources, so that is a
significant project, here at least).  Or I can stay with 1.8.1,
but that is just a sure route to eventual incomparability with
something else, so I'll gradually start migrating code over and
adding version checks.

Can anyone suggest a way to maintain compatibility between R
versions?  I suppose I could write a wrapper around make.names to
replace _ with ., but I'm not sure what that might break in 1.9.0
that now expects the new behavior.  I'd appreciate any
suggestions.

Mike

-- 
Michael A. Miller   [EMAIL PROTECTED]
  Imaging Sciences, Department of Radiology, IU School of Medicine

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


[R] Get Slot from a Class

2004-05-20 Thread Yao, Minghua
Hello, everyone,
 
I don't quite understand the following message:
 
 TTT - t.test(1:10, y=c(7:20))
 class(TTT)
[1] htest
 [EMAIL PROTECTED]
Error: Trying to get slot p.value from an object whose class (htest) is not 
defined 
 TTT$p.value
[1] 1.855282e-05

Why the message says the class of TTT is not defined while class(TTT) gets htest?

I appreciate the explanations?

-Minghua



[[alternative HTML version deleted]]

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


Re: [R] write in fixed format

2004-05-20 Thread Uwe Ligges
Perez Martin, Agustin wrote:
DeaR useRs:
I have a problem, because I have a file in fixed width format and I can read
it with 'read.fwf' and after I can use these data to do generate new columns
(variables) and when I am going to write this set of data (data.frame) I
can't find a function which storages my data.frame in fixed width format.
Can you help me?
Thanks in advance.
Agustín Pérez
Universidad Miguel Hernández de Elche.
See ?write.matrix in package MASS.
Uwe Ligges
 __
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Get Slot from a Class

2004-05-20 Thread Uwe Ligges
Yao, Minghua wrote:
Hello, everyone,
 
I don't quite understand the following message:
 

TTT - t.test(1:10, y=c(7:20))
class(TTT)
[1] htest
[EMAIL PROTECTED]
Error: Trying to get slot p.value from an object whose class (htest) is not defined 

TTT$p.value
[1] 1.855282e-05
Why the message says the class of TTT is not defined while class(TTT) gets htest?
I appreciate the explanations?
Well, you are mixing S3 with S4 classes. The slot extractor @ epects 
an S4 class. And htest is an S3 class 

Uwe Ligges
-Minghua

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


[R] Spearman probabilities and SuppDists

2004-05-20 Thread Drew Hoysak

cor.test and SuppDists give me different P-values for the same
Spearman's rho.  Which is correct, or am I doing something wrong?



 x - c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
 y - c( 2.6,  3.1,  2.5,  5.0,  3.6,  4.0,  5.2,  2.8,  3.8)

 cor.test(x,y,method=spearman)

Spearman's rank correlation rho

data:  x and y 
S = 48, p-value = 0.0968
alternative hypothesis: true rho is not equal to 0 
sample estimates:
rho 
0.6 


 2*(1-pSpearman(.6,9))
[1] 0.08572531





Drew Hoysak

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


[R] ifelse when test is shorter than yes/no

2004-05-20 Thread Vadim Ogranovich
Hi,
 
It turns out that the 'test' vector in ifelse(test, yes, no) is not
recycled if it is shorter than the other arguments, e.g.
 
 ifelse(TRUE, seq(10), -seq(10))
[1] 1

 
Is there any particular reason it is not recycled? If there is one
indeed a warning message might be in order when someone calls ifelse
with a shorter 'test'.
 
This is R1.8.1 on RH-7.3
 
Thanks,
Vadim

[[alternative HTML version deleted]]

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


Re: [R] Help with hclust() and plot()

2004-05-20 Thread Sundar Dorai-Raj

michael watson (IAH-C) wrote:
Hi
Thanks for that!  BUT if I use as.dendrogram, I can't use my labels
anymore!

plot(hclust(...etc), labels=p[,1])

Works fine.  But:

plot(as.dendrogram(hclust(...etc)), labels=p[,1]) 

Gives me errors:
Error in axis(side, at, labels, tick, line, pos, outer, font, vfont,
lty,  :
location and label lengths differ, 6 != 24
I have 24 labels.  I have no idea where it gets 6 from!
My 'dendrogram' has '2 branches and 24 members total'.
SOOO, how do I get my dendrogram horizontal, or vertical for that
matter, with useful labels instead of 1,2,3,4,5,etc
Thanks in advance for your help!
Mick
Mick,
  Change the labels in hclust first:
data(USArrests)
hc - hclust(dist(USArrests), ave)
hc$labels - 1:50
dend1 - as.dendrogram(hc)
plot(dend1, horiz = TRUE)
--sundar
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] GUI data browsers

2004-05-20 Thread foobar
Gabor Grothendieck wrote:
 This is not a full answer to what you are looking for but you might
 try

 ?browseEnv
Seems to be among the best answers out there :).  There is a TODO item 
in browseEnv regarding using Tk, so if I am up to the challenge...

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


Re: [R] GUI data browsers

2004-05-20 Thread Gabor Grothendieck
foobar wwsprague at ucdavis.edu writes:
 
 ?str is helpful too

If you are interested in str then you might also be interested in dput.

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


Re: [R] Spearman probabilities and SuppDists

2004-05-20 Thread Bob Wheeler
cor.test is giving Pr(x0.6), SuppDists is giving Pr(x=0.6). My 
recollection is that it is the custom in R for discrete distributions to 
include the point in the left tail.

Drew Hoysak wrote:
cor.test and SuppDists give me different P-values for the same
Spearman's rho.  Which is correct, or am I doing something wrong?


x - c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y - c( 2.6,  3.1,  2.5,  5.0,  3.6,  4.0,  5.2,  2.8,  3.8)

cor.test(x,y,method=spearman)

Spearman's rank correlation rho
data:  x and y 
S = 48, p-value = 0.0968
alternative hypothesis: true rho is not equal to 0 
sample estimates:
rho 
0.6 


2*(1-pSpearman(.6,9))
[1] 0.08572531


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

--
Bob Wheeler --- http://www.bobwheeler.com/
ECHIP, Inc. ---
Randomness comes in bunches.
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] for() to lapply()

2004-05-20 Thread Kenneth Cabrera
Hi dear R-users:
I have the following problem:
I have a list of data.frames (12 variables and 6 rows, each)
I have to merge from an specific point of the list to the
end of the list, I am doing so with a for() loop but it is
too inefficient and it exhausts memory.
How can I convert this for() loop in a function and then use
lapply?
-
LIST: list of data frames.
m:point of start merging.
result-merge(LIST[[m]],LIST[[m+1]],by=key,all.x=T)
for (i in (m+2):length(LIST))
{
  result-merge(result,LIST[[i]],by=key,all.x=T)
}
The problem is the acumulative: result-merge(result,...)
I can think in a function like this:
mergeListelem-function(i,LS,m)
{
 merge(LS[[m]],LS[[i]],by=key,all.x=T)
}
ind-m:length(LIST)
lapply(ind,mergeListelem,LIST,m)
But I just obtain a list of merged data.frames,
and I dont know how to join all the elements
of the list in just one final data.frame.
Thank you for your help
--
Kenneth Cabrera
Universidad Nacional de Colombia
Tel Of 430 9351
Cel 315 504 9339
Medelln
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] ifelse when test is shorter than yes/no

2004-05-20 Thread Liaw, Andy
 From: Vadim Ogranovich
 
 Hi,
  
 It turns out that the 'test' vector in ifelse(test, yes, no) is not
 recycled if it is shorter than the other arguments, e.g.
  
  ifelse(TRUE, seq(10), -seq(10))
 [1] 1
 
  
 Is there any particular reason it is not recycled? If there is one
 indeed a warning message might be in order when someone calls ifelse
 with a shorter 'test'.

?ifelse says:

Value:

 A vector of the same length and attributes (including class) as
 'test' and data values from the values of 'yes' or 'no'.  ...

Seems to me it works as documented.  Why do you expected otherwise?

Andy
  
 This is R1.8.1 on RH-7.3
  
 Thanks,
 Vadim
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


RE: [R] ifelse when test is shorter than yes/no

2004-05-20 Thread Vadim Ogranovich
It does work as documented. My question was why it was designed to work
this way. I can not think of a practical situation when someone might
want to ifelse() on a 'test' that is shorter than yes/no w/o expecting
'test' to recycle (therefore I was asking for a warning).

I find this behavior inconsistent with the (spirit of) R's recycling
rules. For example if 'test', 'yes', 'no' are all of the same length
then the following two expressions are equivalent:

1.
x - ifelse(test, yes, no)

2.
x - no; x[test] - yes[test]

This equivalence breaks when 'test' is shorter than yes/no: in the
second case 'test' will be recycled. And I don't see a good reason for
having them behave differently.

If I had to implement ifelse() I'd probably do:

ifelse2 - function(test, yes, no) {
x - rep(no, length.out=max(length(test), length(yes),
length(no)))
x[test] - yes[test]

x
}

(If there is interest I can extend it to take care of NA-s and submit as
a (trivial) patch)


Here is a simple test:
 ifelse2(c(TRUE, FALSE), seq(10), -seq(5))
 [1]  1 -2  3 -4  5 -1  7 -3  9 -5



Maybe it will help if I tell how I stumbled upon this problem. I had two
m*n matrices, 'yes' and 'no', and a 'test' vector of length m. I wanted
to create a m*n matrix which has 'yes' rows where test==TRUE and 'no'
rows otherwise. So I did

x - matrix(ifelse(test, yes, no), nrow(yes), ncol(yes))

priding myself for doing it the whole object way ... and 'test' did
not recycle (in full accordance with the help page) w/o a warning.


Thanks,
Vadim




 -Original Message-
 From: Liaw, Andy [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 20, 2004 2:20 PM
 To: Vadim Ogranovich; R-Help
 Subject: RE: [R] ifelse when test is shorter than yes/no
 
 
  From: Vadim Ogranovich
  
  Hi,
   
  It turns out that the 'test' vector in ifelse(test, yes, no) is not 
  recycled if it is shorter than the other arguments, e.g.
   
   ifelse(TRUE, seq(10), -seq(10))
  [1] 1
  
   
  Is there any particular reason it is not recycled? If there is one 
  indeed a warning message might be in order when someone 
 calls ifelse 
  with a shorter 'test'.
 
 ?ifelse says:
 
 Value:
 
  A vector of the same length and attributes (including class) as
  'test' and data values from the values of 'yes' or 'no'.  ...
 
 Seems to me it works as documented.  Why do you expected otherwise?
 
 Andy
   
  This is R1.8.1 on RH-7.3
   
  Thanks,
  Vadim
  
  [[alternative HTML version deleted]]
  
  __
  [EMAIL PROTECTED] mailing list 
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
  
  
 
 
 --
 
 Notice:  This e-mail message, together with any attachments, 
 contains information of Merck  Co., Inc. (One Merck Drive, 
 Whitehouse Station, New Jersey, USA 08889), and/or its 
 affiliates (which may be known outside the United States as 
 Merck Frosst, Merck Sharp  Dohme or MSD and in Japan, as 
 Banyu) that may be confidential, proprietary copyrighted 
 and/or legally privileged. It is intended solely for the use 
 of the individual or entity named on this message.  If you 
 are not the intended recipient, and have received this 
 message in error, please notify us immediately by reply 
 e-mail and then delete it from your system.
 --
 


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


Re: [R] for() to lapply()

2004-05-20 Thread Jason Turner
On Thu, May 20, 2004 at 03:52:22PM -0500, Kenneth Cabrera wrote:
 Hi dear R-users:
 
 I have the following problem:
 I have a list of data.frames (12 variables and 6 rows, each)
 
 I have to merge from an specific point of the list to the
 end of the list, I am doing so with a for() loop but it is
 too inefficient and it exhausts memory.
 
 How can I convert this for() loop in a function and then use
 lapply?

There's still a better way to do it, I'm sure, but something
like...

##untested!

myMerge - function(x,y,...) {
zz - merge(x,y,...)
gc()
}

foo - lapply(my.df.list[[-1]],myMerge,my.df.list[[1]])

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

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


[R] Memory usage of R on Windows XP

2004-05-20 Thread Peter Wilkinson
I am running R 1.8.1 on windows xp. I have been using the 'apply' R 
function to run a short function against a matrix of 19000 x 340 rows ... 
yes it is a big matrix. every item in the matrix is a float that can have a 
maximum value of 2^16 ~ 65k.

The function:
mask256 - function(value) {
if (value  256) {
   result = 0
}
else {
   result = 1
}
result
}
what happens is that the memory required for the session to run starts 
ballooning. The matrix with a few other objects starts at about 160M, but 
then quickly goes up to 750M, and stays there when the function has completed

I am fairly new to R. Is there something I should know about writing 
functions , i.e. do I need to clean-up at the end of the function? It seems 
R can not release the memory once it has been used. When I close the R 
application and open the R application again then the memory is back down 
to what it is supposed to be, the size of the workspace, plus any new 
objects that I have created

Does anybody know what is going on?
Peter
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] for() to lapply()

2004-05-20 Thread Hadley Wickham
I have the following problem:
I have a list of data.frames (12 variables and 6 rows, each)
I have to merge from an specific point of the list to the
end of the list, I am doing so with a for() loop but it is
too inefficient and it exhausts memory.
How about:
a - list(
data.frame(a=1),
data.frame(a=2),
data.frame(a=3),
data.frame(a=4)
)
do.call(rbind, a)
do.call(rbind, a[3:4])
(assuming that the data frames have the same variables)
Hadley
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: Windows versus Unix packages in CRAN (Was Re: [R] Rmetrics)

2004-05-20 Thread Andrew Criswell
Hello all:
On my linux platform, I ran the commands,
mkdir fBasics
unzip fBasics.zip -d fBasics
rm fBasics/src/*.o
R CMD check fBasics
That was 3 minutes. Next, I copied the files contained in 
fBasics.Rcheck/fBasics to the R library.

 library(fBasics)
fBasics:Markets, Basic Statistics, Date and TimeError in 
try(winMenuAdd(Rmetrics)) : couldn't find function winMenuAdd


So, how do I get it to work with no problems in Linux??
Thanks,
Andrew
Janusz Kawczak wrote:
And it seems that this vicious circle continues forever. Before
posting these kind of messages can you please read the INSTRUCTIONS.
fBasics_190.10051.zip is a COMPILED version of the package, not
a source as you claim to be!
It works with no problems; well, at least under Linux.
Janusz.
Richard A. O'Keefe wrote:
 

Prof Brian Ripley [EMAIL PROTECTED] wrote:
   mkdir fBasics
   unzip fBasics.zip -d fBasics
   rm fBasics/src/*.o
   R CMD check fBasics
   and that took me about 3 minutes.
Now me, I just did
   unzip -a fBasics_190.10051.zip
   R CMD INSTALL fBasics
   rm -rf fBasics
in a naive and trusting manner.  It took me considerably longer than 3
minutes to learn that this was what I should do, and when I did learn,
I wondered if it's this simple, why can't R CMD INSTALL do it?
Now I discover that it isn't that simple.  The installation apparently
went smoothly.  This is R, right?  Never occurred to me that there might
be problems.
Now, B-G--R!  It turns out that core stuff is supplied as .dll files,
which of course my UltraSPARC can do nothing with.
The author of the Rmetrics code has a perfect right to provide his code
in any form he wants under any conditions he wants (subject to GPL c).
In particular, if he wants to provide a distribution which only works under
Windows, that's perfectly OK.
**BUT** when a distribution is peculiar to one operating system, that really
should be highlighted in big bold letters:  this is a WINDOWS BINARY
version, so that people who can't use Windows .DLL files are spared a day
of trying to figure out how to unpack and of doing an installation which
reports no errors at all and of them finding that things do not work.
There is *NOTHING* on http://www.itp.phys.ethz.ch/econophysics/R/download.htm
that says Windows only.  Click on I acceptand the page you arrive at has
nothing in the text anywhere that says Windows only or what to do if not
Windows.  (The http://.../R/bin/windows/contrib/1.9 address of the page
was, in retrospect, a big clue, sigh.)
   It would of course be nice if the developers had done
   R CMD check fBasics
But if you go into the Sources directory, which I suppose you must have,
for each of {fBasics,fExtremes,fOptions,fSeries} there is an
xxx-00check.log.txt, so they _did_ run R CMD check.
   and sorted out the errors, then
   R CMD build fBasics
Those same check logs show errors (like failure to build .dvi files).
Will it work if I download the Sources packages?
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
   

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

 

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


[R] function for running MS-DOS on R

2004-05-20 Thread bang jeong sook
I had downloaded the program that runs on MS-DOS.
Is it possible for MS-DOS to be run in R such as WinBugs1.4?
I wonder whether there is the R function for running MS-DOS from R such as  
the 'bug.r' function to make Winbugs practicable in R.

I had heard Rterm.exe that runs on MS-DOS.
However, What I need is to run MS-DOS in R but to run R in MS-DOS.
_
 MSN Hotmail  .
http://loginnet.passport.com/login.srf?id=2svc=mailcbid=24325msppjph=1lc=1042

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


RE: [R] function for running MS-DOS on R

2004-05-20 Thread Austin, Matt
Perhaps you could use the R2WinBugs package?

--Matt

-Original Message-
From: [EMAIL PROTECTED] [mailto:r-help-
[EMAIL PROTECTED] Behalf Of bang jeong sook
Sent: Thursday, May 20, 2004 19:9 PM
To: [EMAIL PROTECTED]
Subject: [R] function for running MS-DOS on R



I had downloaded the program that runs on MS-DOS.
Is it possible for MS-DOS to be run in R such as WinBugs1.4?
I wonder whether there is the R function for running MS-DOS from R such as  
the 'bug.r' function to make Winbugs practicable in R.

I had heard Rterm.exe that runs on MS-DOS.
However, What I need is to run MS-DOS in R but to run R in MS-DOS.

_
 MSN Hotmail  .
http://loginnet.passport.com/login.srf?id=2svc=mailcbid=24325msppjph=1lc
=1042

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

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


Re: Windows versus Unix packages in CRAN (Was Re: [R] Rmetrics)

2004-05-20 Thread Janusz Kawczak
Here is what I get:

R : Copyright 2004, The R Foundation for Statistical Computing
Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3

 .  
[Previously saved workspace restored]

 library(fBasics)
---
fLibraries: A SOFTWARE COLLECTION FOR FINANCIAL ENGINEERS
fBasics:Markets, Basic Statistics, Date and Time
---


(there were no alterations done to the above output except where  
 occurs!)

You simply need to remove the stuff related to MS Win from zzz.R;
in partricular the lines after if(  ) to clear your message.
As you can see, the info relates to the WinMenu under MS Win.

Hope this helps.

Janusz.

On Fri, 21 May 2004, Andrew Criswell wrote:

 Hello all:

 On my linux platform, I ran the commands,

 mkdir fBasics
 unzip fBasics.zip -d fBasics
 rm fBasics/src/*.o
 R CMD check fBasics

 That was 3 minutes. Next, I copied the files contained in
 fBasics.Rcheck/fBasics to the R library.

   library(fBasics)

 fBasics:Markets, Basic Statistics, Date and TimeError in
 try(winMenuAdd(Rmetrics)) : couldn't find function winMenuAdd
  

 So, how do I get it to work with no problems in Linux??

 Thanks,
 Andrew

 Janusz Kawczak wrote:

 And it seems that this vicious circle continues forever. Before
 posting these kind of messages can you please read the INSTRUCTIONS.
 fBasics_190.10051.zip is a COMPILED version of the package, not
 a source as you claim to be!
 
 It works with no problems; well, at least under Linux.
 
 Janusz.
 
 Richard A. O'Keefe wrote:
 
 
 
 Prof Brian Ripley [EMAIL PROTECTED] wrote:
 mkdir fBasics
 unzip fBasics.zip -d fBasics
 rm fBasics/src/*.o
 R CMD check fBasics
 
 and that took me about 3 minutes.
 
 Now me, I just did
 
 unzip -a fBasics_190.10051.zip
 R CMD INSTALL fBasics
 rm -rf fBasics
 
 in a naive and trusting manner.  It took me considerably longer than 3
 minutes to learn that this was what I should do, and when I did learn,
 I wondered if it's this simple, why can't R CMD INSTALL do it?
 
 Now I discover that it isn't that simple.  The installation apparently
 went smoothly.  This is R, right?  Never occurred to me that there might
 be problems.
 
 Now, B-G--R!  It turns out that core stuff is supplied as .dll files,
 which of course my UltraSPARC can do nothing with.
 
 The author of the Rmetrics code has a perfect right to provide his code
 in any form he wants under any conditions he wants (subject to GPL c).
 In particular, if he wants to provide a distribution which only works under
 Windows, that's perfectly OK.
 
 **BUT** when a distribution is peculiar to one operating system, that really
 should be highlighted in big bold letters:  this is a WINDOWS BINARY
 version, so that people who can't use Windows .DLL files are spared a day
 of trying to figure out how to unpack and of doing an installation which
 reports no errors at all and of them finding that things do not work.
 
 There is *NOTHING* on http://www.itp.phys.ethz.ch/econophysics/R/download.htm
 that says Windows only.  Click on I acceptand the page you arrive at has
 nothing in the text anywhere that says Windows only or what to do if not
 Windows.  (The http://.../R/bin/windows/contrib/1.9 address of the page
 was, in retrospect, a big clue, sigh.)
 
 It would of course be nice if the developers had done
 
 R CMD check fBasics
 
 But if you go into the Sources directory, which I suppose you must have,
 for each of {fBasics,fExtremes,fOptions,fSeries} there is an
 xxx-00check.log.txt, so they _did_ run R CMD check.
 
 and sorted out the errors, then
 R CMD build fBasics
 
 Those same check logs show errors (like failure to build .dvi files).
 
 Will it work if I download the Sources packages?
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 
 
 
 

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


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


Re: [R] Memory usage of R on Windows XP

2004-05-20 Thread Petr Pikal


On 20 May 2004 at 20:58, Peter Wilkinson wrote:

 
 I am running R 1.8.1 on windows xp. I have been using the 'apply' R
 function to run a short function against a matrix of 19000 x 340 rows
 ... yes it is a big matrix. every item in the matrix is a float that
 can have a maximum value of 2^16 ~ 65k.

Hi

I would go for computing only, should be quicker.

(yourmatrix=256)*1

will give you 1 on places where was number greater or equal 256 and 0 where it 
was lower.

Not sure about memory issues but I suppose better performance than if else apply 
construction.

Cheers
Petr


 
 The function:
 
 mask256 - function(value) {
  if (value  256) {
 result = 0
  }
  else {
 result = 1
  }
  result
 }
 
 what happens is that the memory required for the session to run starts
 ballooning. The matrix with a few other objects starts at about 160M,
 but then quickly goes up to 750M, and stays there when the function
 has completed
 
 I am fairly new to R. Is there something I should know about writing
 functions , i.e. do I need to clean-up at the end of the function? It
 seems R can not release the memory once it has been used. When I close

I suppose R is doing it best but Windows does not take it back.

 the R application and open the R application again then the memory is
 back down to what it is supposed to be, the size of the workspace,
 plus any new objects that I have created
 
 Does anybody know what is going on?
 
 Peter
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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