Re: [R] orphaned packages

2004-01-26 Thread Prof Brian Ripley
On Sun, 25 Jan 2004, Neil Eastep wrote:

 Are there many packages that are orphaned, and have a better half much 
 like bootstrap?

Not many are orphaned -- currently precisely two although one previously
orphaned has acquired a new maintainer recently.   I suspect a few more 
have non-responsive maintainers.

 Is there a listing, or directory of recommended packages (other than the 
 packages downloaded with the initial R install)?

It is precisely the set that come with the R distribution.

The CRAN packages page lists both the priority (possibly recommended) 
and maintainer (possibly ORPHANED).  The daily check page

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

lists those as well as the result of the latest checks (although today's 
list seems missing results for the last few packages).

 
 Thanks,
 
 Neil Eastep.
 An R newbie
 
 ---
 Prof Brian Ripley [EMAIL PROTECTED] writes:
 Package bootstrap is orphaned, that is no longer maintained.
 Package boot is much more comprehensive, and a recommended
 package.
 That suggests to me that you always use boot: I do.

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

__
[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] Re-Post: Combining Factors in model.matrix

2004-01-26 Thread Paul Boutros
 On Sat, 24 Jan 2004 [EMAIL PROTECTED] wrote:

  I didn't get any response on this before, leading me to believe
  I've missed
  something fundamental.  Can anybody guide me in the correct
  direction for more help on this?

Thanks for your reply:

 You will need to explain to us why the object you list is `the design
 matrix': have *you* a reference for that?  R is doing the conventional
 thing, and I at least have no idea where your example comes from.

Perhaps I have used the wrong terminology?  My understanding of a design
matrix is that it identifies the factors are present for a given experiment.

Here, I have a two factor experiment, where each factor has two levels.
In the case I gave:
   t1 t2
1   1  0
2   1  1
3   0  0
4   0  1

I had expected this to represent four distinct experiments where
factor one is present in the first two and absent in the second two.

 You seem to have coded variables t1 and t2 the opposite ways (the
 reference level is 2 for t1 and 1 for t2), and your model has the fit at
 levels t1=2,t1=1 constrained to pass through the origin.  I don't think R
 has a simple syntax for that (although you can fake anything), and I find
 it hard to believe that is actually what you want.

That wasn't my intention, I want to retain the intercept term and
not constrain it to pass through the origin.

Paul

 
  Paul
 
  =
  I want to be able to create a design matrix with two factors.
 For instance, if
  I have:
 
   t1 - factor(c(1,1,2,2));
   t2 - factor(c(1,2,1,2));
   design - model.matrix(~ -1 + (t1+t2));
   design;
t11 t12 t22
  1   1   0   0
  2   1   0   1
  3   0   1   0
  4   0   1   1
 
  But the design matrix I want is:
 t1 t2
  1   1  0
  2   1  1
  3   0  0
  4   0  1
 
  Actually, in general I'm struggling with the syntax for
 formulating a design
  matrix I can write down on paper.  Is there a reference for
 this beyond the R
  documentation?

 Chapter 6 of MASS has the most complete exposition (by Bill
 Venables) that
 I know of, and the White Book (Chambers  Hastie, 1992) goes well beyind
 the R documentation (which uses it as the reference).

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


__
[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] D(COM) with Excel

2004-01-26 Thread Prof Brian Ripley
On Mon, 26 Jan 2004, Joel Pitt wrote:

 Hi there,
 
 I'm currently trying to use R in an automated
 macro with Excel, and to this effect I've been
 using the D(COM) server.
 
 However I've been having alot of problems with
 it, because it seems to be limited to only recieving
 and sending arrays. I've been struggling
 trying to find a way to receive model summaries
 from R to put in Excel. I also seem to have
 some strange errors coming up...
 I've tried doing everything I want directly in R
 by hand, and it has been fine, but excel seems to
 complicate everything :(
 
 Any people have suggestions?

There are two (D)COM servers for R, on by Thomas Baier that has its own 
mailing list, and one by Duncan Temple Lang (at www.omegahat.org and in 
the Omegahat area on CRAN).

It is impossible for us to help with a message as vague as `some strange
errors coming up', so I suggest you read

http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

and then post on the appropriate mailing list for whichever server you are 
using.

[The Baier-version list is listed at the bottom of its readme.txt file.]

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

__
[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] Re-Post: Combining Factors in model.matrix

2004-01-26 Thread Prof Brian Ripley
On Mon, 26 Jan 2004, Paul Boutros wrote:

  On Sat, 24 Jan 2004 [EMAIL PROTECTED] wrote:
 
   I didn't get any response on this before, leading me to believe
   I've missed
   something fundamental.  Can anybody guide me in the correct
   direction for more help on this?
 
 Thanks for your reply:
 
  You will need to explain to us why the object you list is `the design
  matrix': have *you* a reference for that?  R is doing the conventional
  thing, and I at least have no idea where your example comes from.
 
 Perhaps I have used the wrong terminology?  My understanding of a design
 matrix is that it identifies the factors are present for a given experiment.

The design matrix is X in the regression usually represented by

y = Xb + e

and is called a model matrix in S/R.

 Here, I have a two factor experiment, where each factor has two levels.
 In the case I gave:
t1 t2
 1   1  0
 2   1  1
 3   0  0
 4   0  1
 
 I had expected this to represent four distinct experiments where
 factor one is present in the first two and absent in the second two.

You can't have factors that are present/absent.  (You can have levels of
treatments which are present/absent.)  We understand the rows to represent
the individuals runs of a single experiment, but what do the columns
represent?

  You seem to have coded variables t1 and t2 the opposite ways (the
  reference level is 2 for t1 and 1 for t2), and your model has the fit at
  levels t1=2,t1=1 constrained to pass through the origin.  I don't think R
  has a simple syntax for that (although you can fake anything), and I find
  it hard to believe that is actually what you want.
 
 That wasn't my intention, I want to retain the intercept term and
 not constrain it to pass through the origin.

So why did you use ~ -1 + (t1+t2) ?  That explicitly removes the 
intercept.


 Paul
 
  
   Paul
  
   =
   I want to be able to create a design matrix with two factors.
  For instance, if
   I have:
  
t1 - factor(c(1,1,2,2));
t2 - factor(c(1,2,1,2));
design - model.matrix(~ -1 + (t1+t2));
design;
 t11 t12 t22
   1   1   0   0
   2   1   0   1
   3   0   1   0
   4   0   1   1
  
   But the design matrix I want is:
  t1 t2
   1   1  0
   2   1  1
   3   0  0
   4   0  1
  
   Actually, in general I'm struggling with the syntax for
  formulating a design
   matrix I can write down on paper.  Is there a reference for
  this beyond the R
   documentation?
 
  Chapter 6 of MASS has the most complete exposition (by Bill
  Venables) that
  I know of, and the White Book (Chambers  Hastie, 1992) goes well beyind
  the R documentation (which uses it as the reference).
 
  --
  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
 
 
 __
 [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
 
 

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

__
[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] Re-Post: Combining Factors in model.matrix

2004-01-26 Thread Paul Boutros
   You will need to explain to us why the object you list is `the design
   matrix': have *you* a reference for that?  R is doing the conventional
   thing, and I at least have no idea where your example comes from.
 
  Perhaps I have used the wrong terminology?  My understanding of a design
  matrix is that it identifies the factors are present for a
  given experiment.

 The design matrix is X in the regression usually represented by

 y = Xb + e

 and is called a model matrix in S/R.

Right, that's how I understood it.

  Here, I have a two factor experiment, where each factor has two levels.
  In the case I gave:
 t1 t2
  1   1  0
  2   1  1
  3   0  0
  4   0  1
 
  I had expected this to represent four distinct experiments where
  factor one is present in the first two and absent in the second two.

 You can't have factors that are present/absent.  (You can have levels of
 treatments which are present/absent.)  We understand the rows to represent
 the individuals runs of a single experiment, but what do the columns
 represent?

Yes, I mis-spoke.  I thought the columns represent individual factors, with
a
0 = level 1 for this factor
1 = level 2 for this factor
Hence the encoding I gave above would indicate that factor 1 is at level 1
for
the first pair of experiments, but at level 0 for the second pair.

   You seem to have coded variables t1 and t2 the opposite ways (the
   reference level is 2 for t1 and 1 for t2), and your model has
 the fit at
   levels t1=2,t1=1 constrained to pass through the origin.  I
 don't think R
   has a simple syntax for that (although you can fake
 anything), and I find
   it hard to believe that is actually what you want.
 
  That wasn't my intention, I want to retain the intercept term and
  not constrain it to pass through the origin.

 So why did you use ~ -1 + (t1+t2) ?  That explicitly removes the
 intercept.

Ahh, I had misunderstood the -1 as explicitly specifying an intercept.
So now:

 t1 - factor(c(1,1,2,2));
 t2 - factor(c(1,2,1,2));
 design - model.matrix(~ t1+t2);
 design;
  (Intercept) t12 t22
1   1   0   0
2   1   0   1
3   1   1   0
4   1   1   1

Which is what I had been looking for!

Thank you for your patient help,
Paul

__
[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] Error Loading r

2004-01-26 Thread Uwe Ligges


On Sun, 25 Jan 2004, Jerome Swartz wrote:

 
 Hi there,
 
 This is the first time I have encountered such an error. Error loading
 r.  I did forward the call to our desktop services, but I am just a bit
 curious on what the actual problem could be and how I could have
 resolved myself.  OS is unix version 4. 
 
 Not sure of the version of R... As its my first encounter.

It's hard to guess without more information.
I'd suggest either to ask your IT staff or to try (re)installing a recent
version of R.

Uwe Ligges


 
 Kind regards
 
 Jerome Swartz
 
 
 
 Please note: This e-mail and its contents are subject to a disclaimer 
 which can be viewed at http://www.woolworths.co.za/disclaimer. Should
 you be unable to access the link please e-mail [EMAIL PROTECTED] 
 and a copy of the disclaimer will be e-mailed to you.
 
 
 
   [[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] how to keep functions while remove all other commands

2004-01-26 Thread Petr Pikal
Hi

On 24 Jan 2004 at 21:47, Yong Wang wrote:

 Dear all:
 a quick question:
 I am used to apply  rm(list=()) regularly to remove all old codes in
 preventing them creeping in current analysis.however, with that
 application, functions I wrote are also removed. please let me know
 how to keep the thing you want while remove those you don't.

I usually work in some separate home directory (e.g. D:\data\stat\standard) and I 
store my functions I want to keep in another directory 
(D:\prog\R\..\library\fun), which can be attached as any other library in the 
same way like other libraries can. You just have to use some files (I think at least 
INDEX and DESCRIPTION).

More in R-exts manual.

Cheers
Petr

 
 thank you
 
 best 
 yong
 
 __
 [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] warning associated with Logistic Regression

2004-01-26 Thread David Firth
On Sunday, Jan 25, 2004, at 18:06 Europe/London, (Ted Harding) wrote:

On 25-Jan-04 Guillem Chust wrote:
Hi All,

When I tried to do logistic regression (with high maximum number of
iterations) I got the following warning message
Warning message:
fitted probabilities numerically 0 or 1 occurred in: (if
(is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y,
As I checked from the Archive R-Help mails, it seems that this happens
when the dataset exhibits complete separation.
This is so. Indeed, there is a sense in which you are experiencing
unusually good fortune, since for values of your predictors in one
region you are perfectly predicting the 0s in your reponse, and for
values in another region your a perfectly predicting the 1s. What
better could you hope for?
However, you would respond that this is not realistic: your variables
are not (in real life) such that P(Y=1|X=x) is ever exactly 1 or
exactly 0, so this perfect prediction is not realistic.
In that case, you are somewhat stuck. The plain fact is that your
data (in particular the way the values of the X variables are 
distributed)
are not adequate to tell you what is happening.

There may be manipulative tricks (like penalised regression) which
would inhibit the logistic regression from going all the way to a
perfect fit; but, then, how would you know how far to let it go
(because it will certainly go as far in that direction as you allow
it to).
The key parameter in this situation the dispersion parameter (sigma
in the usual notation). When you get perfect fit in a completely
separated situation, this corresponds to sigma=0. If you don't like
this, then there must be reasons why you want sigma0 and this may
imply that you have reasons for wanting sigma to be at least s0 (say),
or, if you are prepared to be Bayesian about it, you may be satisfied
that there is a prior distribution for sigma which would not allow
sigma=0, and would attach high probability to a range of sigma values
which you condisder to be realistic.
Unless you have a fairly firm idea of what sort of values sigma is
likely to havem then you are indeed stuck because you have no reason
to prefer one positive value of sigma to a different positive value
of sigma. In that case you cannot really object if the logistic
regression tries to make it as small as possible!
This seems arguable.  Accepting that we are talking about point 
estimation (the desirability of which is of course open to question!!), 
then old-fashioned criteria like bias, variance and mean squared error 
can be used as a guide.  For example, we might desire to use an 
estimation method for which the MSE of the estimated logistic 
regression coefficients (suitably standardized) is as small as 
possible; or some other such thing.

The simplest case is estimation of log(pi/(1-pi)) given an observation 
r from binomial(n,pi).  Suppose we find that r=n -- what then can we 
say about pi?  Clearly not much if n is small, rather more if n is 
large.  Better in terms of MSE than the MLE (whose MSE is infinite) is 
to use log(p/(1-p)), with p = (r+0.5)/(n+1).  See for example Cox  
Snell's book on binary data.  This corresponds to penalizing the 
likelihood by the Jeffreys prior, a penalty function which has good 
frequentist properties also in the more general logistic regression 
context.  References given in the brlr package give the theory and some 
empirical evidence.  The logistf package, also on CRAN, is another 
implementation.

I do not mean to imply that the Jeffreys-prior penalty will be the 
right thing for all applications -- it will not.  (eg if you really do 
have prior information, it would be better to use it.)

In general I agree wholeheartedly that it is best to get more/better 
data!

In the absence of such reasons,
(cut)

All good wishes,
David
__
[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] Response Surface

2004-01-26 Thread Petr Pikal
Hallo

On 23 Jan 2004 at 9:08, Li Xiaolei wrote:

 
 Hi,
 
 Is there any existing way in R of doing response surface analyses and
 plotting the response surface, like what minitab can do?

Well, I do not know about any package doing response surface 
design, but if you already made experiments according to design 
you elaborated by yourself, 

function 

contour 

maybe with help of 

interp 

from akima package can do the plotting.

Cheers

Petr

 
 Thanks
 
 Xiaolei
 
 __
 [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] D(COM) with Excel

2004-01-26 Thread David James
Hi Joel,

You may want to take a look at the RDCOM implementation at
http://www.omegahat.org/RDCOMServer.  We've had very good
experience with it.

--
David

Joel Pitt wrote:
 Hi there,
 
 I'm currently trying to use R in an automated
 macro with Excel, and to this effect I've been
 using the D(COM) server.
 
 However I've been having alot of problems with
 it, because it seems to be limited to only recieving
 and sending arrays. I've been struggling
 trying to find a way to receive model summaries
 from R to put in Excel. I also seem to have
 some strange errors coming up...
 I've tried doing everything I want directly in R
 by hand, and it has been fine, but excel seems to
 complicate everything :(
 
 Any people have suggestions?
 
 Thanks,
 joel
 
 __
 [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] correlation/random effects when using nlme

2004-01-26 Thread J-C. Marioni
Hi,

I'm trying to use nlme to program a model where, as well as a number of 
fixed effects, I have a random effect for each subject in my model.

I would also like to include a correlation statement in my model, where the 
grouping factor for the correlation is a subset of the observations on a 
particular subject.

However, when I try and program this, R will not let me use a different 
grouping structure for the random effects and the correlation structure. I 
can't seem to solve this problem myself and so I would be grateful for any 
help!

Thanks,

John Marioni
University of Cambridge
__
[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] Fitting compartmental model with nls and lsoda?

2004-01-26 Thread Michael A. Miller
 DivineSAAM == DivineSAAM  [EMAIL PROTECTED] writes:

 Dear Colleagues,
 Our group is also working on implementing the use of R for
 pharmacokinetic compartmental analysis. Perhaps I have
 missed something, but 

  fit - nls(noisy ~ lsoda(xstart, time,
 one.compartment.model, c(K1=0.5, k2=0.5)), 
 +data=C1.lsoda,
 +start=list(K1=0.3, k2=0.7),
 +trace=T
 +)
 Error in eval(as.name(varName), data) : Object C1.lsoda not found

 What part of the e-mail did I miss? I would like to get
 this problem up an running. 

Oscar,

There were several problems with the code in my previous posting.
I'll append an example that does work.  While this example often
works, there are cases when nls fails by reducing the step factor
below minFactor.  It is even less stable for fitting less trivial
examples with real data sets.  I'll be very interested to keep in
touch as we make progress on this problem.

Regards, Mike


Here's my (more) correct example:

require(odesolve)

## Simple one compartment blood flow model:
one.compartment.model - function(t, x, parms) {
  C1 - x[1] # compartment
  with(as.list(parms),{
input - approx(signal$time, signal$input, t)$y
dC1 - K1 * input - k2 * C1
list(c(dC1))
  })
}

## vector of timesteps
time - seq(0, 100, 1)

## external signal with rectangle impulse
signal - as.data.frame(list(time=time,
 input=rep(0,length(time
signal$input[signal$time = 10  signal$time =40] - 0.2

## Parameters for steady state conditions
parms - c(K1=0.5, k2=0.5)

## Start values for steady state
xstart - c(C1=0)

## calculate C1 with lsoda:
C1.lsoda - as.data.frame(lsoda(xstart, time, one.compartment.model, parms))

## Add some noise to the output curve
C1.lsoda$noisy - C1.lsoda$C1 + rnorm(nrow(C1.lsoda), sd=0.15*C1.lsoda$C1)

## See if I can run a fit to find the parameters that I started with...
require(nls)
fit - nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1, k2=k2))[,2],
   data=C1.lsoda,
   start=list(K1=0.3, k2=0.7),
   trace=T,
   control=list(tol=1e-2,
 minFactor=1/1024/1024)
   )

fit.rk4 - nls(noisy ~ rk4(xstart, time, one.compartment.model, c(K1=K1, k2=k2))[,2],
   data=C1.lsoda,
   start=list(K1=0.3, k2=0.7),
   trace=T,
   control=list(tol=1e-2,
 minFactor=1/1024/1024)
   )

## Plot what I've got so far:
par(mfrow=c(2,2))
plot(noisy ~ time, data=C1.lsoda, main='Input, C1, C1+noise', col='forestgreen')
points(input ~ time, data=signal, type='b')
points(C1 ~ time, data=C1.lsoda, type='b', pch=16)

t - seq(0,100,0.1)
plot(noisy ~ time, data=C1.lsoda, main='Input, C1+noise, lsoda',
 col='forestgreen')
lines(t, predict(fit, list(time=t)), col='red',type='l')

plot(noisy ~ time, data=C1.lsoda, main='Input, C1+noise, rk4',
 col='forestgreen')
lines(t, predict(fit.rk4, list(time=t)), col='blue', type='l')

plot(t, predict(fit.rk4, list(time=t))-predict(fit, list(time=t)),
 type='l')
abline(h=0)


print('Coefficients for lsoda solution:')
print(coef(fit))
print(vcov(fit))

print('Coefficients for rk4 solution:')
print(coef(fit.rk4))
print(vcov(fit.rk4))

-- 
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] Openin a file from spss

2004-01-26 Thread Dennis Di Mascio
Hello everybody,
I'm trying to open an SPSS (version 11.5) file with R (1.8.1 for windows)
and I have some problems. I already used the following syntax to open other
files ant it worked fine. (I loaded the foreign package).
Would be very nice to understand what happened because I'm going to work a
lot on this file and it is a good opportunity to learn R instead of spss and
to confrontate results with my group mates.
I apologize if I'm asking something that is well know to the entire list,
but I browsed briefly through the past articles and I didn't find anything
and I am short in time
Thanks a lot.

dennis.

data - read.spss(C:/a.sav, use.value.labels=TRUE, max.value.labels=Inf,
to.data.frame=TRUE)
Error in read.spss(C:/a.sav, use.value.labels = TRUE, max.value.labels =
Inf,  :
Error reading system-file header.
In addition: Warning message:
C:/a.sav: File layout code has unexpected value 50331648.  Value should be
2, in big-endian or little-endian format.

__
[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] scan() Bug

2004-01-26 Thread Prof Brian Ripley
The \zzz notation is octal (just like C)!  I presume you want ASCII
character 10, that is LF, not 8 (BS), although using \n would be much
easier to remember.

On Mon, 26 Jan 2004, Greg Riddick wrote:

 Thanks for your suggestions on dealing with binary files, Prof Ripley
 
 I ended up using this method:
 
 
 PDF = file(file.pdf,a+b)
 PDFlines = readLines(PDF)
 .
 .
 .
 (Extract Some Information From PDFlines and create some objects to add back
 to the PDF file)
 .
 .
 .
 writeLines(newobjects, PDF, sep = \12)
 close(PDF)
 
 
 So I opened the file as binary in read/append mode.
 Works fine now...though I have noticed that the sep character that actually
 gets written to the file is -2 the value specified.
 So I wanted \10 and needed to specify \12 to get it. Am I doing something
 wrong here?
 
 I'm working on an R package to add annotations(hyperlinks, popups etc.) to
 PDF files that I should release in about 2 weeks.  Should be useful
 especially to the bioinformatics
 people who use R. Incidentally, the uncompressed PDF files that I have seen
 R produce are actually just plain text files---human-readable ascii
 characters delimited by CR or CR/LF.  They are binary only in the sense that
 a cross-reference table at the end of the file records byte offsets of
 individual objects in the file. So insertions and deletions cannot be made
 without updating the
 cross-reference table.
 
 
 
 
 - Original Message - 
 From: Prof Brian Ripley [EMAIL PROTECTED]
 To: Greg Riddick [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, January 22, 2004 4:52 PM
 Subject: Re: [R] scan() Bug?
 
 
  On Thu, 22 Jan 2004, Greg Riddick wrote:
 
   I'm reading a file into a list by:
   PDF = scan(file,what=character,sep=\10)
  
   \10 is the newline character in this file, also tried \n originally
  
   On lines that are ended by \13\10, both are dropped from the list
 entry
   I want scan to keep the \13 in the list entry.
  
   Is this a bug or just a strange feature?
 
  Not a strange feature, but the documented behaviour (and useful, too).
  You have opened the file in text mode.  If you want to keep CRs, open and
  read in binary mode.
 
  -- 
  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
 
  __
  [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
 
 
 

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

__
[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] scan() Bug?

2004-01-26 Thread Peter Dalgaard
Greg Riddick [EMAIL PROTECTED] writes:

 Works fine now...though I have noticed that the sep character that actually
 gets written to the file is -2 the value specified.
 So I wanted \10 and needed to specify \12 to get it. Am I doing something
 wrong here?

Just overlooking that such codes are specified in octal notation, I
think. 

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

__
[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] warning associated with Logistic Regression

2004-01-26 Thread Ravi Varadhan
Hi All:

I am really fascinated by the content and the depth of discussion of 
this thread.  This really exemplifies what I have come to love and 
enjoy about the R user group - that it is not JUST an answering service 
for getting help on programming issues, but also a forum for some 
critical and deep thinking on fundamental statistical issues.  

Kudos to the group!

Best,
Ravi.

- Original Message -
From: David Firth [EMAIL PROTECTED]
Date: Monday, January 26, 2004 5:28 am
Subject: Re: [R] warning associated with Logistic Regression

 On Sunday, Jan 25, 2004, at 18:06 Europe/London, (Ted Harding) wrote:
 
  On 25-Jan-04 Guillem Chust wrote:
  Hi All,
 
  When I tried to do logistic regression (with high maximum 
 number of
  iterations) I got the following warning message
 
  Warning message:
  fitted probabilities numerically 0 or 1 occurred in: (if
  (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y,
 
  As I checked from the Archive R-Help mails, it seems that this 
 happens when the dataset exhibits complete separation.
 
  This is so. Indeed, there is a sense in which you are experiencing
  unusually good fortune, since for values of your predictors in one
  region you are perfectly predicting the 0s in your reponse, and for
  values in another region your a perfectly predicting the 1s. What
  better could you hope for?
 
  However, you would respond that this is not realistic: your 
 variables are not (in real life) such that P(Y=1|X=x) is ever 
 exactly 1 or
  exactly 0, so this perfect prediction is not realistic.
 
  In that case, you are somewhat stuck. The plain fact is that your
  data (in particular the way the values of the X variables are 
  distributed)
  are not adequate to tell you what is happening.
 
  There may be manipulative tricks (like penalised regression) which
  would inhibit the logistic regression from going all the way to a
  perfect fit; but, then, how would you know how far to let it go
  (because it will certainly go as far in that direction as you allow
  it to).
 
  The key parameter in this situation the dispersion parameter (sigma
  in the usual notation). When you get perfect fit in a completely
  separated situation, this corresponds to sigma=0. If you don't like
  this, then there must be reasons why you want sigma0 and this may
  imply that you have reasons for wanting sigma to be at least s0 
 (say), or, if you are prepared to be Bayesian about it, you may 
 be satisfied
  that there is a prior distribution for sigma which would not allow
  sigma=0, and would attach high probability to a range of sigma 
 values which you condisder to be realistic.
 
  Unless you have a fairly firm idea of what sort of values sigma is
  likely to havem then you are indeed stuck because you have no reason
  to prefer one positive value of sigma to a different positive value
  of sigma. In that case you cannot really object if the logistic
  regression tries to make it as small as possible!
 
 This seems arguable.  Accepting that we are talking about point 
 estimation (the desirability of which is of course open to 
 question!!), 
 then old-fashioned criteria like bias, variance and mean squared 
 error 
 can be used as a guide.  For example, we might desire to use an 
 estimation method for which the MSE of the estimated logistic 
 regression coefficients (suitably standardized) is as small as 
 possible; or some other such thing.
 
 The simplest case is estimation of log(pi/(1-pi)) given an 
 observation 
 r from binomial(n,pi).  Suppose we find that r=n -- what then can 
 we 
 say about pi?  Clearly not much if n is small, rather more if n is 
 large.  Better in terms of MSE than the MLE (whose MSE is 
 infinite) is 
 to use log(p/(1-p)), with p = (r+0.5)/(n+1).  See for example Cox 
  
 Snell's book on binary data.  This corresponds to penalizing the 
 likelihood by the Jeffreys prior, a penalty function which has 
 good 
 frequentist properties also in the more general logistic 
 regression 
 context.  References given in the brlr package give the theory and 
 some 
 empirical evidence.  The logistf package, also on CRAN, is another 
 implementation.
 
 I do not mean to imply that the Jeffreys-prior penalty will be the 
 right thing for all applications -- it will not.  (eg if you 
 really do 
 have prior information, it would be better to use it.)
 
 In general I agree wholeheartedly that it is best to get 
 more/better 
 data!
 
  In the absence of such reasons,
 (cut)
 
 All good wishes,
 David
 
 __
 [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] Learning to use survey package

2004-01-26 Thread [EMAIL PROTECTED]
Being an  electrical engineer lent to statistics, I'm now studying the stratified 
sampling techniques using the survey package and its documentation. 

I've found somewhat complex the example in the package also for the magnitude of the 
dataset used and the not-clearly-exposed purposes of the sampling, and my attempts to 
find something in the net through Google ended up with a flood of useless info.

What I would find extremely helpful would be having a very simple example developped 
step by step, starting from an **easy** dataset, setting the aims of the sampling, and 
showing in a straightforward way the actions to be taken (of course, better, but not 
necessarely, using survey).

Do you know if there is anything of this kind available in the Internet?

Thanks for your help

Vittorio

__
[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] Trouble with HTML search engine Mozilla Firebird

2004-01-26 Thread Damon Wischik

I'm having trouble with the HTML-based search engine, and I'd be grateful
for any advice. I am using Mozilla Firebird 0.7 on Debian 3.0 with R
1.8.0. (I've also had the trouble with Mozilla Firebird 0.6 on Debian 3.0.
I also use Mozilla Firebird 0.6 on Windows XP, and I have no trouble with
the HTML-based search engine.)

When I type help.start() in R, it brings up the proper search page. 
I follow the link to Search engine  keywords, type some text into the
search box, and click search. It wipes the text in the search box, and
leaves me at the search page. The URL changes, to something like
file:///tmp/Rtmp27053/.R/doc/html/search/SearchEngine.html?SEARCHTERM=MySearchTermTITLES=1KEYWORDS=1ALIASES=1

I've looked through the help on the R web site. There are plenty of
messages which say to check that Java is correctly installed and that
Javascript is turned on, but this does not seem to be my problem...

I have installed Java 1.4.2_03. Java is installed in my browser, according
to the test applet at http://www.java.com/en/download/help/testvm.jsp
Javascript works in my browser, as far as I can test it. I tried modifying
the search page, to put in various debugging messages, and they showed up
as I expected.

When I execute the search, the Mozilla Firebird javascript console comes
up with an error message: Error: document.SearchEngine.search is not a
function. The line of the web page which causes this error is

line = line + document.SearchEngine.search(...)

I tried putting in some debugging messages before this, to show me what's
going on:

alert(I found +document.SearchEngine)
alert(I found +document.SearchEngine.search)

The first shows me that javascript can find the object
document.SearchEngine, and the second suggests that it can't find the
method search() from within that object.

This suggests there is some trouble in the interface between Java and
Javascript in this browser. I looked through all the security settings,
but (as far as I can see) I've enabled everything to do with Java and
Javascript. 

Does anyone have any advice?

Damon.

__
[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] Fortran source code

2004-01-26 Thread Ka Yee Yeung
Hi,

I am wondering if it is possible to view the Fortran source code called by
R functions.

In particular, I am interested in the leaps.setup function in a
package called leaps, which calls Fortran functions ssleaps, initr
etc.

Any help would be greatly appreciated.

Ka Yee Yeung
Bioinformatics Scientist
Dept of Microbiology
University of Washington

__
[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] Fortran source code

2004-01-26 Thread Peter Dalgaard
Ka Yee Yeung [EMAIL PROTECTED] writes:

 Hi,
 
 I am wondering if it is possible to view the Fortran source code called by
 R functions.

R is Open Source, and so are most of the packages developed for it.
Would be a rare case if the source code was not available. 
 
 In particular, I am interested in the leaps.setup function in a
 package called leaps, which calls Fortran functions ssleaps, initr
 etc.
 
 Any help would be greatly appreciated.

Look inside

http://cran.r-project.org/src/contrib/leaps_2.6.tar.gz

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

__
[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] Question about design matrix

2004-01-26 Thread Yongwan Chun
Now, I am working with some design matrices. My problem is to set
contrasts option. Now I want to use contr.sum as the option, and it
works properly. However, this option sets the last element of a factor
as -1. For example, if I have a factor which has 5 elements and want to
use the contr.sum option, the 5th elements is always set to -1. I want
set -1 to other element such as 1st or 2nd. Is it possible? 
 
Thank you in advance.
 
 
Yongwan Chun

[[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] D(COM) with Excel

2004-01-26 Thread Erich Neuwirth
Hi,

as the one who wrote the RExcel package let me add something to the 
discussion.

Thomas Baier's R (D)COM package tries to use native Windows
data types to be as fast as possible.
My RExcel package has the following philosophy:
Offer R functions to people who think spreadsheet.
One way of describing it is:
You can have an R process living in each cell of the spreadsheet,
and the output of R we want to deal with hast to be compatible with the
spreadsheet structure. That is the reason for the restriction to
arrays.
Spreadsheets (NOT the embedded programming language)
do not know about objects.
Somewhat oversimplifying one might say:
RExcel brings R computation to the spreadsheet,
and RDCOM brings R objects to VBA.
Erich Neuwirth





David James wrote:

Hi Joel,

You may want to take a look at the RDCOM implementation at
http://www.omegahat.org/RDCOMServer.  We've had very good
experience with it.
--
David
Joel Pitt wrote:
 

Hi there,

I'm currently trying to use R in an automated
macro with Excel, and to this effect I've been
using the D(COM) server.
However I've been having alot of problems with
it, because it seems to be limited to only recieving
and sending arrays. I've been struggling
trying to find a way to receive model summaries
from R to put in Excel. I also seem to have
some strange errors coming up...
I've tried doing everything I want directly in R
by hand, and it has been fine, but excel seems to
complicate everything :(
Any people have suggestions?

Thanks,
joel
__
[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
 



--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[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] conditional assignment

2004-01-26 Thread uaca

Hi all

I want to conditionally operate on certain elements of a matrix, let me
explain it with a simple vector example


 z- c(1, 2, 3)
 zz - c(0,0,0)
 null - (z  2)  ( zz - z)
 zz
[1] 1 2 3

why zz is not (0, 0, 3) ?


the null - assignment is to keep the console silent

in the other hand, it curious that null has reasonable values

 null
[1] FALSE FALSE  TRUE

Thanks in advance

Ulisses

Debian GNU/Linux: a dream come true
-
Computers are useless. They can only give answers.Pablo Picasso

Humans are slow, innaccurate, and brilliant.
Computers are fast, acurrate, and dumb. 
Together they are unbeatable

---Visita http://www.valux.org/ para saber acerca de la---
---AsociaciĆ³n Valenciana de Usuarios de Linux  ---

__
[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] Fortran source code

2004-01-26 Thread Prof Brian Ripley
They are part of the package leaps_2.6.tar.gz on CRAN.  Just look at the 
source package and not (I assume) a binary installation.

On Mon, 26 Jan 2004, Ka Yee Yeung wrote:

 I am wondering if it is possible to view the Fortran source code called by
 R functions.
 
 In particular, I am interested in the leaps.setup function in a
 package called leaps, which calls Fortran functions ssleaps, initr
 etc.


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

__
[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] conditional assignment

2004-01-26 Thread Roger Bivand
On Mon, 26 Jan 2004 [EMAIL PROTECTED] wrote:

 
 Hi all
 
 I want to conditionally operate on certain elements of a matrix, let me
 explain it with a simple vector example
 
 
  z- c(1, 2, 3)
  zz - c(0,0,0)
  null - (z  2)  ( zz - z)
  zz
 [1] 1 2 3
 
 why zz is not (0, 0, 3) ?
 

Break it down into bits:

 z- c(1, 2, 3)
 (z  2)
[1] FALSE FALSE  TRUE
 ( zz - z)
[1] 1 2 3
 (z  2)  ( zz - z)
[1] FALSE FALSE  TRUE
 TRUE  ( zz - z)
[1] TRUE TRUE TRUE
 rep(TRUE,4)  ( zz - z)
[1] TRUE TRUE TRUE TRUE
Warning message: 
longer object length
is not a multiple of shorter object length in: rep(TRUE, 4)  (zz - z) 

The first part is a logical vector, the second is the result of assigning 
z to zz,  of them isn't terribly meaningful?

Try:

 zz - ifelse(z  2, z, 0)
 zz
[1] 0 0 3

if that's what you want.

 
 the null - assignment is to keep the console silent
 
 in the other hand, it curious that null has reasonable values
 
  null
 [1] FALSE FALSE  TRUE
 
 Thanks in advance
 
   Ulisses
 
 Debian GNU/Linux: a dream come true
 -
 Computers are useless. They can only give answers.Pablo Picasso
 
 Humans are slow, innaccurate, and brilliant.
 Computers are fast, acurrate, and dumb. 
 Together they are unbeatable
 
 ---  Visita http://www.valux.org/ para saber acerca de la---
 ---  AsociaciĆ³n Valenciana de Usuarios de Linux  ---
 
 __
 [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
 

-- 
Roger Bivand
Econonic Geography Section, Department of Economics, Norwegian School of 
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, 
Norway, voice: +47-55959355, fax: +47-55959393; [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] conditional assignment

2004-01-26 Thread Liaw, Andy
 From: Simon Cullen
 On Mon, 26 Jan 2004 20:15:51 +0100, [EMAIL PROTECTED] wrote:
 
  I want to conditionally operate on certain elements of a 
 matrix, let me
  explain it with a simple vector example
 
 
  z- c(1, 2, 3)
  zz - c(0,0,0)
  null - (z  2)  ( zz - z)
  zz
  [1] 1 2 3
 
  why zz is not (0, 0, 3) ?
 snip
 
  in the other hand, it curious that null has reasonable values
 
  null
  [1] FALSE FALSE  TRUE
 
 What you have done there is create a boolean vector, null, of 
 the same  
 length as z (and zz).
 
 For instance:
 (z  2)  (zz - z)
 =(F F T)  (T T T) (as assignment - presumably - returns T)
 
Don't think so.  zz - z has the value z; i.e., c(1, 2, 3).  When evaluated
as logicals, non-zero values are treated as true (as in C), I believe.  For
example:

 z - rep(0, 3)
 ifelse(zz - z, 1, 0)
[1] 0 0 0
  (zz - z) == TRUE
[1] FALSE FALSE FALSE

However, what tripped me is the fact that even though non-zero is logically
`true', it's not necessarily equal to TRUE (which is numerically equal to
1):

 z - 0:2
  (zz - z) == TRUE
[1] FALSE  TRUE FALSE
 ifelse(zz - z, 1, 0)
[1] 0 1 1
 if(3) TRUE else FALSE
[1] TRUE

Andy




 =(F F T).
 
 What will work is:
 z - c(1, 2, 3)
 index - z2
 zz - z * index
 
 
 -- 
 SC
 
 Simon Cullen
 Room 3030
 Dept. Of Economics
 Trinity College Dublin
 
 Ph. (608)3477
 Email [EMAIL PROTECTED]


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

__
[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] conditional assignment

2004-01-26 Thread Prof Brian Ripley
On Mon, 26 Jan 2004, Simon Cullen wrote:

 On Mon, 26 Jan 2004 20:15:51 +0100, [EMAIL PROTECTED] wrote:
 
  I want to conditionally operate on certain elements of a matrix, let me
  explain it with a simple vector example
 
 
  z- c(1, 2, 3)
  zz - c(0,0,0)
  null - (z  2)  ( zz - z)
  zz
  [1] 1 2 3
 
  why zz is not (0, 0, 3) ?
 snip
 
  in the other hand, it curious that null has reasonable values
 
  null
  [1] FALSE FALSE  TRUE
 
 What you have done there is create a boolean vector, null, of the same  
 length as z (and zz).
 
 For instance:
 (z  2)  (zz - z)
 =(F F T)  (T T T) (as assignment - presumably - returns T)

assignment returns the new value of zz, which as it is all non-zero
coerces to the logical vector T T T

 =(F F T).
 
 What will work is:
 z - c(1, 2, 3)
 index - z2
 zz - z * index

Rather better I think is

zz - ifelse(z  2, z, zz)

or even

ind - z  2
zz[ind] - z[ind]

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

__
[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] HTML help pages

2004-01-26 Thread Rolf Turner
Devin Johnson wrote:

 I am having trouble getting the HTML help pages to work. When I try
 the search engine I get an error on page response and nothing
 happens. When I try to click on the listed topics nothing happens. I
 am using both Mozilla and IE6 on XP and the same thing happens on
 each. Is there something I'm missing?

I have (almost exactly) the same problem.

If I start an R session, do help.start(), and then say, e.g.

?plot

the help comes up in the Mozilla window as it should.  But if I
attempt a search using the search engine in the window provided by
help.start(), nothing happens.

I don't any error from clicking on a topic, just a total lack
of response.

I'm using Mozilla and R 1.8.1 under Linux:

===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
 _
platform i686-pc-linux-gnu
arch i686 
os   linux-gnu
system   i686, linux-gnu  
status
major1
minor8.1  
year 2003 
month11   
day  21   
language R
===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===

I've no idea what the solution is.  This is contributed just to point
out that the problem is not unique.

cheers,

Rolf Turner
[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] HTML help pages

2004-01-26 Thread Marc Schwartz
On Mon, 2004-01-26 at 15:58, Rolf Turner wrote:
 Devin Johnson wrote:
 
  I am having trouble getting the HTML help pages to work. When I try
  the search engine I get an error on page response and nothing
  happens. When I try to click on the listed topics nothing happens. I
  am using both Mozilla and IE6 on XP and the same thing happens on
  each. Is there something I'm missing?
 
 I have (almost exactly) the same problem.
 
 If I start an R session, do help.start(), and then say, e.g.
 
   ?plot
 
 the help comes up in the Mozilla window as it should.  But if I
 attempt a search using the search engine in the window provided by
 help.start(), nothing happens.
 
 I don't any error from clicking on a topic, just a total lack
 of response.
 
 I'm using Mozilla and R 1.8.1 under Linux:
 
 ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
  _
 platform i686-pc-linux-gnu
 arch i686 
 os   linux-gnu
 system   i686, linux-gnu  
 status
 major1
 minor8.1  
 year 2003 
 month11   
 day  21   
 language R
 ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
 
 I've no idea what the solution is.  This is contributed just to point
 out that the problem is not unique.


In general, one key thing to check is when you click on the link for
Search Engine  Keywords after the help.start() page comes up, look at
the status line in Mozilla in the lower left hand corner.

It should indicate something to the effect of Applet SearchEngine
Started.

If you do not see this message, then the Java applet has not been
initialized and the queries from the search page will not work. It takes
both Java and JavaScript to be functioning properly for the search
applet to work. If you do not see that message, it is a good indication
that there is a problem with your Java installation, which might include
Java and/or browser version conflict issues. Be sure to check the
browser release notes and/or Java installation notes as appropriate.

It has been a while since I have used IE (or even Windows for that
matter), but I am guessing that there should be a similar indication
there.

I am running R 1.8.1 Patched along with Firebird 0.7 and Mozilla 1.6
under Fedora Core 1 and have had no problems using the help.search()
mechanism with either browser.

FWIW, after the previously discussed issues with the installation of
Java and Mozilla, I stopped putting the oft discussed symlink to Java in
the Mozilla version specific folders (/usr/lib/mozilla-version/plugins)
and now put it in ~/.mozilla/plugins. While this makes the Java
installation user specific, I am the only user of my laptop. This does
however remove the need to redo the symlink everytime I upgrade Mozilla
and it also works for Firebird. The same goes for Flash, Helix and other
plugins.

HTH,

Marc Schwartz

__
[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.table file=file.txt help

2004-01-26 Thread Kristin Kay Nicodemus
Hi all,

I have a R script that creates several input files for an analysis 
program.  It loops through the matrix read into R and picks out 
submatrices and then creates a separate output file for each 
submatrix.  The loop works great, but I am having trouble getting all 
the separate output files written.

The line I have is:

write.table(ch1d, file=C:/WINDOWS/Desktop/SNPs/haplo.txt, 
row.names=F, col.names=F, append=F, quote=F)

Which works just fine if I just wanted to create a single file from the 
loop.  However, I need to somehow get it to change the name of the 
output file (haplo.txt) each time it goes through the loop so it 
doesn't overwrite each time.  In perl, I'd create $n=1 and increment up 
each loop, and call the file something like haplo.txt.$n  

I tried to do something like that but R doesn't recognize the variable 
that would be $n in perl (because it's part of the quoted name of the 
output file).  Adding it after the ending  just gave me an error, as I 
thought it would.

I also tried to use system(copy ...) to change the name of the file in 
dos, but my knowledge of dos is abysmal, so I was unable to do it.

Any ideas on how to go about doing this would be most appreciated!

Thanks in advance,
KK Nicodemus

__
[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.table file=file.txt help

2004-01-26 Thread Andy Bunn
Look at ?paste

for (j in 1:10) { 
   write.table(j, file=paste(haplo.txt, j, sep=.), 
   row.names=F, col.names=F, append=F, quote=F)
}

BTW, there have been many similar posts like this in the past. They are
easily found using the search function at 
http://cran.r-project.org/search.html 

HTH, Andy

__
[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.table file=file.txt help

2004-01-26 Thread Kristin Kay Nicodemus
Thanks to Andy Bunn and Patrick Connolly for their help!

Kristin Nicodemus

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

2004-01-26 Thread Marcos
Hello,

Please, I need a R function to optimize a function (maximizer ou minimizer)
under restriction.
What function do this?

Thank you.

Marcos

__
[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.table file=file.txt help

2004-01-26 Thread Sundar Dorai-Raj


Kristin Kay Nicodemus wrote:

Hi all,

I have a R script that creates several input files for an analysis 
program.  It loops through the matrix read into R and picks out 
submatrices and then creates a separate output file for each 
submatrix.  The loop works great, but I am having trouble getting all 
the separate output files written.

The line I have is:

write.table(ch1d, file=C:/WINDOWS/Desktop/SNPs/haplo.txt, 
row.names=F, col.names=F, append=F, quote=F)

Which works just fine if I just wanted to create a single file from the 
loop.  However, I need to somehow get it to change the name of the 
output file (haplo.txt) each time it goes through the loop so it 
doesn't overwrite each time.  In perl, I'd create $n=1 and increment up 
each loop, and call the file something like haplo.txt.$n  

I tried to do something like that but R doesn't recognize the variable 
that would be $n in perl (because it's part of the quoted name of the 
output file).  Adding it after the ending  just gave me an error, as I 
thought it would.

I also tried to use system(copy ...) to change the name of the file in 
dos, but my knowledge of dos is abysmal, so I was unable to do it.

Any ideas on how to go about doing this would be most appreciated!

Thanks in advance,
KK Nicodemus
Use paste().

for(i in 1:n) {
  file - paste(C:/WINDOWS/Desktop/SNPs/haplo, i, txt, sep = .)
  cat(Writing data to, file, \n)
  write.table(ch1d, file=file,
row.names=F, col.names=F, append=F, quote=F)
}
-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] The results of your email commands

2004-01-26 Thread r-announce-bounces
The results of your email command are provided below. Attached is your
original message.

- Results:
Ignoring non-text/plain MIME parts

- Done.

---BeginMessage---
The message contains Unicode characters and has been sent as a binary attachment.

---End Message---
__
[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] Reply : hi

2004-01-26 Thread postmaster
The recipient's mailbox is full.


receiver: [EMAIL PROTECTED]
Received: from [165.132.77.225] ([EMAIL PROTECTED]) by 
  mh02.hanafos.com (Terrace MailWatcher) 
  with ESMTP id 2004012713:21:46:219514.20887.5524
  for [EMAIL PROTECTED]; 
  Tue, 27 Jan 2004 13:21:46 +0900 (KST) 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: hi
Date: Tue, 27 Jan 2004 13:21:07 +0900
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary==_NextPart_000_0010_B206E143.4B87CD4D
X-Priority: 3
X-MSMail-Priority: Normal
X-TERRACE-SPAMMARK:(SR:6.43)   
__
[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