[R] Hierarchical clustering with centroid method

2005-07-26 Thread Paolo Radaelli
Dear everybody! 
In the function hclust, at each stage distances between clusters are recomputed 
by the Lance-Williams dissimilarity update formula according to the
particular clustering method being used.
Using centroid method, Lance-Williams recurrence formula works properly only 
for euclidean distance. 
How is it possible to use properly centroid method with manhattan distance ?
Thanks

[[alternative HTML version deleted]]

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


[R] Plot zooming i.e. changing ylim according to xlim

2005-07-26 Thread Henrik Andersson
Dear R-gurus,

I would like to zoom in a plot, e.g. I select a region on the x-axis and 
then I would like the ranges on the y-axis to change accordingly.

Is it possible to do this with existing functions, or do I have to 
invent some data selection before plotting?

See below a short example, where I select ylim with trial and error, 
which I want to avoid.

Cheers, Henrik Andersson

## Example -- in reality more numbers, no function
x - seq(0,20)
y - exp(-x)

plot(y~x,type='l')

## Zoom in the end, to see what's happenning

plot(y~x,type='l',xlim=c(19,20))

## Try other ylim

plot(y~x,type='l',xlim=c(19,20),ylim=c(0,1))

## Not enough

plot(y~x,type='l',xlim=c(19,20),ylim=c(0,1E-8))

## Better
-
Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577473
[EMAIL PROTECTED]
http://www.nioo.knaw.nl/ppages/handersson

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


Re: [R] Plot zooming i.e. changing ylim according to xlim

2005-07-26 Thread Mulholland, Tom
Search the archives for zoom and you will find plenty of answers on this 
question. 

RSiteSearch(zoom)

Tom

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Henrik Andersson
 Sent: Tuesday, 26 July 2005 4:16 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Plot zooming i.e. changing ylim according to xlim
 
 
 Dear R-gurus,
 
 I would like to zoom in a plot, e.g. I select a region on the 
 x-axis and 
 then I would like the ranges on the y-axis to change accordingly.
 
 Is it possible to do this with existing functions, or do I have to 
 invent some data selection before plotting?
 
 See below a short example, where I select ylim with trial and error, 
 which I want to avoid.
 
 Cheers, Henrik Andersson
 
 ## Example -- in reality more numbers, no function
 x - seq(0,20)
 y - exp(-x)
 
 plot(y~x,type='l')
 
 ## Zoom in the end, to see what's happenning
 
 plot(y~x,type='l',xlim=c(19,20))
 
 ## Try other ylim
 
 plot(y~x,type='l',xlim=c(19,20),ylim=c(0,1))
 
 ## Not enough
 
 plot(y~x,type='l',xlim=c(19,20),ylim=c(0,1E-8))
 
 ## Better
 -
 Henrik Andersson
 Netherlands Institute of Ecology -
 Centre for Estuarine and Marine Ecology
 P.O. Box 140
 4400 AC Yerseke
 Phone: +31 113 577473
 [EMAIL PROTECTED]
 http://www.nioo.knaw.nl/ppages/handersson
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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


Re: [R] Plot zooming i.e. changing ylim according to xlim

2005-07-26 Thread Henrik Andersson
Dear R-gurus,

I would like to zoom in a plot, e.g. I select a region on the 
x-axis and 
then I would like the ranges on the y-axis to change accordingly.

Is it possible to do this with existing functions, or do I have to 
invent some data selection before plotting?

See below a short example, where I select ylim with trial and error, 
which I want to avoid.
Mulholland, Tom wrote:
  Search the archives for zoom and you will find plenty of answers on 
this question.
 
  RSiteSearch(zoom)
 
  Tom

I looked there already, but I could only find interactive zooming, which 
  is also nice, but I want a non-interactive function that automagically 
changes the y-axis to fit only the data specified in the part of the 
x-axis, or the other way around. I guess that was not very clear from my 
first post.

- Henrik

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


Re: [R] Plot zooming i.e. changing ylim according to xlim

2005-07-26 Thread Petr Pikal
Hi

Not avoiding trial and error but you can do it interactively by point 
clicking on a plot.

 replot
function (x, y, type = l) 
{
body - locator(2)
plot(x, y, xlim = range(body$x), ylim = range(body$y), type = 
type)
}


HTH

Best regards
Petr Pikal



On 26 Jul 2005 at 10:16, Henrik Andersson wrote:

 Dear R-gurus,
 
 I would like to zoom in a plot, e.g. I select a region on the x-axis
 and then I would like the ranges on the y-axis to change accordingly.
 
 Is it possible to do this with existing functions, or do I have to
 invent some data selection before plotting?
 
 See below a short example, where I select ylim with trial and error,
 which I want to avoid.
 
 Cheers, Henrik Andersson
 
 ## Example -- in reality more numbers, no function x - seq(0,20) y -
 exp(-x)
 
 plot(y~x,type='l')
 
 ## Zoom in the end, to see what's happenning
 
 plot(y~x,type='l',xlim=c(19,20))
 
 ## Try other ylim
 
 plot(y~x,type='l',xlim=c(19,20),ylim=c(0,1))
 
 ## Not enough
 
 plot(y~x,type='l',xlim=c(19,20),ylim=c(0,1E-8))
 
 ## Better
 -
 Henrik Andersson
 Netherlands Institute of Ecology -
 Centre for Estuarine and Marine Ecology
 P.O. Box 140
 4400 AC Yerseke
 Phone: +31 113 577473
 [EMAIL PROTECTED]
 http://www.nioo.knaw.nl/ppages/handersson
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] passing formula arguments cv.glm

2005-07-26 Thread Prof Brian Ripley
Adai,

using traceback() helps, as does giving a reproducible example when 
reporting a problem.

However, the problem is I think the line

 d.glm - update(glmfit, data = data[j.in, , drop = FALSE])

in cv.glm.  I think that should be

 d.glm - eval.parent(update(glmfit,
 data = data[j.in, , drop = FALSE], evaluate = FALSE))

as in add.default and many other places.

Could you please confirm that is the cause?

Brian

On Mon, 25 Jul 2005, Adaikalavan Ramasamy wrote:

 I am trying to write a wrapper for the last example in help(cv.glm) that
 deals with leave-one-out-cross-validation (LOOCV) for a logistic model.
 This wrapper will be used as part of a bigger program.

 Here is my wrapper funtion :

   logistic.LOOCV.err - function( formu=NULL, data=NULL ){

 cost.fn - function(cl, pred) mean( abs(cl-pred)  0.5 )

 glmfit - glm( formula=formu, data=data, family=binomial )
 print(glmfit is OK)

 err- cv.glm( data=data, glmfit=glmfit,
   cost=cost.fn, K=nrow(data) )$delta[2]
 print(cv.glm OK)
   }


 When I run the above function line by line with the arguments from
 below, it works fine. But when I call it as function, I get this :

   rm( glmfit, formu, cv.err ) # cleanup if required
   logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )

 logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )
 [1] glmfit is OK
 Error in model.frame(formula = formu, data = data[j.in, , drop =
 FALSE],  :
   Object formu not found


 I think this has something to do with formula and environments but I do
 not know enough to solve it myself. I searched the archive without much
 help (perhaps I was using the wrong keywords).

 Any help would be very much appreciated. Thank you.

 Regards,
 -- 
 Adaikalavan Ramasamy[EMAIL PROTECTED]
 Centre for Statistics in Medicine   http://www.ihs.ox.ac.uk/csm/
 Wolfson College Annexe  Tel : 01865 284 408
 Linton Road, Oxford OX2 6UD Fax : 01865 284 424

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] Plot zooming i.e. changing ylim according to xlim

2005-07-26 Thread Petr Pikal
Well
 here is the better shot

x - seq(0,20)
y - exp(-x)
plot(x,y, type=l)
intervalx-c(19,20)
intervaly-y[x%in%intervalx]
plot(x,y, xlim=range(intervalx), ylim=range(intervaly), type=l)
 
HTH

Petr


On 26 Jul 2005 at 11:13, Henrik Andersson wrote:

 Dear R-gurus,
 
 I would like to zoom in a plot, e.g. I select a region on the 
 x-axis and 
 then I would like the ranges on the y-axis to change accordingly.
 
 Is it possible to do this with existing functions, or do I have to
 invent some data selection before plotting?
 
 See below a short example, where I select ylim with trial and error,
  which I want to avoid.
 Mulholland, Tom wrote:
   Search the archives for zoom and you will find plenty of answers on
  
 this question.
  
   RSiteSearch(zoom)
  
   Tom
 
 I looked there already, but I could only find interactive zooming,
 which 
   is also nice, but I want a non-interactive function that
   automagically 
 changes the y-axis to fit only the data specified in the part of the
 x-axis, or the other way around. I guess that was not very clear from
 my first post.
 
 - Henrik
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


[R] sort a table

2005-07-26 Thread [EMAIL PROTECTED]
hi all,

I need to sort a table like this one:

n tmp s
1 215 0
2 654 1
3 213 0
4 569 1
5 954 1
6 562 1
7 252 0
8 555 0
9 988 1

I want to organize it with tmp increasing to produce the same tab but ordered 
by tmp

I think it is simple but just show me how good you are in R ...

thks
guillaume.


// Webmail Oreka : http://www.oreka.com


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


Re: [R] sort a table

2005-07-26 Thread Henrik Andersson
[EMAIL PROTECTED] wrote:
 hi all,
 
 I need to sort a table like this one:
 
 n tmp s
 1 215 0
 2 654 1
 3 213 0
 4 569 1
 5 954 1
 6 562 1
 7 252 0
 8 555 0
 9 988 1
 
test - read.table(clipboard,header=T)
test[order(test$tmp),]
   n tmp s
3 3 213 0
1 1 215 0
7 7 252 0
8 8 555 0
6 6 562 1
4 4 569 1
2 2 654 1
5 5 954 1
9 9 988 1


Happy?

Cheers, Henrik Andersson

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


[R] problem with Hershey fonts

2005-07-26 Thread Ray Brownrigg
This was reported to me by a colleague in China, so I may not be
reproducing exactly what they are seeing (which I suspect is rw2011), but
this is what I see:
 version
 _
platform i386--netbsdelf
arch i386
os   netbsdelf
system   i386, netbsdelf
status
major2
minor1.1
year 2005
month06
day  20
language R
 help(Hershey)
:
:
 If the 'vfont' argument to one of the text-drawing functions
 ('text', 'mtext', 'title', 'axis', and 'contour') is a character
 vector of length 2, Hershey vector fonts are used to render the
 text.
:
  The other useful escape sequences all begin with '\\'.  These
  are described below. Remember that backslashes have to be
  doubled in R character strings, so they need to be entered
  with _four_ backslashes.
:
:
 plot(runif(100))  # to get something on the screen
 text(0, 1, '\\Re', vfont=c('serif', 'plain')) # works
 title(main = '\\Re', vfont=c('serif','plain'))# doesn't work, and...
Warning message:
parameter vfont could not be set in high-level plot() function
 mtext('\\Re', 2, vfont=c('serif','plain'))# doesn't work, but...
Warning message:
Hershey fonts not yet implemented for mtext() in: mtext(text, side, line, 
outer, at, adj, padj, cex, col, font,
 axis(3, at=50, tick=F, labels='\\Re', vfont=c('serif','plain'))   # 
 doesn't work 

Now at least mtext() 'redeems' itself with its Warning, but title()
contradicts the help(Hershey), and axis() just gets it wrong by printing
the characters \Re (or \\Re when the string is specified as
'Re' as alluded to in the Hershey documentation - but somewhat
contradicted by the success of the text() call above).

Now perhaps the problem is just with the Hershey documentation (or my
reading of it), but I don't know what is supposed to work.  Or is there
some combination that I haven't tried?

Ray Brownrigg

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


Re: [R] passing formula arguments cv.glm

2005-07-26 Thread Adaikalavan Ramasamy
Dear Prof. Ripley,

Thank you for your response. See below for my comments.


On Tue, 2005-07-26 at 10:57 +0100, Prof Brian Ripley wrote:
 Adai,

 using traceback() helps, as does giving a reproducible example when 
 reporting a problem.

You are right. The traceback below indicates that your guess is correct.

 10: model.frame(formula = formu, data = data[j.in, , drop = FALSE],  
 drop.unused.levels = TRUE)


The example is actually reproducible but you need the load the boot
package first (which I failed to mention).

 However, the problem is I think the line
 
  d.glm - update(glmfit, data = data[j.in, , drop = FALSE])
 
 in cv.glm.  I think that should be
 
  d.glm - eval.parent(update(glmfit,
  data = data[j.in, , drop = FALSE], evaluate = FALSE))
 
 as in add.default and many other places.
 
 Could you please confirm that is the cause?

I believe this is the cause but the fix may need bit more tweaking. I
get the following error message with your fix.

 Error in [.data.frame(data, j.in, , drop = FALSE) : 
Object j.in not found

The traceback gives the final same output as original one but this is
numbered at 12 instead. Could it be because j.in is created within the
for() loop environment ? I do not know how to fix this and would
appreciate any help. 

For your convenience, you can find the script with your current fix at
the following URL www.cbrg.ox.ac.uk/~ramasamy/cv.glm2.R

Thank you very much. Much appreciated.

Regards, Adai


 Brian
 
 On Mon, 25 Jul 2005, Adaikalavan Ramasamy wrote:
 
  I am trying to write a wrapper for the last example in help(cv.glm) that
  deals with leave-one-out-cross-validation (LOOCV) for a logistic model.
  This wrapper will be used as part of a bigger program.
 
  Here is my wrapper funtion :
 
logistic.LOOCV.err - function( formu=NULL, data=NULL ){
 
  cost.fn - function(cl, pred) mean( abs(cl-pred)  0.5 )
 
  glmfit - glm( formula=formu, data=data, family=binomial )
  print(glmfit is OK)
 
  err- cv.glm( data=data, glmfit=glmfit,
cost=cost.fn, K=nrow(data) )$delta[2]
  print(cv.glm OK)
}
 
 
  When I run the above function line by line with the arguments from
  below, it works fine. But when I call it as function, I get this :
 
rm( glmfit, formu, cv.err ) # cleanup if required
logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )
 
  logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )
  [1] glmfit is OK
  Error in model.frame(formula = formu, data = data[j.in, , drop =
  FALSE],  :
  Object formu not found
 
 
  I think this has something to do with formula and environments but I do
  not know enough to solve it myself. I searched the archive without much
  help (perhaps I was using the wrong keywords).
 
  Any help would be very much appreciated. Thank you.
 
  Regards,
  -- 
  Adaikalavan Ramasamy[EMAIL PROTECTED]
  Centre for Statistics in Medicine   http://www.ihs.ox.ac.uk/csm/
  Wolfson College Annexe  Tel : 01865 284 408
  Linton Road, Oxford OX2 6UD Fax : 01865 284 424
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 


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


[R] any package to fit such model?

2005-07-26 Thread ronggui
I have search the internet but none are found.The lme function is like the proc 
mixed the SAS.But I know no package to fit the model described in
http://gsbwww.uchicago.edu/computing/research/SASManual/ets/chap20/sect17.htm

,which  fit with the proc tscs in SAS.

Thank you.

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

[R] OpenBSD and large R vectors

2005-07-26 Thread jon butchar
Is anyone running R on OpenBSD?  I've got R-2.1.1 installed on OpenBSD -current 
and have some microarray datasets that took ~1.4 GB RAM on FreeBSD (computer 
has 4 GB total, Pentium 4 system).  With FreeBSD, setting maxdsiz in 
/boot/loader.conf worked very well.

With OpenBSD, even after setting maxdsiz to ~1.8 GB for a new kernel and 
changing /etc/login.conf, R runs into memory problems and gives the could not 
allocate vector of... error.  Then R locks up and starts taking progressively 
more CPU time until it gets killed.  This is a stock R installation and a 
generic OpenBSD except for the altered MAXDSIZ in vmparam.h.  I'm guessing that 
these problems stem at least in part from OpenBSD's memory allocation safety 
mechanisms.  Still, are there any R or OpenBSD compile options / tweaks I can 
do to make things work?

Thanks,

jon butchar

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


Re: [R] passing formula arguments cv.glm

2005-07-26 Thread Prof Brian Ripley
On Tue, 26 Jul 2005, Adaikalavan Ramasamy wrote:

 Dear Prof. Ripley,

 Thank you for your response. See below for my comments.


 On Tue, 2005-07-26 at 10:57 +0100, Prof Brian Ripley wrote:
 Adai,

 using traceback() helps, as does giving a reproducible example when
 reporting a problem.

 You are right. The traceback below indicates that your guess is correct.

 10: model.frame(formula = formu, data = data[j.in, , drop = FALSE],
 drop.unused.levels = TRUE)


 The example is actually reproducible but you need the load the boot
 package first (which I failed to mention).

 However, the problem is I think the line

  d.glm - update(glmfit, data = data[j.in, , drop = FALSE])

 in cv.glm.  I think that should be

  d.glm - eval.parent(update(glmfit,
  data = data[j.in, , drop = FALSE], evaluate = FALSE))

 as in add.default and many other places.

 Could you please confirm that is the cause?

 I believe this is the cause but the fix may need bit more tweaking. I
 get the following error message with your fix.

 Error in [.data.frame(data, j.in, , drop = FALSE) :
   Object j.in not found

 The traceback gives the final same output as original one but this is
 numbered at 12 instead. Could it be because j.in is created within the
 for() loop environment ? I do not know how to fix this and would
 appreciate any help.

Ah, that needs a different fix, namely

 Call - glmfit$call
 Call$data - data[j.in, , drop=FALSE]
 d.glm - eval.parent(Call)

which works for me when I modify your script accordingly.  (You can take 
the first line outside the loop, for tidiness.)


 For your convenience, you can find the script with your current fix at
 the following URL www.cbrg.ox.ac.uk/~ramasamy/cv.glm2.R

 Thank you very much. Much appreciated.

 Regards, Adai


 Brian

 On Mon, 25 Jul 2005, Adaikalavan Ramasamy wrote:

 I am trying to write a wrapper for the last example in help(cv.glm) that
 deals with leave-one-out-cross-validation (LOOCV) for a logistic model.
 This wrapper will be used as part of a bigger program.

 Here is my wrapper funtion :

   logistic.LOOCV.err - function( formu=NULL, data=NULL ){

 cost.fn - function(cl, pred) mean( abs(cl-pred)  0.5 )

 glmfit - glm( formula=formu, data=data, family=binomial )
 print(glmfit is OK)

 err- cv.glm( data=data, glmfit=glmfit,
   cost=cost.fn, K=nrow(data) )$delta[2]
 print(cv.glm OK)
   }


 When I run the above function line by line with the arguments from
 below, it works fine. But when I call it as function, I get this :

   rm( glmfit, formu, cv.err ) # cleanup if required
   logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )

 logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )
 [1] glmfit is OK
 Error in model.frame(formula = formu, data = data[j.in, , drop =
 FALSE],  :
 Object formu not found


 I think this has something to do with formula and environments but I do
 not know enough to solve it myself. I searched the archive without much
 help (perhaps I was using the wrong keywords).

 Any help would be very much appreciated. Thank you.

 Regards,
 --
 Adaikalavan Ramasamy[EMAIL PROTECTED]
 Centre for Statistics in Medicine   http://www.ihs.ox.ac.uk/csm/
 Wolfson College Annexe  Tel : 01865 284 408
 Linton Road, Oxford OX2 6UD Fax : 01865 284 424

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





-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] grep help needed

2005-07-26 Thread John Fox
Dear Denis,

I don't believe that anyone fielded your question -- my apologies if I
missed a response.

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Denis Chabot
 Sent: Monday, July 25, 2005 9:46 PM
 To: R list
 Subject: [R] grep help needed
 
 Hi,
 
 In another thread (PBSmapping and shapefiles) I asked for 
 an easy way to read shapefiles and transform them in data 
 that PBSmapping could use. One person is exploring some ways 
 of doing this, but it is possible I'll have to do this manually.
 
 With package maptools I am able to extract the information 
 I need from a shapefile but it is formatted like this:
 
 [[1]]
 [,1] [,2]
 [1,] -55.99805 51.68817
 [2,] -56.00222 51.68911
 [3,] -56.01694 51.68911
 [4,] -56.03781 51.68606
 [5,] -56.04639 51.68759
 [6,] -56.04637 51.69445
 [7,] -56.03777 51.70207
 [8,] -56.02301 51.70892
 [9,] -56.01317 51.71578
 [10,] -56.00330 51.73481
 [11,] -55.99805 51.73840
 attr(,pstart)
 attr(,pstart)$from
 [1] 1
 
 attr(,pstart)$to
 [1] 11
 
 attr(,nParts)
 [1] 1
 attr(,shpID)
 [1] NA
 
 [[2]]
[,1] [,2]
 [1,] -57.76294 50.88770
 [2,] -57.76292 50.88693
 [3,] -57.76033 50.88163
 [4,] -57.75668 50.88091
 [5,] -57.75551 50.88169
 [6,] -57.75562 50.88550
 [7,] -57.75932 50.88775
 [8,] -57.76294 50.88770
 attr(,pstart)
 attr(,pstart)$from
 [1] 1
 
 attr(,pstart)$to
 [1] 8
 
 attr(,nParts)
 [1] 1
 attr(,shpID)
 [1] NA
 
 I do not quite understand the structure of this data object 
 (list of lists I think)

Actually, it looks like a list of matrices, each with some attributes
(which, I gather, aren't of interest to you).

 but at this point I resorted to 
 printing it on the console and imported that text into Excel 
 for further cleaning, which is easy enough. I'd like to 
 complete the process within R to save time and to circumvent 
 Excel's limit of around 64000 lines. But I have a hard time 
 figuring out how to clean up this text in R.
 

If I understand correctly what you want, this seems a very awkward way to
proceed. Why not just extract the matrices from the list, stick on the
additional columns that you want, stick the matrices together, name the
columns, and then output the data to a file?

M1 - Data[[1]]  # assuming that the original list is named Data
M2 - Data[[2]]
M1 - cbind(1, 1:nrow(M1), M1)
M2 - cbind(2, 1:nrow(M2), M2)
M - rbind(M1, M2)
colnames(M) - c(PID, POS, X, Y)
write.table(M, Data.txt, row.names=FALSE, quote=FALSE)

It wouldn't be hard to generalize this to any number of matrices and to
automate the process.

I hope that this helps,
 John

 What I need to produce for PBSmapping is a file where each 
 block of coordinates shares one ID number, called PID, and a 
 variable POS indicates the position of each coordinate within 
 a shape. All other lines must disappear. So the above would become:
 
 PID POS X Y
 1 1 -55.99805 51.68817
 1 2 -56.00222 51.68911
 1 3 -56.01694 51.68911
 1 4 -56.03781 51.68606
 1 5 -56.04639 51.68759
 1 6 -56.04637 51.69445
 1 7 -56.03777 51.70207
 1 8 -56.02301 51.70892
 1 9 -56.01317 51.71578
 1 10 -56.00330 51.73481
 1 11 -55.99805 51.73840
 2 1 -57.76294 50.88770
 2 2 -57.76292 50.88693
 2 3 -57.76033 50.88163
 2 4 -57.75668 50.88091
 2 5 -57.75551 50.88169
 2 6 -57.75562 50.88550
 2 7 -57.75932 50.88775
 2 8 -57.76294 50.88770
 
 First I imported this text file into R:
 test - read.csv2(test file.txt,header=F, sep=;, colClasses =
 character)
 
 I used sep=; to insure there would be only one variable in 
 this file, as it contains no ;
 
 To remove lines that do not contain coordinates, I used the 
 fact that longitudes are expressed as negative numbers, so 
 with my very limited knowledge of grep searches, I thought of 
 this, which is probably not the best way to go:
 
 a - rep(-, length(test$V1))
 b - grep(a, test$V1)
 
 this gives me a warning (Warning message:
 the condition has length  1 and only the first element will be used
 in: if (is.na(pattern)) {
 but seems to do what I need anyway
 
 c - seq(1, length(test$V1))
 d - c %in% b
 
 e - test$V1[d]
 
 Partial victory, now I only have lines that look like [1,] 
 -57.76294 50.88770
 
 But I don't know how to go further: the number in square 
 brackets can be used for variable POS, after removing the 
 square brackets and the comma, but this requires a better 
 knowledge of grep than I have.  
 Furthermore, I don't know how to add a PID (polygon ID) 
 variable, i.e. all lines of a polygon must have the same ID, 
 as in the example above (i.e. each time POS == 1, a new 
 polygon starts and PID needs to be incremented by 1, and PID 
 is kept constant for lines where POS ! 1).
 
 Any help will be much appreciated.
 
 Sincerely,
 
 Denis Chabot

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


[R] text on some lines

2005-07-26 Thread Navarre Sabine
Hi,
 
I would like to write text on 2 lines for example.
For example, if you have a long sentence and you want to cut it at the 45 
caracter and put the continuation underneath!
Is it possible?
 
Thanks
 
Sabine


-


[[alternative HTML version deleted]]

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


Re: [R] text on some lines

2005-07-26 Thread Uwe Ligges
Navarre Sabine wrote:

 Hi,
  
 I would like to write text on 2 lines for example.
 For example, if you have a long sentence and you want to cut it at the 45 
 caracter and put the continuation underneath!
 Is it possible?

Do you mean for output to console / in plots?
Simply insert a \n (newline), for example.

Uwe Ligges


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

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


Re: [R] text on some lines

2005-07-26 Thread ronggui
 plot(1:10,type=n)
 title(main=cut in the 45 char \n new line)
pay attention to the \n,which means new line.
is it what you want?


=== 2005-07-26 21:59:04 您在来信中写道:===

Hi,
 
I would like to write text on 2 lines for example.
For example, if you have a long sentence and you want to cut it at the 45 
caracter and put the continuation underneath!
Is it possible?
 
Thanks
 
Sabine

   
-


   [[alternative HTML version deleted]]

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

= = = = = = = = = = = = = = = = = = = =



 

2005-07-26

--
Deparment of Sociology
Fudan University

Blog:http://sociology.yculblog.com

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

[R] Association rules

2005-07-26 Thread Sophie Tricaud-Vialle
Hello !

I just start in using R, and I have already questions...

I want to use the arules package : I have installed the package, and have
the arules package 's reference manual, but I haven't yet understood how to
use it.

I have my data (from Excel, .txt), that I have read on R : I think (hope !)
it's ok
Then, what must I do first to analyse my data (to identify the association
rules) ? I suppose I have to transform my file, but how ? Which commands
must I use to ?

Thanks for all !

Sophie !

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


Re: [R] text on some lines

2005-07-26 Thread Prof Brian Ripley
On Tue, 26 Jul 2005, Uwe Ligges wrote:

 Navarre Sabine wrote:

 I would like to write text on 2 lines for example.
 For example, if you have a long sentence and you want to cut it
 at the 45 caracter and put the continuation underneath!
 Is it possible?

 Do you mean for output to console / in plots?
 Simply insert a \n (newline), for example.

And strwrap() will help you insert it in the right place, e.g.

 x - For example, if you have a long sentence and you want to cut it at the 
 45 caracter and put the continuation underneath!
 strwrap(x, 45)
[1] For example, if you have a long sentence
[2] and you want to cut it at the 45 caracter
[3] and put the continuation underneath!
 paste(strwrap(x, 45), collapse=\n)
[1] For example, if you have a long sentence\nand you want to cut it at the 45 
caracter\nand put the continuation underneath!

the latter for use when plotting.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] Association rules

2005-07-26 Thread ronggui
library(foreign)
in the foreign package,you can use read.csv command to read the csv file.you 
can use excel to open the file and save as cvs file.you should read the manuals 
first,which tells in details how to import your data into R.

before you use the command frome the arules package,you should first type the 
command
library(arules)


=== 2005-07-26 22:18:48 您在来信中写道:===

Hello !

I just start in using R, and I have already questions...

I want to use the arules package : I have installed the package, and have
the arules package 's reference manual, but I haven't yet understood how to
use it.

I have my data (from Excel, .txt), that I have read on R : I think (hope !)
it's ok
Then, what must I do first to analyse my data (to identify the association
rules) ? I suppose I have to transform my file, but how ? Which commands
must I use to ?

Thanks for all !

Sophie !

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

= = = = = = = = = = = = = = = = = = = =



 

2005-07-26

--
Deparment of Sociology
Fudan University

Blog:http://sociology.yculblog.com

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

Re: [R] passing formula arguments cv.glm

2005-07-26 Thread Adaikalavan Ramasamy
It works ! Thank you very much. 

Can I request this fix in the next version of boot package please if it
is likely not to break compatibility with other functions. The modified
cv.glm function can be found at www.cbrg.ox.ac.uk/~ramasamy/cv.glm2.R

Thank you again.

Regards, Adai



On Tue, 2005-07-26 at 13:06 +0100, Prof Brian Ripley wrote:
 On Tue, 26 Jul 2005, Adaikalavan Ramasamy wrote:
 
  Dear Prof. Ripley,
 
  Thank you for your response. See below for my comments.
 
 
  On Tue, 2005-07-26 at 10:57 +0100, Prof Brian Ripley wrote:
  Adai,
 
  using traceback() helps, as does giving a reproducible example when
  reporting a problem.
 
  You are right. The traceback below indicates that your guess is correct.
 
  10: model.frame(formula = formu, data = data[j.in, , drop = FALSE],
  drop.unused.levels = TRUE)
 
 
  The example is actually reproducible but you need the load the boot
  package first (which I failed to mention).
 
  However, the problem is I think the line
 
   d.glm - update(glmfit, data = data[j.in, , drop = FALSE])
 
  in cv.glm.  I think that should be
 
   d.glm - eval.parent(update(glmfit,
   data = data[j.in, , drop = FALSE], evaluate = FALSE))
 
  as in add.default and many other places.
 
  Could you please confirm that is the cause?
 
  I believe this is the cause but the fix may need bit more tweaking. I
  get the following error message with your fix.
 
  Error in [.data.frame(data, j.in, , drop = FALSE) :
  Object j.in not found
 
  The traceback gives the final same output as original one but this is
  numbered at 12 instead. Could it be because j.in is created within the
  for() loop environment ? I do not know how to fix this and would
  appreciate any help.
 
 Ah, that needs a different fix, namely
 
  Call - glmfit$call
  Call$data - data[j.in, , drop=FALSE]
  d.glm - eval.parent(Call)
 
 which works for me when I modify your script accordingly.  (You can take 
 the first line outside the loop, for tidiness.)
 
 
  For your convenience, you can find the script with your current fix at
  the following URL www.cbrg.ox.ac.uk/~ramasamy/cv.glm2.R
 
  Thank you very much. Much appreciated.
 
  Regards, Adai
 
 
  Brian
 
  On Mon, 25 Jul 2005, Adaikalavan Ramasamy wrote:
 
  I am trying to write a wrapper for the last example in help(cv.glm) that
  deals with leave-one-out-cross-validation (LOOCV) for a logistic model.
  This wrapper will be used as part of a bigger program.
 
  Here is my wrapper funtion :
 
logistic.LOOCV.err - function( formu=NULL, data=NULL ){
 
  cost.fn - function(cl, pred) mean( abs(cl-pred)  0.5 )
 
  glmfit - glm( formula=formu, data=data, family=binomial )
  print(glmfit is OK)
 
  err- cv.glm( data=data, glmfit=glmfit,
cost=cost.fn, K=nrow(data) )$delta[2]
  print(cv.glm OK)
}
 
 
  When I run the above function line by line with the arguments from
  below, it works fine. But when I call it as function, I get this :
 
rm( glmfit, formu, cv.err ) # cleanup if required
logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )
 
  logistic.LOOCV.err( formu=as.formula(r~stage+xray+acid), data=nodal )
  [1] glmfit is OK
  Error in model.frame(formula = formu, data = data[j.in, , drop =
  FALSE],  :
Object formu not found
 
 
  I think this has something to do with formula and environments but I do
  not know enough to solve it myself. I searched the archive without much
  help (perhaps I was using the wrong keywords).
 
  Any help would be very much appreciated. Thank you.
 
  Regards,
  --
  Adaikalavan Ramasamy[EMAIL PROTECTED]
  Centre for Statistics in Medicine   http://www.ihs.ox.ac.uk/csm/
  Wolfson College Annexe  Tel : 01865 284 408
  Linton Road, Oxford OX2 6UD Fax : 01865 284 424
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 
 
 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


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


Re: [R] passing formula arguments cv.glm

2005-07-26 Thread Prof Brian Ripley
On Tue, 26 Jul 2005, Adaikalavan Ramasamy wrote:

 It works ! Thank you very much.

 Can I request this fix in the next version of boot package please if it
 is likely not to break compatibility with other functions. The modified
 cv.glm function can be found at www.cbrg.ox.ac.uk/~ramasamy/cv.glm2.R

Yes, it will be there if it survives enough tests.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] SETAR Estimation

2005-07-26 Thread ekhous
Dear R-helpers,

I was wondering if anyone has or knows someone who might have an implementation
of algorithm for estimating SETAR models including the lag-order. For some
reason my code gives me a bit wrong results. I am fighting with it for a week
and cannot bring it down.
Thanks a million in advance,
Sincerely,

Evgueni

McGill University
Department of Economics

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


[R] farimaSim

2005-07-26 Thread Hansi Weissensteiner
Hello!

I installed the fSeries package to get some farima time-series which i tried
with farimaSim, but unfortunately i got always an error. I tried it this way:

 farimaSim(n = 1000, model = list(ar = 0.5,  d = 0.3, ma = 0.1), method=freq)

Error in farimaSim(n = 1000, model = list(ar = 0.5, d = 0.3, ma = 0.1),  :
 ... used in an incorrect context

Some ideas?

Regards,

___
 _ /_|_|   Hansi Weissensteiner
/o\__/O\=  [EMAIL PROTECTED]

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


[R] Assign new observations to Clara clusters

2005-07-26 Thread Nestor Fernandez
Dear all,

I need to assign new observations to cluster groups previously identified for a
different dataset. The original clustering was performed using Clara. I gess
one way is to assign each new observation to the nearest medioid of the
original cluster. Is there a way of doing this in R? Is there a better way of
classifying new observations into clusters?

Thanks a lot,

Nestor

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


Re: [R] Assign new observations to Clara clusters

2005-07-26 Thread Prof Brian Ripley
On Tue, 26 Jul 2005, Nestor Fernandez wrote:

 Dear all,

 I need to assign new observations to cluster groups previously identified for 
 a
 different dataset. The original clustering was performed using Clara. I gess
 one way is to assign each new observation to the nearest medioid of the
 original cluster. Is there a way of doing this in R? Is there a better way of
 classifying new observations into clusters?

If you have the medoids (and these are in the fit object), use knn1 (in 
package class) to assign.

Cluster analysis is not really designed to classify new observations. 
With Euclidean distance the above is possible, but I would probably take 
the clusters formed and used them to do a supervised classification: your 
default option is edited NN-1 classification and you may well be able to 
do better, depending on the size of the problem.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] Compute dissimilarity matrix for ordinal data

2005-07-26 Thread Werner Bier

Dear All,

I have been trying to use the daisy routine to compute the dissimilarity matrix 
but I have not been successful in defining the data as ordinal.

Might you kindly help me please?

Thanks in advance and best regards,

Tom

 


__



[[alternative HTML version deleted]]

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


Re: [R] farimaSim

2005-07-26 Thread Martin Maechler
 Hansi == Hansi Weissensteiner [EMAIL PROTECTED]
 on Tue, 26 Jul 2005 17:40:45 +0200 writes:

Hansi Hello!  I installed the fSeries package to get some
Hansi farima time-series which i tried with farimaSim, but
Hansi unfortunately i got always an error. I tried it this
Hansi way:

 farimaSim(n = 1000, model = list(ar = 0.5, d = 0.3, ma =
 0.1), method=freq)

Hansi Error in farimaSim(n = 1000, model = list(ar = 0.5, d
Hansi = 0.3, ma = 0.1), : ... used in an incorrect context

Hansi Some ideas?

Yes, the function farimaSim() is bogous, pretty obviously if you look
at it. 

I've wondered for a while if we (R developers) shouldn't
improve R CMD check so as to require that every exported
function in a package must have at least one running example.
For the farimaSim(), there is no call possible without an error
message.

Package 'fracdiff', though much older,  has a working
fracdiff.sim() function.

Martin Maechler, ETH Zurich

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


[R] plotting horizontally

2005-07-26 Thread dkf

Hello,

Is there any way to use plot() horizontally similar to
boxplot(., horiz=TRUE)?  I want to use to illustrate
the distribution of y-values on an adjacent plot using
layout().

Thanks in advance for any help.

Regards,

--Dan

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


Re: [R] any package to fit such model?

2005-07-26 Thread Spencer Graves
  Have you looked at ?lm, including the examples?  The link in your
email described a standard one-way, fixed effects ANOVA, and the lm
help page includes a worked example for that.

  spencer graves

ronggui wrote:

 I have search the internet but none are found.The lme function is like the 
 proc mixed the SAS.But I know no package to fit the model described in
 http://gsbwww.uchicago.edu/computing/research/SASManual/ets/chap20/sect17.htm
 
 ,which  fit with the proc tscs in SAS.
 
 Thank you.
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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

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


[R] draw ellipse of equal concentration

2005-07-26 Thread Salvatore Ingrassia
Dear all,

do you know some routines to draw ellipses and its axes given the algebraic
equation?  The application is to draw ellipses of equal concentration for
bivariate normal distribution given the vector mean and the covariance matrix.

Thank you. Sincerely, Salvatore Ingrassia



*
Prof. Salvatore Ingrassia
Dipartimento di Economia e Statistica
Facoltà di Economia
Universita' della Calabria   
87036 Arcavacata di Rende (CS), Italy   
 
Tel. +39 0984 492432Fax +39 0984 492421
e-mail: [EMAIL PROTECTED]  
http://www.ecostat.unical.it/Ingrassia/
*

[[alternative HTML version deleted]]

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

Re: [R] draw ellipse of equal concentration

2005-07-26 Thread Duncan Murdoch
On 7/26/2005 1:49 PM, Salvatore Ingrassia wrote:
 Dear all,
 
 do you know some routines to draw ellipses and its axes given the algebraic
 equation?  The application is to draw ellipses of equal concentration for
 bivariate normal distribution given the vector mean and the covariance matrix.

The ellipse package can draw ellipses.

Duncan Murdoch

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


[R] tapply t.test

2005-07-26 Thread mark salsburg
I cannot find in the literature a way to conduct the following t.test
on 2 objects, A and B

A   B
col1 col2 col3  col1 col2  col3

Where col(i)'s name is identical in both A and B (they are names of tissues).

How do I test (t.test) if each tissue across the object is
signifanctly different?? (i'm pretty sure I have to use tapply())


Also is there a way to multi plot all 89 tissues showing the A values
and the B values..

thank you

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


[R] FFT post-processing

2005-07-26 Thread Pete Cap
List,
 
Can anyone point me at a user guide for doing signals processing after applying 
the FFT?

I'm looking for some info on postprocessing steps, trying to see if there are 
any packages already written, etc.
 
TIA,
 
Pete

__



[[alternative HTML version deleted]]

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


Re: [R] cluster

2005-07-26 Thread Christian Hennig
Dear Weiwei,

your question sounds a bit too general and complicated for the R-list.
Perhaps you should look for personal statistical advice.
The quality of methods (and especially distance choice) for down-sampling
ceratinly depends on the structure of the data set. I do not see at the moment 
why
you need any down-sampling at all, and you should find out first if and
why it's a good thing to do (by whatever method).

An obvious candidate for a clustering algorithm would be pam/clara in
package cluster, because this approach chooses points already in the data
set as cluster centroids (and produces therefore a proper subsample),
which does not apply to most other clustering methods.

However, in
 C. Hennig and L. J. Latecki:  The choice of vantage objects for image
retrieval.  Pattern Recognition 36 (2003), 2187-2196.
the clustering approach has been clearly outperformed by some stepwise
selection approaches for down-sampling - admittedly in a different kind of
problem, but I think that the reasons for this may apply also to your
situation,

You can compare different clusterings (or choices of a subset) by
cross-validation or
bootstrap applied to the resulting decision tree in the classification
problem.

Best,
Christian


On Mon, 25 Jul 2005, Weiwei Shi wrote:

 Dear listers:

 Here I have a question on clustering methods available in R. I am
 trying to down-sampling the majority class in a classification problem
 on an imbalanced dataset. Since I don't want to lose information in
 the original dataset, I don't want to use naive down-sampling: I think
 using clustering on the majority class' side to select
 representative samples might help. So, my question is, which
 clustering method should be tested to get the best result. I think the
 key thing might be the selection of distance considering the next
 step in which I would like to use  decision trees.

 Please share your experience in using clustering (Any available
 implementation outside R is also welcome)

 weiwei
 --
 Weiwei Shi, Ph.D

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

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


*** NEW ADDRESS! ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
[EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche

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


Re: [R] alaska map?

2005-07-26 Thread Greg Snow
Look at:

http://www.census.gov/geo/www/cob/bdy_files.html

There are shapefiles of the 50 states there, outlines, counties, and
others. 



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

 Caitlin Burgess [EMAIL PROTECTED] 07/25/05 01:37PM 
Hello,

I've installed the Becker and Wilks maps, mapdata, and mapproj
packages
so I can begin to try these out for some work I need to do on a map of
Alaska but I don't know where to find a map of Alaska. Has anyone
solved
this already and could help?

Thanks very much in advance,

Caitlin

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

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


[R] error with scan

2005-07-26 Thread Jean-Pierre Gattuso
Hi:

I am trying to read a large (50+ lines) with scan() as read.table  
is unable to read it.

I get a strange error (below) which says that 'a real' was expected  
and '5' was read. Can someone help?

Thanks,
jp

  type=list(a=0,b=0,c=0,d=0,e=0,f=,g=0,h=0,i=0)
  tmp2 - scan(file=tmp2.txt, what=type, sep=,, quote=\,  
dec=., skip=1, nmax=541502)
Erreur dans scan(file = tmp2.txt, what = type, sep = ,, quote =  
\,  :
 scan() attendait 'a real' et a reçu '5'

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


[R] T test across tissues

2005-07-26 Thread mark salsburg
I cannot find in the literature a way to conduct the following t.test
on 2 objects, A and B

A   B
col1 col2 col3  col1 col2  col3

Where col(i)'s name is identical in both A and B (they are names of tissues).

How do I test (t.test) if each tissue across the object is
signifanctly different?? (i'm pretty sure I have to use tapply())


Also is there a way to multi plot all 89 tissues showing the A values
and the B values..

thank you

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


Re: [R] Plot zooming i.e. changing ylim according to xlim

2005-07-26 Thread Deepayan Sarkar
On 7/26/05, Henrik Andersson [EMAIL PROTECTED] wrote:
 Dear R-gurus,
 
 I would like to zoom in a plot, e.g. I select a region on the x-axis and
 then I would like the ranges on the y-axis to change accordingly.
 
 Is it possible to do this with existing functions, or do I have to
 invent some data selection before plotting?
 
 See below a short example, where I select ylim with trial and error,
 which I want to avoid.
 
 Cheers, Henrik Andersson
 
 ## Example -- in reality more numbers, no function
 x - seq(0,20)
 y - exp(-x)
 
 plot(y~x,type='l')
 
 ## Zoom in the end, to see what's happenning
 
 plot(y~x,type='l',xlim=c(19,20))

I tend to use constructs like 

plot(y~x,type='l', subset = x  15)

(18 is not very interesting).

Deepayan

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


[R] a question about fft ( fast fourier transform)

2005-07-26 Thread lma5

Dear listers

 In R, if I have a sequence x(t), t=1,...N, fft(x) is actually giving us
sum(x(t)exp(-i*omega*t)) at fourier frequency omega= 2*pi*i/N,
i=0,1,...(N-1).

The question is if I want to calculate sum(x(t)exp(-i*2*omega*t)), how can
I do it?
thanks a lot!


---
liyun (Lauren) Ma
Dept of Statistics
North Carolina State University

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


[R] Help on T test

2005-07-26 Thread mark salsburg
ok I created a matrix C with 

A   B  CA1   B1C1
..
.

the columns contain the gene expression values..

I ran the following t.test:

apply(C, 1, function(x) t.test( x[1:3], x[4,6] )$p.value )

which outputs out 16063 pvalues (the number of rows)

I just want to output 3 pvalues showing if A's column is different from A1 etc..

any help would be great.. thank you..

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


Re: [R] grep help needed

2005-07-26 Thread Denis Chabot
Thanks for your help, the proposed solutions were much more elegant  
than what I was attempting. I adopted a slight modification of Tom  
Mulholland's solution with a piece from John Fox's solution, but many  
of you had very similar solutions.

require(maptools)
nc - read.shape(system.file(shapes/sids.shp, package = maptools) 
[1])
mappolys - Map2poly(nc, as.character(nc$att.data$FIPSNO))
selected.shapes - which(nc$att.data$SID74  20)
# just to make it a smaller example
submap - subset(mappolys, nc$att.data$SID74  20)

final.data - NULL
for (j in 1:length(selected.shapes)){
 temp.verts - matrix(as.vector(submap[[j]]),ncol = 2)
 n - length(temp.verts[,1])
 temp.order - 1:n
 temp.data - cbind(rep(j,n),temp.order,temp.verts)
 final.data - rbind(final.data,temp.data)
 }
colnames(final.data) - c(PID, POS, X, Y)
final.data
my.data - as.data.frame(final.data)
class(my.data) - c(PolySet, data.frame)
attr(my.data, projection) - LL

meta - nc[2]$att.data[selected.shapes,]
PID - seq(1,length(submap))
meta.data - cbind(PID, meta)
class(meta.data) - c(PolyData, data.frame)
attr(meta.data, projection) - LL

It would be nice if a variant of this was incorporated into  
PBSmapping to make it easier to import data from shapefiles!

Thanks again for your help,

Denis Chabot
Le 05-07-26 à 00:48, Mulholland, Tom a écrit :

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Denis Chabot
 Sent: Tuesday, 26 July 2005 10:46 AM
 To: R list
 Subject: [R] grep help needed


 Hi,

 In another thread (PBSmapping and shapefiles) I asked for an easy
 way to read shapefiles and transform them in data that PBSmapping
 could use. One person is exploring some ways of doing this,
 but it is
 possible I'll have to do this manually.

 With package maptools I am able to extract the information I need
 from a shapefile but it is formatted like this:

 [[1]]
 [,1] [,2]
 [1,] -55.99805 51.68817
 [2,] -56.00222 51.68911
 [3,] -56.01694 51.68911
 [4,] -56.03781 51.68606
 [5,] -56.04639 51.68759
 [6,] -56.04637 51.69445
 [7,] -56.03777 51.70207
 [8,] -56.02301 51.70892
 [9,] -56.01317 51.71578
 [10,] -56.00330 51.73481
 [11,] -55.99805 51.73840
 attr(,pstart)
 attr(,pstart)$from
 [1] 1

 attr(,pstart)$to
 [1] 11

 attr(,nParts)
 [1] 1
 attr(,shpID)
 [1] NA

 [[2]]
[,1] [,2]
 [1,] -57.76294 50.88770
 [2,] -57.76292 50.88693
 [3,] -57.76033 50.88163
 [4,] -57.75668 50.88091
 [5,] -57.75551 50.88169
 [6,] -57.75562 50.88550
 [7,] -57.75932 50.88775
 [8,] -57.76294 50.88770
 attr(,pstart)
 attr(,pstart)$from
 [1] 1

 attr(,pstart)$to
 [1] 8

 attr(,nParts)
 [1] 1
 attr(,shpID)
 [1] NA

 I do not quite understand the structure of this data object (list of
 lists I think)
 but at this point I resorted to printing it on the console and
 imported that text into Excel for further cleaning, which is easy
 enough. I'd like to complete the process within R to save
 time and to
 circumvent Excel's limit of around 64000 lines. But I have a hard
 time figuring out how to clean up this text in R.

 What I need to produce for PBSmapping is a file where each block of
 coordinates shares one ID number, called PID, and a variable POS
 indicates the position of each coordinate within a shape.
 All other
 lines must disappear. So the above would become:

 PID POS X Y
 1 1 -55.99805 51.68817
 1 2 -56.00222 51.68911
 1 3 -56.01694 51.68911
 1 4 -56.03781 51.68606
 1 5 -56.04639 51.68759
 1 6 -56.04637 51.69445
 1 7 -56.03777 51.70207
 1 8 -56.02301 51.70892
 1 9 -56.01317 51.71578
 1 10 -56.00330 51.73481
 1 11 -55.99805 51.73840
 2 1 -57.76294 50.88770
 2 2 -57.76292 50.88693
 2 3 -57.76033 50.88163
 2 4 -57.75668 50.88091
 2 5 -57.75551 50.88169
 2 6 -57.75562 50.88550
 2 7 -57.75932 50.88775
 2 8 -57.76294 50.88770

 First I imported this text file into R:
 test - read.csv2(test file.txt,header=F, sep=;, colClasses =
 character)

 I used sep=; to insure there would be only one variable in this
 file, as it contains no ;

 To remove lines that do not contain coordinates, I used the
 fact that
 longitudes are expressed as negative numbers, so with my very
 limited
 knowledge of grep searches, I thought of this, which is probably not
 the best way to go:

 a - rep(-, length(test$V1))
 b - grep(a, test$V1)

 this gives me a warning (Warning message:
 the condition has length  1 and only the first element will be used
 in: if (is.na(pattern)) {
 but seems to do what I need anyway

 c - seq(1, length(test$V1))
 d - c %in% b

 e - test$V1[d]

 Partial victory, now I only have lines that look like
 [1,] -57.76294 50.88770

 But I don't know how to go further: the number in square
 brackets can
 be used for variable POS, after removing the square brackets and the
 comma, but this requires a better knowledge of grep than I have.
 Furthermore, I don't know how to add a PID (polygon ID) variable,
 i.e. all lines of a polygon must have the same ID, as in the example
 above (i.e. each 

Re: [R] cluster

2005-07-26 Thread Weiwei Shi
Dear Chris:

You are right and It IS too general. I think I should ask like what
kind of cluster algorithms or functions are available in R , which
might be easier. But for that, I probably can google or use help() in
R to find out. I want to know more about the performance of clustering
on this kind of problems and hope someone can share previous experince
if he/she had similar situation or problems before. And I will share
my experience later :)

As to the reason of using downsampling here, it is one fo the
straightforward ways to deal with imbalanced data classification
problem. In my understanding of classification problems, among others,
two things are important: feature construction/selection and sample
selection. I had an idea (which might be discovered by others) that
finding the best subset of features in clustering (to get highest
inter-cluster dissimilarities and the largest intra-cluster
similarity) might help the next classification process. I quickly read
through the abstract of your paper and I think your approach here is
applying feature selection (use p instead of n), while here, in my
proposal, I would like to try both.

thanks for further advice!

weiwei

On 7/26/05, Christian Hennig [EMAIL PROTECTED] wrote:
 Dear Weiwei,
 
 your question sounds a bit too general and complicated for the R-list.
 Perhaps you should look for personal statistical advice.
 The quality of methods (and especially distance choice) for down-sampling
 ceratinly depends on the structure of the data set. I do not see at the 
 moment why
 you need any down-sampling at all, and you should find out first if and
 why it's a good thing to do (by whatever method).
 
 An obvious candidate for a clustering algorithm would be pam/clara in
 package cluster, because this approach chooses points already in the data
 set as cluster centroids (and produces therefore a proper subsample),
 which does not apply to most other clustering methods.
 
 However, in
  C. Hennig and L. J. Latecki:  The choice of vantage objects for image
 retrieval.  Pattern Recognition 36 (2003), 2187-2196.
 the clustering approach has been clearly outperformed by some stepwise
 selection approaches for down-sampling - admittedly in a different kind of
 problem, but I think that the reasons for this may apply also to your
 situation,
 
 You can compare different clusterings (or choices of a subset) by
 cross-validation or
 bootstrap applied to the resulting decision tree in the classification
 problem.
 
 Best,
 Christian
 
 
 On Mon, 25 Jul 2005, Weiwei Shi wrote:
 
  Dear listers:
 
  Here I have a question on clustering methods available in R. I am
  trying to down-sampling the majority class in a classification problem
  on an imbalanced dataset. Since I don't want to lose information in
  the original dataset, I don't want to use naive down-sampling: I think
  using clustering on the majority class' side to select
  representative samples might help. So, my question is, which
  clustering method should be tested to get the best result. I think the
  key thing might be the selection of distance considering the next
  step in which I would like to use  decision trees.
 
  Please share your experience in using clustering (Any available
  implementation outside R is also welcome)
 
  weiwei
  --
  Weiwei Shi, Ph.D
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 *** NEW ADDRESS! ***
 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche
 


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

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


Re: [R] error with scan

2005-07-26 Thread Kevin Bartz
Can you show us the first line of the file?

The error means that in one of the values you specified as numeric (first, 
second, third, fourth, fifth, seventh, eighth, ninth), it found the character 
value it displayed.

Otherwise, this looks like a good use of scan.

Kevin

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Pierre 
Gattuso
Sent: Tuesday, July 26, 2005 11:52 AM
To: r-help@stat.math.ethz.ch
Cc: Jean-Pierre Gattuso
Subject: [R] error with scan

Hi:

I am trying to read a large (50+ lines) with scan() as read.table  
is unable to read it.

I get a strange error (below) which says that 'a real' was expected  
and '5' was read. Can someone help?

Thanks,
jp

  type=list(a=0,b=0,c=0,d=0,e=0,f=,g=0,h=0,i=0)
  tmp2 - scan(file=tmp2.txt, what=type, sep=,, quote=\,  
dec=., skip=1, nmax=541502)
Erreur dans scan(file = tmp2.txt, what = type, sep = ,, quote =  
\,  :
 scan() attendait 'a real' et a reçu '5
'

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

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


Re: [R] plotting horizontally

2005-07-26 Thread Marc Schwartz (via MN)
On Tue, 2005-07-26 at 08:58 +0700, [EMAIL PROTECTED] wrote:
 Hello,
 
 Is there any way to use plot() horizontally similar to
 boxplot(., horiz=TRUE)?  I want to use to illustrate
 the distribution of y-values on an adjacent plot using
 layout().
 
 Thanks in advance for any help.
 
 Regards,
 
 --Dan

Have you looked at the last example in ?layout, which has a scatterplot
with marginal histograms for the x and y axes?

Alternatively, you can generally reverse the x and y values for most
plots. For example, compare:

 d - density(rnorm(100))

 # Vertical density plot
 plot(d)

 # Horizontal density plot 
 plot(d$y, d$x, type = l, xlab = Density, 
  main = density(y = rnorm(100)),
  ylab = paste(N =, d$n,   Bandwidth =, formatC(d$bw)))


HTH,

Marc Schwartz

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


[R] elegant solution to transform vector into percentages?

2005-07-26 Thread jhainm
Hi,

I am looking for an elegant way to transform a vector into percentages of values
that meet certain criteria.

store-c(1,1.4,3,1.1,0.3,0.6,4,5)

# now I want to get the precentages of values
# that fall into the categories =M , M  =N , N
# let
M -.8
N - 1.2
# In my real example I have many more of these cutoff-points

# What I did is:

out - matrix(NA,1,3)

  out[1,1] - ( (sum(store=M))  /length(store) )*100
  out[1,2] - ( (sum(store M   store= N   ))  /length(store) )*100
  out[1,3] - ( (sum(store N))  /length(store) )*100

colnames(out)-c(percent=M,percentM  =N,percentN)
out

But this gets very tedious if I have many cutoff-points. Does anybody know a
more elegant way to do this task?

Thanks so much.

Cheers,
Jens

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


[R] choose between dates and times

2005-07-26 Thread Kerry Bush
Dear R-helpers,
  I have the following data:

 yhappenat x
5185 (07/22/05 00:05:14)   14
5186 (07/22/05 00:15:14)   14
5187 (07/22/05 00:25:14)   14
5188 (07/22/05 00:35:14)   14
..

I want to choose between 07/25/05 15:30:00 and
07/26/05 12:30:00. Anybody had experience in handling
this kind of data? Is there a simple way to subset by
the variable 'happenat'? Thanks.

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


Re: [R] elegant solution to transform vector into percentages?

2005-07-26 Thread Huntsinger, Reid
hist() or cut() followed by tabulate() would probably be the ingredients
you'd want.

Reid Huntsinger

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, July 26, 2005 3:49 PM
To: r-help@stat.math.ethz.ch
Subject: [R] elegant solution to transform vector into percentages?


Hi,

I am looking for an elegant way to transform a vector into percentages of
values
that meet certain criteria.

store-c(1,1.4,3,1.1,0.3,0.6,4,5)

# now I want to get the precentages of values
# that fall into the categories =M , M  =N , N
# let
M -.8
N - 1.2
# In my real example I have many more of these cutoff-points

# What I did is:

out - matrix(NA,1,3)

  out[1,1] - ( (sum(store=M))  /length(store) )*100
  out[1,2] - ( (sum(store M   store= N   ))  /length(store) )*100
  out[1,3] - ( (sum(store N))  /length(store) )*100

colnames(out)-c(percent=M,percentM  =N,percentN)
out

But this gets very tedious if I have many cutoff-points. Does anybody know a
more elegant way to do this task?

Thanks so much.

Cheers,
Jens

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

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


Re: [R] elegant solution to transform vector into percentages?

2005-07-26 Thread jim holtman
use 'cut':

 store-c(1,1.4,3,1.1,0.3,0.6,4,5)
 x.1 - cut(store, breaks=c(-Inf,.8,1.2,Inf))
 table(x.1)/length(x.1)*100
x.1
(-Inf,0.8]  (0.8,1.2]  (1.2,Inf] 
25 25 50 
 

On 7/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,
 
 I am looking for an elegant way to transform a vector into percentages of 
 values
 that meet certain criteria.
 
 store-c(1,1.4,3,1.1,0.3,0.6,4,5)
 
 # now I want to get the precentages of values
 # that fall into the categories =M , M  =N , N
 # let
 M -.8
 N - 1.2
 # In my real example I have many more of these cutoff-points
 
 # What I did is:
 
 out - matrix(NA,1,3)
 
  out[1,1] - ( (sum(store=M))  /length(store) )*100
  out[1,2] - ( (sum(store M   store= N   ))  /length(store) )*100
  out[1,3] - ( (sum(store N))  /length(store) )*100
 
 colnames(out)-c(percent=M,percentM  =N,percentN)
 out
 
 But this gets very tedious if I have many cutoff-points. Does anybody know a
 more elegant way to do this task?
 
 Thanks so much.
 
 Cheers,
 Jens
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


-- 
Jim Holtman

What the problem you are trying to solve?

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


[R] / Right division.

2005-07-26 Thread nwew
Dear R gurus.

Is there an R function equivalent to octaves / (Right division)
withouth forming the inverse of Y' using solve ?

[snip - from octave docu]

 Right division.  This is conceptually equivalent to the expression

  (inverse (y') * x')'

 but it is computed without forming the inverse of Y'.

 If the system is not square, or if the coefficient matrix is
 singular, a minimum norm solution is computed.

[snip]

Thanks
Eryk

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


Re: [R] / Right division.

2005-07-26 Thread Duncan Murdoch
On 7/26/2005 4:02 PM, nwew wrote:
 Dear R gurus.
 
 Is there an R function equivalent to octaves / (Right division)
 withouth forming the inverse of Y' using solve ?
 
 [snip - from octave docu]
 
  Right division.  This is conceptually equivalent to the expression
 
   (inverse (y') * x')'
 
  but it is computed without forming the inverse of Y'.
 
  If the system is not square, or if the coefficient matrix is
  singular, a minimum norm solution is computed.

If x is a vector, I think it's solve(t(Y), x).  If x is stored as a 1xn 
matrix, you'd use t(solve(t(Y), t(x)).

If you're trying to do multiple operations at once, you probably need to 
use the second form.

Duncan Murdoch

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


Re: [R] choose between dates and times

2005-07-26 Thread bogdan romocea
If happenat is not a datetime value, convert it with strptime(). Then,
one solution is to transform it in the following way:
num.time - as.numeric(format(happenat,%Y%m%d%H%M%S))
This way, 07/22/05 00:05:14 becomes 20050722000514, and you can subset
your data frame with
dfr[which(num.time = 20050725153000  num.time = 20050726123000),]
hth,
b.


 -Original Message-
 From: Kerry Bush [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 26, 2005 3:54 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] choose between dates and times
 
 
 Dear R-helpers,
   I have the following data:
 
  yhappenat x
 5185 (07/22/05 00:05:14)   14
 5186 (07/22/05 00:15:14)   14
 5187 (07/22/05 00:25:14)   14
 5188 (07/22/05 00:35:14)   14
 ..
 
 I want to choose between 07/25/05 15:30:00 and
 07/26/05 12:30:00. Anybody had experience in handling
 this kind of data? Is there a simple way to subset by
 the variable 'happenat'? Thanks.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


Re: [R] elegant solution to transform vector into percentages?

2005-07-26 Thread Marc Schwartz (via MN)
On Tue, 2005-07-26 at 15:48 -0400, [EMAIL PROTECTED] wrote:
 Hi,
 
 I am looking for an elegant way to transform a vector into percentages of 
 values
 that meet certain criteria.
 
 store-c(1,1.4,3,1.1,0.3,0.6,4,5)
 
 # now I want to get the precentages of values
 # that fall into the categories =M , M  =N , N
 # let
 M -.8
 N - 1.2
 # In my real example I have many more of these cutoff-points
 
 # What I did is:
 
 out - matrix(NA,1,3)
 
   out[1,1] - ( (sum(store=M))  /length(store) )*100
   out[1,2] - ( (sum(store M   store= N   ))  /length(store) )*100
   out[1,3] - ( (sum(store N))  /length(store) )*100
 
 colnames(out)-c(percent=M,percentM  =N,percentN)
 out
 
 But this gets very tedious if I have many cutoff-points. Does anybody know a
 more elegant way to do this task?
 
 Thanks so much.
 
 Cheers,
 Jens

Something alone the lines of:

store - c(1, 1.4, 3, 1.1, 0.3, 0.6, 4, 5)
M - 0.8
N - 1.2

x - hist(store, br = c(min(store), M, N, max(store)), 
  plot = FALSE)$counts  

pct.x - prop.table(x) * 100

names(pct.x) - c(percent = M,percent  M  = N,percent  N)

 pct.x
  percent = M percent  M  = Npercent  N 
25 25 50 


I think that should do it. See ?hist for more information and take note
of the 'include.lowest' and 'right' arguments relative to whether or not
values are or are not included in the specified intervals.

See ?prop.table as well.

Also be acutely aware of potential problems with exact equality
comparisons with floating point numbers and the break points...if you
have a float value equal to a breakpoint in your vector.

HTH,

Marc Schwartz

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


Re: [R] choose between dates and times

2005-07-26 Thread Peter Dalgaard
Kerry Bush [EMAIL PROTECTED] writes:

 Dear R-helpers,
   I have the following data:
 
  yhappenat x
 5185 (07/22/05 00:05:14)   14
 5186 (07/22/05 00:15:14)   14
 5187 (07/22/05 00:25:14)   14
 5188 (07/22/05 00:35:14)   14
 ..
 
 I want to choose between 07/25/05 15:30:00 and
 07/26/05 12:30:00. Anybody had experience in handling
 this kind of data? Is there a simple way to subset by
 the variable 'happenat'? Thanks.

Simple, perhaps not. This stuff always gets a little heavy, but start
here: 

 strptime((07/22/05 00:05:14),format=(%m/%d/%y %H:%M:%S)) 
+ as.POSIXct(2005-07-22 00:06:00)
[1] FALSE
 strptime((07/22/05 00:05:14),format=(%m/%d/%y %H:%M:%S))  
+ as.POSIXct(2005-07-22 00:05:00)
[1] TRUE

Once you figure out how this works, the rest should follow.

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

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


[R] Wishart Density

2005-07-26 Thread Wang, Meihua
Dear R users,
 
I am doing MCMC using Metropolis-Hastings.  My model is
bivariate-log-normal and the prior for variance-covariance is wishart
distribution.   I am wondering if there are some simple codes about how
to get the density of Wishart distribution in my case ?
Thanks in advance.  
 
Meihua

[[alternative HTML version deleted]]

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


Re: [R] Help on T test

2005-07-26 Thread Adaikalavan Ramasamy
Mark,

Please do not post the same question to both R-help and BioC-help
mailing lists because 1) there are many people who are on both lists and
2) people's replies will be archived in two different places making it
harder to others to search in future.

Please see the responses on BioC-help list.

Regards, Adai


On Tue, 2005-07-26 at 15:28 -0400, mark salsburg wrote:
 ok I created a matrix C with 
 
 A   B  CA1   B1C1
 ..
 .
 
 the columns contain the gene expression values..
 
 I ran the following t.test:
 
 apply(C, 1, function(x) t.test( x[1:3], x[4,6] )$p.value )
 
 which outputs out 16063 pvalues (the number of rows)
 
 I just want to output 3 pvalues showing if A's column is different from A1 
 etc..
 
 any help would be great.. thank you..
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] elegant solution to transform vector into percentages?

2005-07-26 Thread Adaikalavan Ramasamy
Why not write a function ? Here is one.

 mytable - function(x, br){

   n  - length(br)
  
   tb - table( cut( x, breaks=c(-Inf, br, Inf) ) )
   tb - 100 * tb / sum(tb)

   tb.n  - paste( c(, br), c(br, ), sep=  x =  )
   tb.n[1]   - paste(x = , br[1], sep=)
   tb.n[n+1] - paste(x  ,  br[n], sep=)

   names(tb) - tb.n
   return(tb)
 }

 mytable( store, br=c(0.8, 1.2) )
   x = 0.8 0.8  x = 1.2x  1.2
 25 25 50

You might want to do a bit more testing especially at the break points.
However I do not like the output of the above because the names of the
table overlaps. Here is another function that might have nicer output.

 mytable2 - function(x, br){
   tb - as.matrix( mytable( x=x, br=br ) )
   colnames(tb) - Percentage
   return(tb)
 }

 mytable2( store, br=c(0.8, 1.2) )
Percentage
 x = 0.8   25
 0.8  x = 1.2 25
 x  1.250

Hope this helps.

Regards, Adai



On Tue, 2005-07-26 at 15:48 -0400, [EMAIL PROTECTED] wrote:
 Hi,
 
 I am looking for an elegant way to transform a vector into percentages of 
 values
 that meet certain criteria.
 
 store-c(1,1.4,3,1.1,0.3,0.6,4,5)
 
 # now I want to get the precentages of values
 # that fall into the categories =M , M  =N , N
 # let
 M -.8
 N - 1.2
 # In my real example I have many more of these cutoff-points
 
 # What I did is:
 
 out - matrix(NA,1,3)
 
   out[1,1] - ( (sum(store=M))  /length(store) )*100
   out[1,2] - ( (sum(store M   store= N   ))  /length(store) )*100
   out[1,3] - ( (sum(store N))  /length(store) )*100
 
 colnames(out)-c(percent=M,percentM  =N,percentN)
 out
 
 But this gets very tedious if I have many cutoff-points. Does anybody know a
 more elegant way to do this task?
 
 Thanks so much.
 
 Cheers,
 Jens
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] Durbin test for Incomplete block

2005-07-26 Thread Peter Ho
Hi R-users,

Does anyone know of a package that contains a function to conduct 
Durbin's test and it's extension for incomplete block designs, as 
described in Rayner and Best 2001 A contingency Table Approach to 
Nonparametric Testing?


Peter
--
ISR-Porto

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


[R] Difficulty getting standard deviation of ALL odds ratios with glm function, logistic regression, need cov of parameters

2005-07-26 Thread Garrett Fox
I am trying to do logistic regression with a categorical predictor variable
with the glm() function, family=binomial.  Using glm() I would like to be
able to calculate the confidence intervals of all three possible odds ratios
for a factor (the factor has three categories).  Three categories imply two
columns of 0's and 1's in the design matrix, and two parameter estimates
with their SE's.  Two confidence intervals for odds ratios can be easily
calculated, the third confidence interval can be calculated if I know the SE
of B1-B2, but this requires the covariance matrix of parameter estimates,
which is not given to my knowledge.  

My initial thought was that Cov(B1,B2)=0, but this cannot be true or the
variance estimates would depend on how you set up the design matrix (the
factor symbolized by 0,0 would always have a higher SD).

Please help me find the covariance of the parameter estimates.

Thank you in advance,

Garrett Fox

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


[R] Anybody have a binary version of SJava for rw2001 (Windows)?

2005-07-26 Thread Quin Wills
I am not a techie and have been struggling 2 days solid to try and install
SJava (the source from http://www.omegahat.org/RSJava/). Does anybody have a
binary file for me (I am Windows XP and rw2001)? I have tried installing
Perl, mingwin and the cygwin tools but still no luck. When I try “R CMD
INSTALL c:\SJava_0.78-0.tar.gz” I get the following (and haven’t a clue what
it could mean):

 

-Making package SJava-- 
Building JNI header files... 
Extracting the classes from Environment.jar 
/jdk1.3/bin/jar: not found 
RForeignReference 
/jdk1.3/bin/javah: not found 
ROmegahat Interpreter 
/jdkl.3/bin/javah: not found 
REvaluator 
/jdkl.3/bin/Javah: not found 
RManualFunctionActionListener 
/jdk1.3/bin/javah: not found 
/jdkl.3/bin/javah: not found 
adding build stamp to DESCRIPTION 
running src/Makefile.win 
(cd ..  ; ./configure.win c:/PROGRW1/R/rw200l) 
/configure.win: not found 
make[3]: *** [conf ig] Error 127 
make[2]: *** [srcDynLib] Error 2 
make[1]: *** [all] Error 2 
make: *** [pkg—SJava] Error 2 
*** Installation of SJava failed *** 

 


---



 

[[alternative HTML version deleted]]

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

Re: [R] Difficulty getting standard deviation of ALL odds ratios with glm function, logistic regression, need cov of parameters

2005-07-26 Thread Thomas Lumley
On Tue, 26 Jul 2005, Garrett Fox wrote:

 I am trying to do logistic regression with a categorical predictor variable
 with the glm() function, family=binomial.  Using glm() I would like to be
 able to calculate the confidence intervals of all three possible odds ratios
 for a factor (the factor has three categories).  Three categories imply two
 columns of 0's and 1's in the design matrix, and two parameter estimates
 with their SE's.  Two confidence intervals for odds ratios can be easily
 calculated, the third confidence interval can be calculated if I know the SE
 of B1-B2, but this requires the covariance matrix of parameter estimates,
 which is not given to my knowledge.


vcov(your.model) returns the variance-covariance matrix.

-thomas

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


Re: [R] problem with Hershey fonts

2005-07-26 Thread Paul Murrell
Hi


Ray Brownrigg wrote:
 This was reported to me by a colleague in China, so I may not be
 reproducing exactly what they are seeing (which I suspect is rw2011), but
 this is what I see:
 
version
 
_
 platform i386--netbsdelf
 arch i386
 os   netbsdelf
 system   i386, netbsdelf
 status
 major2
 minor1.1
 year 2005
 month06
 day  20
 language R
 
help(Hershey)
 
   :
   :
  If the 'vfont' argument to one of the text-drawing functions
  ('text', 'mtext', 'title', 'axis', and 'contour') is a character
  vector of length 2, Hershey vector fonts are used to render the
  text.
   :
   The other useful escape sequences all begin with '\\'.  These
   are described below. Remember that backslashes have to be
   doubled in R character strings, so they need to be entered
   with _four_ backslashes.
   :
   :
 
plot(runif(100))  # to get something on the screen
text(0, 1, '\\Re', vfont=c('serif', 'plain')) # works
title(main = '\\Re', vfont=c('serif','plain'))# doesn't work, and...
 
 Warning message:
 parameter vfont could not be set in high-level plot() function
 
mtext('\\Re', 2, vfont=c('serif','plain'))# doesn't work, but...
 
 Warning message:
 Hershey fonts not yet implemented for mtext() in: mtext(text, side, line, 
 outer, at, adj, padj, cex, col, font,
 
axis(3, at=50, tick=F, labels='\\Re', vfont=c('serif','plain'))   # 
doesn't work 
 
 
 Now at least mtext() 'redeems' itself with its Warning, but title()
 contradicts the help(Hershey), and axis() just gets it wrong by printing
 the characters \Re (or \\Re when the string is specified as
 'Re' as alluded to in the Hershey documentation - but somewhat
 contradicted by the success of the text() call above).
 
 Now perhaps the problem is just with the Hershey documentation (or my
 reading of it), but I don't know what is supposed to work.  Or is there
 some combination that I haven't tried?


The problem with title() has been reported before (PR#7031), but thanks 
for pointing out the extension to axis() and mtext() as well.

The good news is that the 'vfont' argument has been superseded.  It 
was a horrible way of incorporating Hershey fonts (I should know, I did 
it) and a much better way now exists via par(family=).  The following 
modification of your example should work:

plot(runif(100))# to get something on the screen
oldf - par(family=HersheySerif)
text(0, 1, '\\Re')
title(main = '\\Re')
mtext('\\Re', 2)
axis(3, at=50, tick=F, labels='\\Re')
par(oldf)

The bad news is that, as you point out, the documentation is lacking.  I 
will make some updates so that this solution is easier to find in future.

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

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


[R] spss.read factor reversal

2005-07-26 Thread Joel Bremson
Hi,

I'm having a problem with spss.read reversing my factor input.

Here is the input copied from the spss data editor:

color cost
1 2.30
2 2.40
3 3.00
1 2.10
1 1.00
1 2.00
2 4.00
2 3.20
2 2.33
3 2.44
3 2.55

For color, red=1, blue=2, and green = 3. It's type is 'String' and

out=read.spss(file)
out

$COLOR
[1] green blue red green green green blue blue blue red red 
Levels: red blue green

$COST
[1] 2.30 2.40 3.00 2.10 1.00 2.00 4.00 3.20 2.33 2.44 2.55

attr(,label.table)
attr(,label.table)$COLOR
green blue red 
3 2 1 

attr(,label.table)$COST
NULL

attr(,variable.labels)
COLOR COST 
color cost 

=EOF===

Notice that the $COLOR factor data are inverted, looking at the integer 
output
we see:

 as.integer(out$COLOR)
[1] 3 2 1 3 3 3 2 2 2 1 1

The spss original data looks like this:
1 2 3 1 1 1 2 2 2 3 3

I can easily invert the output mathematically with:
q = sapply(m,function(x){ x + 2*(median(unique(m))-x)})

(m is composed of sequential integers starting at one)

,but it seems as though something wrong is happening with read.spss.

Any ideas?

Joel Bremson
Graduate Student
UC Davis

[[alternative HTML version deleted]]

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


[R] CART analysis

2005-07-26 Thread John Sorkin
Is there an R package that can be used for CART analysis?
Thank you,
John 

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC

University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524

410-605-7119 
- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

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


Re: [R] spss.read factor reversal

2005-07-26 Thread Adaikalavan Ramasamy
I think it is doing what is supposed to do but I never used read.spss,
so take this with a pinch of salt.

In R when you use as.integer on a factor, the one with the lowest level
gets a value of 1 and so on. The lowest level of the factor can
determined from levels() function.

   f - factor( c(Green, Green, Red, Blue), 
levels=c(Red, Blue, Green) )
   levels(f)
   [1] Red   Blue  Green

   as.integer(f)
   [1] 3 3 1 2

But the levels of a factor can be changed 

   as.integer( factor( f, levels=c(Green, Blue, Red ) ) )
   [1] 1 1 3 2

You can also try setting use.value.labels=FALSE in read.spss function
and then creating a factor out of it.

Regards, Adai



On Tue, 2005-07-26 at 17:04 -0700, Joel Bremson wrote:
 Hi,
 
 I'm having a problem with spss.read reversing my factor input.
 
 Here is the input copied from the spss data editor:
 
 color cost
 1 2.30
 2 2.40
 3 3.00
 1 2.10
 1 1.00
 1 2.00
 2 4.00
 2 3.20
 2 2.33
 3 2.44
 3 2.55
 
 For color, red=1, blue=2, and green = 3. It's type is 'String' and
 
 out=read.spss(file)
 out
 
 $COLOR
 [1] green blue red green green green blue blue blue red red 
 Levels: red blue green
 
 $COST
 [1] 2.30 2.40 3.00 2.10 1.00 2.00 4.00 3.20 2.33 2.44 2.55
 
 attr(,label.table)
 attr(,label.table)$COLOR
 green blue red 
 3 2 1 
 
 attr(,label.table)$COST
 NULL
 
 attr(,variable.labels)
 COLOR COST 
 color cost 
 
 =EOF===
 
 Notice that the $COLOR factor data are inverted, looking at the integer 
 output
 we see:
 
  as.integer(out$COLOR)
 [1] 3 2 1 3 3 3 2 2 2 1 1
 
 The spss original data looks like this:
 1 2 3 1 1 1 2 2 2 3 3
 
 I can easily invert the output mathematically with:
 q = sapply(m,function(x){ x + 2*(median(unique(m))-x)})
 
 (m is composed of sequential integers starting at one)
 
 ,but it seems as though something wrong is happening with read.spss.
 
 Any ideas?
 
 Joel Bremson
 Graduate Student
 UC Davis
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] CART analysis

2005-07-26 Thread Adaikalavan Ramasamy
RSiteSearch(CART) should bring up a few hits including 

  http://finzi.psych.upenn.edu/R/Rhelp02a/archive/25850.html

Regards, Adai


On Tue, 2005-07-26 at 20:25 -0400, John Sorkin wrote:
 Is there an R package that can be used for CART analysis?
 Thank you,
 John 
 
 John Sorkin M.D., Ph.D.
 Chief, Biostatistics and Informatics
 Baltimore VA Medical Center GRECC and
 University of Maryland School of Medicine Claude Pepper OAIC
 
 University of Maryland School of Medicine
 Division of Gerontology
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 
 410-605-7119 
 -- NOTE NEW EMAIL ADDRESS:
 [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] CART analysis

2005-07-26 Thread Marc R. Feldesman


--- Adaikalavan Ramasamy [EMAIL PROTECTED] wrote:

 RSiteSearch(CART) should bring up a few hits including 
 
   http://finzi.psych.upenn.edu/R/Rhelp02a/archive/25850.html
 

CART is a trademarked statistical procedure owned by Salford Systems
of San Diego, CA.  If you're looking for an R-package that implements
the procedures described in the Breiman, Friedman, Olshen, and Stone
book entitled Classification and Regression Trees, the closest you
can come to the original algorithm is the R-package called rpart, by
Therneau and Atkinson.  If you combine that with Andy Liaw's
randomForest, you have a pretty potent set of tools.  If you really
want CART, you need to contact Salford Systems for their
implementation and pay their very expensive licensing fees.

Dr. Marc R Feldesman
Professor  Chair Emeritus
Department of Anthropology
Portland State University
Portland, OR 97207

Please respond to all emails at:  [EMAIL PROTECTED]

Some people live and die by actuarial tables  Groundhog Day

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


[R] trellis graphics/ trellis.par.set()

2005-07-26 Thread McClatchie, Sam (PIRSA-SARDI)
Background:
OS: Linux Mandrake 10.1
release: R 2.0.0
editor: GNU Emacs 21.3.2
front-end: ESS 5.2.3
-
Colleagues

I want to increase the size of the axis markings and labels on some trellis
graphs, and I am having some trouble with trellis.par.set()

trellis.par.set(par.xlab.text.cex = list(cex=1.5))

is not quite right, and having read the documentation, I wonder if anyone
help me get the graphical parameter right?

print(trellis.par.get()) 
returns 
$par.xlab.text.cex

Best fishes

Sam

Sam McClatchie,
Biological oceanography 
South Australian Aquatic Sciences Centre
PO Box 120, Henley Beach 5022
Adelaide, South Australia
email [EMAIL PROTECTED]
Telephone: (61-8) 8207 5448
FAX: (61-8) 8207 5481
Research home page http://www.members.iinet.net.au/~s.mcclatchie/
  
   /\
  ...xX(° 
 
   °)Xx
  /  \\
(((° 
  (((°   ...xX(°O°)Xx

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


[R] Error in FUN(newX[, i], ...) : `x' must be atomic

2005-07-26 Thread Srinivas Iyyer
Hello Group, 
 What is the meaning of the error.  is there any place
to look for this. I guess 'atomic' seems to be OOP
related concept.

thank you
srini

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


Re: [R] Error in FUN(newX[, i], ...) : `x' must be atomic

2005-07-26 Thread Adaikalavan Ramasamy
Perhaps a reproducible example and short explanation of what you want to
do might help. I suspect that you fed a null value into a function that
expects a non-null value or something.


On Tue, 2005-07-26 at 19:22 -0700, Srinivas Iyyer wrote:
 Hello Group, 
  What is the meaning of the error.  is there any place
 to look for this. I guess 'atomic' seems to be OOP
 related concept.
 
 thank you
 srini
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Error in FUN(newX[, i], ...) : `x' must be atomic

2005-07-26 Thread Simon Blomberg
Actually, atoms are originally a Lisp concept. Objects are either atoms or 
not. Atoms are data types that cannot be taken apart, such as numbers or 
symbols. Lists and vectors (of length  1) are examples of  non-atomic data 
types. Did you pass a vector to FUN?

Cheers,

Simon.

At 12:22 PM 27/07/2005, Srinivas Iyyer wrote:
Hello Group,
  What is the meaning of the error.  is there any place
to look for this. I guess 'atomic' seems to be OOP
related concept.

thank you
srini

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

Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Centre for Resource and Environmental Studies
The Australian National University
Canberra ACT 0200
Australia
T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
F: +61 2 6125 0757
CRICOS Provider # 00120C

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


[R] Problem specifying function for mle operation

2005-07-26 Thread Narcyz Ghinea

Hello fellow R users,

Below are two cases using the mle operation from the stats4 package. In CASE 
1 the code runs fine, in CASE 2 errors occur:

CASE 1

x, alpha_current, s, and n are vectors of the same length.

ll_beta-function(b0=0,b1=0) 
-sum(s*b0+s*b1*x+s*alpha_current-n*log(1+exp(b0+b1*x+alpha_current)))

fit_beta-mle(ll_beta)

CASE 2

The error message is as follows = Error in validObject(.Object) : invalid 
class mle object: invalid object for slot fullcoef in class mle: got 
class list, should be or extend class numeric

x,s,n, and alpha are vectors of the same length (5 dimensions in this specific 
case).

ll_alpha-function(alpha=c(0.5,0.5,0.5,0.5,0.5)) 
-sum(s*b0+s*b1*x+s*alpha-n*log(1+exp(b0+b1*x+alpha))-0.5*(alpha/sigma)^2)

fit_alpha-mle(ll_alpha)

MY THEORY:

I think it has something to do with the fact that the function argument is a 
vector in CASE 2. Hope this doesn't mean I have to re-write the function in a 
way that it doesn't require vector inputs.

Any suggestions on how to make CASE 2 work would be appreciated.

peace

Narcyz.


This message is intended for the addressee named and may con...{{dropped}}

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


[R] gamma distribution

2005-07-26 Thread pantd
Hi R Users


This is a code I wrote and just want to confirm if the first 1000 values are raw
gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get
2000 rows once I import into excel, the p - values beyond 1000 dont look that
good, they are very high.


--
sink(a1.txt);

for (i in 1:1000)
{
x-rgamma(10, 2.5, scale = 10)
y-rgamma(10, 2.5, scale = 10)
z-wilcox.test(x, y, var.equal = FALSE)
print(z)
x1-log(x)
y1-log(y)
k-wilcox.test(x1, y1, var.equal = FALSE)
print(k)
}

---
any suggestions are welcome

thanks

-devarshi

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


[R] A question about par.plot in gamlss

2005-07-26 Thread hari iyer
Hello
I am using the following code to plot a data matrix into a form that seems 
suitable for
the use of par.plot.

library(gamlss)
a-matrix(c(1,2,3,4,5,6,7,8,9,8,7,6),nrow=3)
rownames(a)-c(trt1,trt2,trt3)
colnames(a)-c(col1,col2,col3,col4)
hpar.plot-function(ZZ){
ZZvar-c(t(ZZ))
ZZtrt-c(matrix(rep(1:ncol(ZZ),nrow(ZZ
ZZcov-as.factor(c(t(matrix(rep(rownames(ZZ),ncol(ZZ)),nrow=nrow(ZZ)
par.plot(ZZvar ~ ZZtrt,sub=ZZcov)
}
hpar.plot(a)

I keep getting the following error message:

Error in eval(expr, envir, enclos) : Object ZZvar not found

I am unable to figure out my error. Can someone help please? Thanks in 
advance.

Hari

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