Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Mark Wardle
It may be worth outputting postscript and converting to PDF from
there. Although Preview can do this, it may be worth looking at
Ghostscript which *may* not have simila problems.

I have also had PDFs which have displayed well in Preview and open
source tools and have been garbled in Adobe Acrobat, so the problems
aren't limited to Preview.

Best wishes,

Mark

On 13/08/07, Duncan Murdoch [EMAIL PROTECTED] wrote:
 Michael Kubovy wrote:
  On Aug 12, 2007, at 6:24 AM, Duncan Murdoch wrote:
 
 
  Michael Kubovy wrote:
 
  Dear r-helpers,
 
  In my previous message there were comments in the code that may
  have  made cutting and pasting awkward. Here it is w/o them.
 
  I have two questions:
 
  (1) The following produces a pdf with artifacts. How do I prevent
  them?
 
 
  What artifacts do you see?  It looks like a smoothly varying field
  when produced by R 2.5.1 and viewed in Acrobat Reader 6.0 on Windows.
 
  Duncan Murdoch
 
  require(grDevices)
  imSize - 200
  lambda - 10
  theta - 15
  sigma - 40
  x - 1:imSize
  x0 - x / imSize -.5
  freq = imSize/lambda
  xf = x0 * freq * 2 * pi
  f - function(x, y){r - -((x^2 + y^2)/(sigma ^2)); exp(r)}
  z - outer(xf, xf, f)
  f1 - function(x, y){cos(.1 * x)}
  z1 - outer(xf, xf, f1)
  pdf('gabor.pdf')
  image(xf, xf, z * z1, col = gray(250:1000/1000),
  xlab = '', ylab =  '', bty = 'n', axes = FALSE, asp = 1)
  dev.off()
 
 
  I'm working on a Mac. You're right, Acrobat 6.05 renders the figure
  nicely, but when it's included in a LaTeX-produced pdf or viewed with
  the Mac Preview program, a grid of fine white lines is superimposed
  on the figure. So I believe that it's a matter of aliasing, which I
  might be able to prevent by adjusting the parameters of the figures.
  I just don't know enough to figure this out, and would appreciate
  guidance.
 I see the artifacts in Preview on a Mac too.  So it looks to me like a
 Mac bug.

 Preview is actually pretty poor at graphics display; see
 http://www.geuz.org/pipermail/gl2ps/2007/000223.html.

 My only suggestion is not to use Preview.

 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
 and provide commented, minimal, self-contained, reproducible code.


 __
 This email has been scanned by the MessageLabs Email Security System.
 For more information please visit http://www.messagelabs.com/email
 __



-- 
Dr. Mark Wardle
Clinical research fellow and specialist registrar, Neurology
Cardiff, UK

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] p value statistic for lm object

2007-08-13 Thread Arjun Bhandari
Hi,

I conduct a univariate regression with lm function. I would like to get 
the p value for the regression. Is there a method that would enable me to 
extract the p value into a variable.

Thanks.
Arjun Bhandari

**
This email and any files transmitted with it are confidentia...{{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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A clean way to initialize class slot of type numeric vector

2007-08-13 Thread Prof Brian Ripley
Well, c() is NULL, so R did as you asked it to.  See ?integer: an integer 
vector of length 0 can be gotten by integer(0) (and other ways).

If you want integers, why have a slot which is numeric?

 setClass(foo, representation(members=integer))
[1] foo
 new(foo)
An object of class foo
Slot members:
integer(0)

is the natural and simpler way to do this.


On Mon, 13 Aug 2007, [EMAIL PROTECTED] wrote:

 Hi,

 I have a class definition like this:

 setClass(foo, representation(members=numeric),
   prototype(members=c()))

 I intend my class to have members, a slot whose value should be a vector 
 of integer. When I initialize this class, I don't have any member yet. 
 So my member is blank. But if I run the above definition into R, it will 
 complain that my slot members is assigned to NULL which does not extend 
 class numeric. So how can I fix this? Is there any clean way to do 
 this? This is quite a common situation but I can't seem to find a way 
 out. Any help would be really appreciated. Thank you.

 - adschai

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
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
and provide commented, minimal, self-contained, reproducible code.


[R] creating unique and sorted values by combining columns

2007-08-13 Thread Alexander.Herr
 
Hi List,

I am combining column values of a dataframe to create a new variable
that is the sorted and unqiue combination of the columns (and excluding
0). The following works, but surely there is a more elegant way of doing
this?

t1-NULL
for(i in 1:nrow(tmp)) {
  if(i == 1){
  sort(c(tmp[i,1], tmp[i,2],tmp[i,3],tmp[i,4],tmp[i,5]),
decreasing=TRUE)-t1
  }
  else {
   rbind(t1,sort(c(tmp[i,1],
tmp[i,2],tmp[i,3],tmp[i,4],tmp[i,5]),decreasing=TRUE))-t1
   }
}

t2-NULL
for(i in 1:nrow(t1)){
 if(i == 1) paste(unique(t1[i,t1[i,]0]),collapse=_)-t2
 else cbind(t2,paste(unique(t1[i,t1[i,]0]),collapse=_))-t2
}

tmp
t1
t2


Any hints appreciated.
Thanks
Herry

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] binomial simulation

2007-08-13 Thread sigalit mangut-leiba
Hi,
The probability of false detection is: P(T+ | D-)=1-P(T+ | D+)=0.05.
and I want to find the joint probability P(T+,D+)=P(T+|D+)*P(D+)
Thank you for your reply,
Sigalit.


On 8/13/07, Moshe Olshansky [EMAIL PROTECTED] wrote:

 Hi Sigalit,

 Do you want to find the probability P(T+ = t AND D+ =
 d) for all the combinations of t and d (for ICU and
 Reg.)?
 Is the probability of false detection (when there is
 no disease) always 0?

 Regards,

 Moshe.

 --- sigalit mangut-leiba [EMAIL PROTECTED] wrote:

  hello,
  I asked about this simulation a few days ago, but
  still i can't get what i
  need.
  I have 2 units: icu and regular. from icu I want to
  take 200 observations
  from binomial distribution, when probability for
  disease is: p=0.6.
  from regular I want to take 300 observation with the
  same probability: p=0.6
  .
  the distribution to detect disease when disease
  occurred- *for someone from
  icu* - is: p(T+ | D+)=0.95.
  the distribution to detect disease when disease
  occurred- *for someone from
  reg.unit* - is: p(T+ | D+)=0.8.
  I want to compute the joint distribution for each
  unit: p(T+,D+) for icu,
  and the same for reg.
  I tried:
 
  pdeti - 0
 
  pdetr - 0
 
  picu - pdeti*.6
 
  preg - pdetr*.6
 
  dept - c(icu,reg)
 
  icu - rbinom(200, 1, .6)
 
  reg - rbinom(300, 1, .6)
 
  for(i in 1:300) {
 
  if(dept==icu) pdeti==0.95
 
  if (dept==reg) pdetr==0.80
 
  }
 
  print(picu)
 
  print(preg)
 
  and got 50 warnings:
 
  the condition has length  1 and only the first
  element will be used in: if
  (dept == icu) pdeti == 0.95
  the condition has length  1 and only the first
  element will be used in: if
  (dept == reg) pdetr == 0.8
 
  I would appreciate any suggestions,
 
  thank you,
 
  Sigalit.
 
[[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
  and provide commented, minimal, self-contained,
  reproducible code.
 



[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] need help with pdf-plot

2007-08-13 Thread Antje
Thank you both!
The hint with the pty=s was very useful. I did not know it before.

Ciao,
Antje


Ivar Herfindal schrieb:
 Dear Antje
 
 I cannot see that you have got any replies yet, so I will make and 
 attempt. However, I am sure other have more formally correct solutions.
 
 When you call the pdf(), you can set paper=a4 (or a4r for 
 landscape). However, the width and the height of your plot should then 
 not exceed the size of the paper (which is approximately 8.27*11.69 
 inches for a4). Try (I have only tested on windows XP, R 2.5.0):
 
 pdf(test1.pdf, width=10, heigh=5, paper=a4r)
 par(mfrow=c(1,3), pty=s) #pty=s gives square plotting regions
 plot(rnorm(100))
 plot(rnorm(100))
 plot(rnorm(100))
 dev.off()
 
 Hope this helps
 
 Ivar
 
 
 Antje skrev:
 I still have this problem. Does anybody know any solution?

 Antje

 Antje schrieb:
  
 Hello,

 I'm trying to plot a set of barplots like a matrix (2 rows, 10 
 columns fromreduced_mat) to a pdf. It works with the following 
 parameters:

 pdf(test.pdf,width=ncol(reduced_mat)*2, height=nrow(reduced_mat)*2, 
 pointsize = 12)

 par(mfcol = c(nrow(reduced_mat),ncol(reduced_mat)), oma = c(0,0,0,0), 
 lwd=48/96, cex.axis = 0.5, las = 2, cex.main = 1.0)

 The I get a long narrow page format with the quadratic barplots.

 But I would like to have a A4 format in the end and the plots not 
 filling the whole page (they should stay somehow quadratic and not be 
 stretched...).

 What shall I look for to achieve this?

 Antje

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
   


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] need help to manipulate function and time interval

2007-08-13 Thread KOITA Lassana - STAC/ACE
Hi,
data are extracted from MS Access with the format: (%d/%m%Y %H%M%S); ex: 
16/09/2006 03:38:37
I still have error messneger

Thank you for your help. 

Lassana KOITA 
Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
Project Engineer Airport Safety Studies  Statistical analysis
Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 
Department 
Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
Headquarters
Tel: 01 49 56 80 60
Fax: 01 49 56 82 14
E-mail: [EMAIL PROTECTED]
http://www.stac.aviation-civile.gouv.fr/



Uwe Ligges [EMAIL PROTECTED] 
12/08/2007 15:24

A
Matthew Walker [EMAIL PROTECTED]
cc
Henrique Dallazuanna [EMAIL PROTECTED], r-help@stat.math.ethz.ch, KOITA 
Lassana - STAC/ACE [EMAIL PROTECTED]
Objet
Re: [R] need help to manipulate function and time interval








Matthew Walker wrote:
 Uwe Ligges wrote:
 Henrique Dallazuanna wrote:
 
 Hi,

 Try whit:

 if(time[j] = 18:00:00   23:59:59)
 

 This code is obviously wrong and does not help for the next few lines 
 in the questioner's message, please do not post unsensible stuff.

 Uwe Ligges

 
 
 Actually, I would have said that was quite an interesting solution.  If 
 the time is guaranteed to be in this 8 character format, then that 
 idea's quite easily implemented:
 
 # Returns true if time is between 18:00:00 and 23:59:59
 check_time - function(time_string) {
  if (nchar(time_string)!=8) stop (Incorrect format)
  time_string = 18:00:00  time_string = 23:59:59
 }
 
 
   check_time(19:59:00)
 [1] TRUE
   check_time(16:59:00)
 [1] FALSE
  
   check_time(18:00:00)
 [1] TRUE
   check_time(23:59:59)
 [1] TRUE
   check_time(24:00:00)
 [1] FALSE
  
   check_time(18:05)
 Error in check_time(18:05) : Incorrect format
 
 
 Perhaps there is an issue if the locale does not sort character-based 
 numbers in the same way as ASCII?  But Otherwise, I can't see why this 
 solution wouldn't do the job.
 
 A more robust solution solution would parse the strings (?strptime) and 
 then check their days/hours/mins/seconds (?DateTimeClasses).  But 
 perhaps the above is sufficient?

Well, the interesting part of the original question that everynody seems 
to omit now was the second part:

if (time[j] is between 22:00:00 and 05:59:59)

hence the answer is still not sufficient (even if the syntax error has 
been corrected) - and hence I asked for the format the time is 
originally in.

Uwe Ligges




 Cheers,
 
 Matthew


[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creating unique and sorted values by combining columns

2007-08-13 Thread Jacques VESLOT
apply(tmp, 1, function(x) paste(sort(unique(x[x!=0])),collapse=_))

Jacques VESLOT

INRA - Biostatistique  Processus Spatiaux
Site Agroparc 84914 Avignon Cedex 9, France

Tel: +33 (0) 4 32 72 21 58
Fax: +33 (0) 4 32 72 21 84



[EMAIL PROTECTED] a écrit :
  
 Hi List,

 I am combining column values of a dataframe to create a new variable
 that is the sorted and unqiue combination of the columns (and excluding
 0). The following works, but surely there is a more elegant way of doing
 this?

 t1-NULL
 for(i in 1:nrow(tmp)) {
   if(i == 1){
   sort(c(tmp[i,1], tmp[i,2],tmp[i,3],tmp[i,4],tmp[i,5]),
 decreasing=TRUE)-t1
   }
   else {
rbind(t1,sort(c(tmp[i,1],
 tmp[i,2],tmp[i,3],tmp[i,4],tmp[i,5]),decreasing=TRUE))-t1
}
 }

 t2-NULL
 for(i in 1:nrow(t1)){
  if(i == 1) paste(unique(t1[i,t1[i,]0]),collapse=_)-t2
  else cbind(t2,paste(unique(t1[i,t1[i,]0]),collapse=_))-t2
 }

 tmp
 t1
 t2


 Any hints appreciated.
 Thanks
 Herry

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] p value statistic for lm object

2007-08-13 Thread Dieter Menne
Arjun Bhandari arb.em at adia.ae writes:

 I conduct a univariate regression with lm function. I would like to get 
 the p value for the regression. Is there a method that would enable me to 
 extract the p value into a variable.

# From lm docs (Sorry, Annette, for misusing your data)
ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
lm.D90 - lm(ctl ~ trt)
# let's look if it is in lm..
str(lm.D90)
# mmm.. looks like there are no p-test results
# try summary
sum.lm = summary(lm.D90)
sum.lm
# .. coming closer. 
# Colum Pr(|t|), row trt is what we are looking for
# Let's look into the structure
str(sum.lm)
# $coeffients has the wanted
sum.lm$coefficients
# looks good. We could use this, but better use the accessor function
# Check the documentation, but coef is always a good try
cf =  coef(sum.lm)
#now pick the right column
pslope = cf[trt,Pr(|t|)]
pslope ##
# Could also use index, but less safe in general, even if the 
# Pr(.. is definitively ugly
cf[2,4]
# In general, the $ approach is not recommened, if there is an 
# accessor funtion, use it. The closest (with no p-values) is
confint(lm.D90)
# Which probably tells more than the beloved p-values.
# The better the journal's referees, the more they prefer confints over p

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RServe

2007-08-13 Thread Barry Rowlingson
yoo wrote:
 Yea, I found the shutdown function in the java interface as well.. but is
 there a way I can send a shutdown command through linux shell? (something
 that I can cron?)

  Write a minimal java program that sends the shutdown command, then run 
that from your shell...

  /obvious

Barry

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] need help to manipulate function and time interval

2007-08-13 Thread Uwe Ligges


KOITA Lassana - STAC/ACE wrote:
 Hi,
 data are extracted from MS Access with the format: (%d/%m%Y %H%M%S); ex: 
 16/09/2006 03:38:37


1. the example you gave in your first message is still not reproducible, 
you gave the following:

myfunc - function(mytab, Time, Level)
{
vect - rep(0, length(mytab))
for(i in 1:length(vect))
{
 for(j in 1:length(Time))
 if(time[j] is between 18:00:00 and 23:59:59)
 L[i] - L[j]+5
 vect[i] - 10^((L[i])/10
 if (time[j] is between 22:00:00 and 05:59:59)
 L[i] - L[j]+10
 vect[i] - 10^((L[i])/10
 else
 L[i] = L[j]
 vect[i] - 10^((L[i])/10
  }
}


a) Please check the parentheses  (some closing ) are missing, you also 
probably want to group some code {} that is executed in some of the 
if conditions rather than executing the (syntactically erroneous) line
   vect[i] - 10^((L[i])/10
three times for each inner loop. Particularly, the else is 
syntactically incorrect with not preceding if.

So my guess is you want something like


myfunc - function(mytab, Time, Level)
{
vect - rep(0, length(mytab))
for(i in 1:length(vect))
{
 for(j in 1:length(Time))
 {
 if(time[j] is between 18:00:00 and 23:59:59){
 L[i] - L[j]+5
 vect[i] - 10^(L[i]/10)
 }
 if (time[j] is between 22:00:00 and 05:59:59){
 L[i] - L[j]+10
 vect[i] - 10^(L[i]/10)
 } else {
 L[i] - L[j]
 vect[i] - 10^(L[i]/10)
 }
 }
}

But I am really not sure about that and why you subsitute L[i] so many 
times...!


b) What are mytab, Time and Level?


2. Which is the format do you have?
(%d/%m%Y %H%M%S)
*or*
16/09/2006 03:38:37
If the latter, you can use
dat - strptime(16/09/2006 03:38:37, %d/%m/%Y %H:%M:%S)
in order to get some POSIXlt object for later calculations.


3. What do you mean with
time[j] is between 22:00:00 and 05:59:59
Is the day of the date important or not for this comparison?

Uwe Ligges












 I still have error messneger
 
 Thank you for your help. 
 
 Lassana KOITA 
 Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
 Project Engineer Airport Safety Studies  Statistical analysis
 Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 
 Department 
 Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
 Headquarters
 Tel: 01 49 56 80 60
 Fax: 01 49 56 82 14
 E-mail: [EMAIL PROTECTED]
 http://www.stac.aviation-civile.gouv.fr/
 
 
 
 Uwe Ligges [EMAIL PROTECTED] 
 12/08/2007 15:24
 
 A
 Matthew Walker [EMAIL PROTECTED]
 cc
 Henrique Dallazuanna [EMAIL PROTECTED], r-help@stat.math.ethz.ch, KOITA 
 Lassana - STAC/ACE [EMAIL PROTECTED]
 Objet
 Re: [R] need help to manipulate function and time interval
 
 
 
 
 
 
 
 
 Matthew Walker wrote:
 Uwe Ligges wrote:
 Henrique Dallazuanna wrote:

 Hi,

 Try whit:

 if(time[j] = 18:00:00   23:59:59)

 This code is obviously wrong and does not help for the next few lines 
 in the questioner's message, please do not post unsensible stuff.

 Uwe Ligges


 Actually, I would have said that was quite an interesting solution.  If 
 the time is guaranteed to be in this 8 character format, then that 
 idea's quite easily implemented:

 # Returns true if time is between 18:00:00 and 23:59:59
 check_time - function(time_string) {
  if (nchar(time_string)!=8) stop (Incorrect format)
  time_string = 18:00:00  time_string = 23:59:59
 }


   check_time(19:59:00)
 [1] TRUE
   check_time(16:59:00)
 [1] FALSE
  
   check_time(18:00:00)
 [1] TRUE
   check_time(23:59:59)
 [1] TRUE
   check_time(24:00:00)
 [1] FALSE
  
   check_time(18:05)
 Error in check_time(18:05) : Incorrect format


 Perhaps there is an issue if the locale does not sort character-based 
 numbers in the same way as ASCII?  But Otherwise, I can't see why this 
 solution wouldn't do the job.
  
 A more robust solution solution would parse the strings (?strptime) and 
 then check their days/hours/mins/seconds (?DateTimeClasses).  But 
 perhaps the above is sufficient?
 
 Well, the interesting part of the original question that everynody seems 
 to omit now was the second part:
 
 if (time[j] is between 22:00:00 and 05:59:59)
 
 hence the answer is still not sufficient (even if the syntax error has 
 been corrected) - and hence I asked for the format the time is 
 originally in.
 
 Uwe Ligges
 
 
 
 
 Cheers,

 Matthew
 
 
   [[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
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] need help to manipulate function and time interval

2007-08-13 Thread KOITA Lassana - STAC/ACE
a) I agreed with your suggestion about the condition else. L = Level of 
noise fluctuates during the various moments of the day (i.e L= L+5 between 
18:00:00 and 21:59:59; L=L+10 between 22:00:00 and 05:59:59 and L = L 
else).
b)
mytab is a data table including Time column, Level column,  ,
Time - Table[,time] and Level - Table[, Levele]
c) Time format is 16/09/2006 03:38:37
 d)
the time interval [ 18:00:00 ; 21:59:59 ]and  [ 22:00:00 ; 05:59:59] is 
very important for me.

Best regards 
 


Lassana KOITA 
Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
Project Engineer Airport Safety Studies  Statistical analysis
Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 
Department 
Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
Headquarters
Tel: 01 49 56 80 60
Fax: 01 49 56 82 14
E-mail: [EMAIL PROTECTED]
http://www.stac.aviation-civile.gouv.fr/



Uwe Ligges [EMAIL PROTECTED] 
Envoyé par : [EMAIL PROTECTED]
13/08/2007 10:39

A
KOITA Lassana - STAC/ACE [EMAIL PROTECTED]
cc
r-help@stat.math.ethz.ch
Objet
Re: [R] need help to manipulate function and time interval








KOITA Lassana - STAC/ACE wrote:
 Hi,
 data are extracted from MS Access with the format: (%d/%m%Y %H%M%S); 
ex: 
 16/09/2006 03:38:37


1. the example you gave in your first message is still not reproducible, 
you gave the following:

myfunc - function(mytab, Time, Level)
{
vect - rep(0, length(mytab))
for(i in 1:length(vect))
{
 for(j in 1:length(Time))
 if(time[j] is between 18:00:00 and 23:59:59)
 L[i] - L[j]+5
 vect[i] - 10^((L[i])/10
 if (time[j] is between 22:00:00 and 05:59:59)
 L[i] - L[j]+10
 vect[i] - 10^((L[i])/10
 else
 L[i] = L[j]
 vect[i] - 10^((L[i])/10
  }
}


a) Please check the parentheses  (some closing ) are missing, you also 
probably want to group some code {} that is executed in some of the 
if conditions rather than executing the (syntactically erroneous) line
   vect[i] - 10^((L[i])/10
three times for each inner loop. Particularly, the else is 
syntactically incorrect with not preceding if.

So my guess is you want something like


myfunc - function(mytab, Time, Level)
{
vect - rep(0, length(mytab))
for(i in 1:length(vect))
{
 for(j in 1:length(Time))
 {
 if(time[j] is between 18:00:00 and 23:59:59){
 L[i] - L[j]+5
 vect[i] - 10^(L[i]/10)
 }
 if (time[j] is between 22:00:00 and 05:59:59){
 L[i] - L[j]+10
 vect[i] - 10^(L[i]/10)
 } else {
 L[i] - L[j]
 vect[i] - 10^(L[i]/10)
 }
 }
}

But I am really not sure about that and why you subsitute L[i] so many 
times...!


b) What are mytab, Time and Level?


2. Which is the format do you have?
(%d/%m%Y %H%M%S)
*or*
16/09/2006 03:38:37
If the latter, you can use
dat - strptime(16/09/2006 03:38:37, %d/%m/%Y %H:%M:%S)
in order to get some POSIXlt object for later calculations.


3. What do you mean with
time[j] is between 22:00:00 and 05:59:59
Is the day of the date important or not for this comparison?

Uwe Ligges












 I still have error messneger
 
 Thank you for your help. 
 
 Lassana KOITA 
 Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
 Project Engineer Airport Safety Studies  Statistical analysis
 Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 

 Department 
 Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
 Headquarters
 Tel: 01 49 56 80 60
 Fax: 01 49 56 82 14
 E-mail: [EMAIL PROTECTED]
 http://www.stac.aviation-civile.gouv.fr/
 
 
 
 Uwe Ligges [EMAIL PROTECTED] 
 12/08/2007 15:24
 
 A
 Matthew Walker [EMAIL PROTECTED]
 cc
 Henrique Dallazuanna [EMAIL PROTECTED], r-help@stat.math.ethz.ch, KOITA 

 Lassana - STAC/ACE [EMAIL PROTECTED]
 Objet
 Re: [R] need help to manipulate function and time interval
 
 
 
 
 
 
 
 
 Matthew Walker wrote:
 Uwe Ligges wrote:
 Henrique Dallazuanna wrote:

 Hi,

 Try whit:

 if(time[j] = 18:00:00   23:59:59)

 This code is obviously wrong and does not help for the next few lines 
 in the questioner's message, please do not post unsensible stuff.

 Uwe Ligges


 Actually, I would have said that was quite an interesting solution.  If 

 the time is guaranteed to be in this 8 character format, then that 
 idea's quite easily implemented:

 # Returns true if time is between 18:00:00 and 23:59:59
 check_time - function(time_string) {
  if (nchar(time_string)!=8) stop (Incorrect format)
  time_string = 18:00:00  time_string = 23:59:59
 }


   check_time(19:59:00)
 [1] TRUE
   check_time(16:59:00)
 [1] FALSE
  
   check_time(18:00:00)
 [1] TRUE
   check_time(23:59:59)
 [1] TRUE
   check_time(24:00:00)
 [1] FALSE
  
   check_time(18:05)
 Error in check_time(18:05) : Incorrect format


 Perhaps there is an issue if the locale does not sort character-based 
 numbers in the same 

Re: [R] How to store the parameter estimated by nls( ) to a variable?

2007-08-13 Thread Joerg van den Hoff
On Sun, Aug 12, 2007 at 10:50:59AM -0700, Yuchen Luo wrote:
 Dear Professor Murdoch.
 Thank you so much
 
 Best Wishes
 Yuchen Luo
 
 On 8/12/07, Duncan Murdoch [EMAIL PROTECTED] wrote:
 
  Yuchen Luo wrote:
   Dear Colleagues.
  
   I believe this should be a problem encountered by many:
  
   nls( ) is a very useful and efficient function to use if we are just to
   display the estimated value on screen. What if we need R to store the
   estimated parameter in a variable?
  
   For example:
  
   x=rnorm(10, mean=1000, sd=10)
  
   y=x^2+100+rnorm(10)
  
   a=nls(y~(x^2+para),control=list(maxiter = 1000, minFactor=0.5
   ^1024),start=list(para=0.0))
  
   How to store the estimated value of para in this case, in a variable,
  say,
   b?
  
   It is easy to display a and find all the information. How ever, I need
  to
   fit a different set of x and y in every loop of my code and I need to
  store
   the estimated values for further use. I have checked both the online
  manual
   and several S-plus books but no example as such showed up.
  
   Your help will be highly appreciated!
 
  coef(a) will get what you want.  coef() works for most modelling
  functions where it makes sense.
 
  Duncan Murdoch
 
 

further information might be extracted from the `summary' return value.
e.g., if you need not only the parameters but also their error
estimates, you could get them via

summary(a)$parameters[, Std. Error]

(question: is this the canonical way to do it or is their a better one?)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to write to a table column by column?

2007-08-13 Thread jim holtman
Assuming that the daily.incomes are the same lengths, then your loop could be:

Lst - list()
for (i in 1:count) Lst[[i]] - list(..)
Lst.col - do.call('cbind', Lst)

On 8/12/07, Yuchen Luo [EMAIL PROTECTED] wrote:
 Dear friends.
 Every loop of my program will result in a list that is very long, with a
 structure similar to the one below:

 Lst - list(name=Fred, wife=Mary, daily.incomes=c(1:850))

 Please notice the large size of daily.incomes.

 I need to store all such lists in a csv file so that I can easily view them
 in Excel. Excel cannot display a row of more than 300 elements, therefore, I
 have to store the lists as columns. It is not hard to store one list as a
 column in the csv file. The problem is how to store the second list as a
 second column, so that the two columns will lie side by side to each other
 and I can easily compare their elements. ( If I use 'appened=TRUE', the
 second time series will be stored in the same column. )

 Thank you for your tine and your help will be highly appreciated!!

 Best

 Yuchen Luo

[[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
 and provide commented, minimal, self-contained, reproducible code.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is 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
and provide commented, minimal, self-contained, reproducible code.


[R] question regarding is.factor()

2007-08-13 Thread Jabez Wilson
Dear all, please help with what must be a straightforward question which I 
can't answer.
   
  I add a column of my dataframe as factor of an existing column e.g.
   
  df[,5] - factor(df[,2])
   
  and can test that it is by is.factor()
   
  but if I did not know in advance what types the columns were, is there a 
function to tell me what they are.
   
  i.e. instead of is.factor(), is.matrix(), is.list(), a function more like 
what.is()
   
   
   

   
-

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question regarding is.factor()

2007-08-13 Thread Prof Brian Ripley
typeof() for 'types'.

However, factor is not a type but a class, so class() is probably what 
you want.

On Mon, 13 Aug 2007, Jabez Wilson wrote:

 Dear all, please help with what must be a straightforward question which 
 I can't answer.

But 'An Introduction to R' could.

  I add a column of my dataframe as factor of an existing column e.g.

  df[,5] - factor(df[,2])

  and can test that it is by is.factor()

  but if I did not know in advance what types the columns were, is 
 there a function to tell me what they are.

  i.e. instead of is.factor(), is.matrix(), is.list(), a function more 
 like what.is()


 -

   [[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
 and provide commented, minimal, self-contained, reproducible code.


-- 
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question regarding is.factor()

2007-08-13 Thread Henrique Dallazuanna
See ?class

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

On 13/08/07, Jabez Wilson [EMAIL PROTECTED] wrote:

 Dear all, please help with what must be a straightforward question which I
 can't answer.

   I add a column of my dataframe as factor of an existing column e.g.

   df[,5] - factor(df[,2])

   and can test that it is by is.factor()

   but if I did not know in advance what types the columns were, is there
 a function to tell me what they are.

   i.e. instead of is.factor(), is.matrix(), is.list(), a function more
 like what.is()





 -

 [[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
 and provide commented, minimal, self-contained, reproducible code.


[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Values in horizontal versus vertical position on 'y' axe

2007-08-13 Thread akki
hi,
When I do a graph. the values on y axe are vertical position. How can I put
the values in horizontal position?

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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Values in horizontal versus vertical position on 'y' axe

2007-08-13 Thread Mike Meredith


? par# then scroll down to look at 'las'

You probably want

par(las=1)

HTH, Mike.


akki wrote:
 
 hi,
 When I do a graph. the values on y axe are vertical position. How can I
 put
 the values in horizontal position?
 
 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
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Values-in-horizontal-versus-vertical-position-on-%27y%27-axe-tf4260726.html#a12124985
Sent from the R help mailing list archive at Nabble.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
and provide commented, minimal, self-contained, reproducible code.


[R] Very new - beginners questions

2007-08-13 Thread Richard Price
Dear all,
   
  
I have 4 sites and want to determine how different they are from each other. 
For this I have decided to use R though it seems a bit daunting to learn.
  I have read data in from a CSV the structure is :
   
   Species1 Species2 Species3
  
Site1 4 4  7  
Site2 3 1  0
Site3 0 99  6
Site4 75 3  33
  
There are many more species than shown above this is just an example. Here are 
the questions.
   
  How do I read one row of data so as to load site2 into a variable called 
site2?
  
Once I plot a graph using ordiplot how do I extract it from R so that I can put 
it into a Word for Windows document?
   
  Once I have the data in varables I hope to use designdist and Sørensen to 
discover diversity indices. I had a crack at this once but because I had sites 
as the columns it didn't work. Now that I think I have the data correct I can 
proceed.
   
  x Input data (this will be the whole data set that I read into my variable 
'allSites' from a CSV.)?
  
The variables for Sørensen will contain terms J for shared quantity, A and B 
for totals, N for the number of rows (sites) and P for the number of columns 
(species) and 'Binary' as the term.
   
  How do I get the shared number of species for each row?
   
  Probably very beginner type questions but I want to get on an haven't yet 
found the answers in my trawl throgh the help. Is there a book that I can buy 
to learn R?
   
  All the best,
Richard Price
MSc student University Birmingham.



[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Values in horizontal versus vertical position on 'y' axe

2007-08-13 Thread Gavin Simpson
On Mon, 2007-08-13 at 13:37 +0200, akki wrote:
 hi,
 When I do a graph. the values on y axe are vertical position. How can I put
 the values in horizontal position?
 
 thanks

If you mean How do I rotate the tick labels? then look at ?par and
parameter 'las'. E.g. this shows the options available:

opar - par(mfrow = c(2,2))
plot(1:10, main = expression(las == 0)) ## las = 0, default
plot(1:10, las = 1, main = expression(las == 1))
plot(1:10, las = 2, main = expression(las == 2))
plot(1:10, las = 3, main = expression(las == 3))
par(opar)

If not, try rephrasing your question, and provide an example of what you
can plot at the moment and what is wrong with it that you'd like to
change.

HTH

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Robust estimators for ordered logistic regression

2007-08-13 Thread L . Stirton
Hello,

I am trying to estimate an ordered logistic regression in R, and I wish to
use robust estimators. Can this be (simply) done? More specifically, can
this be done using polr (in MASS) together with sandwich. I am using R
2.5.1 on Mac OS 10.4.10. If not, is there any other way?

I can fit a model using polr, and then try:

coeftest(fit8.polr, df=NULL, vcovHC(fit8.polr, type=HC3))

When I do this R returns the error:

Error in estfun(x) : no applicable error for estfun

This is the first time I have tried to use sandwich, so I wouldn't be
surprised if I was doing something dumb--but I can't see what. I have been
working through Achim Zeileis's Econometric Computing with HC and HAC
Covariance Matrix Estimators.

Any help greatly appreciated.

Lindsay Stirton

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with axes plotting

2007-08-13 Thread akki
Hi,
I've 2 little questions:
Is possible change the size of the values of x and y axes, when I do plot??
How can I put a range of 0.0001 to 5.5000, although my max value is 4 on 'y'
axe log scale (without pattern 1e-0'X')?

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
and provide commented, minimal, self-contained, reproducible code.


[R] statdataml question

2007-08-13 Thread bryan rasmussen
Hi,

I was wondering if Statdataml is currently the preferred way to
represent statistical data in XML in R. And also if the Statdataml api
provides ways to load the XML as a HTTP GET?

If so can you give me an easy example of this. Thanks.

Cheers,
Bryan Rasmussen

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Very new - beginners questions

2007-08-13 Thread Vladimir Eremeev

Hi.
You should study An Introduction to R manual.
It is installed with R in PDF format and is accessible from the menu (Help
- Manuals (in PDF)  - )
There are several links in the R web site.
Go to http://www.r-project.org/ and see links under the word Documentation
in the left frame.
There are some contributed documents:
http://cran.r-project.org/other-docs.html

Array manipulations are described in the chapter 5 of the Introduction.
The plot window has its own menu allowing using of the Windows clipboard
(you didn't describe your system, but Word for Windows suggests you're on
Windows).


Richard Price-4 wrote:
 
 Dear all,
   
 I have 4 sites and want to determine how different they are from each
 other. For this I have decided to use R though it seems a bit daunting to
 learn.
   I have read data in from a CSV the structure is :

Species1 Species2 Species3
   
 Site1 4 4  7  
 Site2 3 1  0
 Site3 0 99  6
 Site4 75 3  33
   
 There are many more species than shown above this is just an example. Here
 are the questions.

   How do I read one row of data so as to load site2 into a variable called
 site2?
   
 Once I plot a graph using ordiplot how do I extract it from R so that I
 can put it into a Word for Windows document?

   Once I have the data in varables I hope to use designdist and Sørensen
 to discover diversity indices. I had a crack at this once but because I
 had sites as the columns it didn't work. Now that I think I have the data
 correct I can proceed.

   x Input data (this will be the whole data set that I read into my
 variable 'allSites' from a CSV.)?
   
 The variables for Sørensen will contain terms J for shared quantity, A and
 B for totals, N for the number of rows (sites) and P for the number of
 columns (species) and 'Binary' as the term.

   How do I get the shared number of species for each row?

   Probably very beginner type questions but I want to get on an haven't
 yet found the answers in my trawl throgh the help. Is there a book that I
 can buy to learn R?

   All the best,
 Richard Price
 MSc student University Birmingham.
 
 

-- 
View this message in context: 
http://www.nabble.com/Very-new---beginners-questions-tf4260866.html#a12125845
Sent from the R help mailing list archive at Nabble.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
and provide commented, minimal, self-contained, reproducible code.


[R] Odp: Very new - beginners questions

2007-08-13 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 13.08.2007 14:04:50:

 Dear all,
 
 
 I have 4 sites and want to determine how different they are from each 
other. 
 For this I have decided to use R though it seems a bit daunting to 
learn.
   I have read data in from a CSV the structure is :
 
Species1 Species2 Species3
 
 Site1 4 4  7 
 Site2 3 1  0
 Site3 0 99  6
 Site4 75 3  33
 
 There are many more species than shown above this is just an example. 
Here are
 the questions.
 
   How do I read one row of data so as to load site2 into a variable 
called site2?

?read.table and other read. commands. Do not work with variables but 
with data frames. 

 
 Once I plot a graph using ordiplot how do I extract it from R so that I 
can 
 put it into a Word for Windows document?

1. save a graph from menu
2. use ?png, ?jpeg and others to see how to output graph to files 
(devices)


 
   Once I have the data in varables I hope to use designdist and Sřrensen 
to 
 discover diversity indices. I had a crack at this once but because I had 
sites
 as the columns it didn't work. Now that I think I have the data correct 
I can proceed.
 
   x Input data (this will be the whole data set that I read into my 
variable 
 'allSites' from a CSV.)?
 
 The variables for Sřrensen will contain terms J for shared quantity, A 
and B 
 for totals, N for the number of rows (sites) and P for the number of 
columns 
 (species) and 'Binary' as the term.
 
   How do I get the shared number of species for each row?
 
   Probably very beginner type questions but I want to get on an haven't 
yet 
 found the answers in my trawl throgh the help. Is there a book that I 
can buy 
 to learn R?

look at CRAN. You can find various books from beginners to quite advanced. 
e.g. P.Dalgaard Introductory statistics with R isd quite good for first 
steps. Or you can consult Rtips from Paul Johnson. (Just type statsrus 
into Google). Good idea is also to look into posting guide.

Regards
Petr

 
   All the best,
 Richard Price
 MSc student University Birmingham.
 
 
 
[[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
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Very new - beginners questions

2007-08-13 Thread John Kane
Hi Richard,

No specific answers for your data questions but for
learning R there are any number of resources.

There are links to references for books and a large
number of on-line materials on the R website.  Have a
look at the list on the bottom left of the screen for
books and other which leads to contributed
documentation. 

 Books by Dalgaard, Verzani and Crawley all get good
reviews. 

In the contributed documents area Using R for Data
Analysis and Graphics - Introduction, Examples and
Commentary”  by John Maindonald  and Kickstarting R
by Jim Lemon are both very useful.

I have also found that while An Introduction to R is
invaluable it is best to download it and keep it as a
pdf or a hard copy.  Also it is better as a 'second
intro' after you have looked at some of the books or
other supporting documentation.

Don't forget to browse the FAQs.  They answer some of
the more vexing questions about R very well.

(Oh if you want to move a graph from R to Word in
Windows just right click on the graph and copy it.)
--- Richard Price [EMAIL PROTECTED] wrote:

 Dear all,

   
 I have 4 sites and want to determine how different
 they are from each other. For this I have decided to
 use R though it seems a bit daunting to learn.
   I have read data in from a CSV the structure is :

Species1 Species2 Species3
   
 Site1 4 4  7  
 Site2 3 1  0
 Site3 0 99  6
 Site4 75 3  33
   
 There are many more species than shown above this is
 just an example. Here are the questions.

   How do I read one row of data so as to load site2
 into a variable called site2?
   
 Once I plot a graph using ordiplot how do I extract
 it from R so that I can put it into a Word for
 Windows document?

   Once I have the data in varables I hope to use
 designdist and Sørensen to discover diversity
 indices. I had a crack at this once but because I
 had sites as the columns it didn't work. Now that I
 think I have the data correct I can proceed.

   x Input data (this will be the whole data set that
 I read into my variable 'allSites' from a CSV.)?
   
 The variables for Sørensen will contain terms J for
 shared quantity, A and B for totals, N for the
 number of rows (sites) and P for the number of
 columns (species) and 'Binary' as the term.

   How do I get the shared number of species for each
 row?

   Probably very beginner type questions but I want
 to get on an haven't yet found the answers in my
 trawl throgh the help. Is there a book that I can
 buy to learn R?

   All the best,
 Richard Price
 MSc student University Birmingham.
 
 
 
   [[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
 and provide commented, minimal, self-contained,
 reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Odp: Very new - beginners questions

2007-08-13 Thread S Ellison


 Petr PIKAL [EMAIL PROTECTED] 13/08/2007 14:10:40 
   How do I read one row of data so as to load site2 into a variable 
called site2?

?read.table and other read. commands. 

Don't forget scan(). But Petr is right, you probably do not need to read one 
row at a time. 

 Once I plot a graph using ordiplot how do I extract it from R so that I can 
 put it into a Word for Windows document?
1. save a graph from menu
Use windows metafile format for Word compatibility.

2. use ?png, ?jpeg and others to see how to output graph to files 
(devices)
In particular, see ?savePlot and note the emf type for windows compatibility.



***
This email contains information which may be confidential and/or privileged, 
and is intended only for the individual(s) or organisation(s) named above. If 
you are not the intended recipient, then please note that any disclosure, 
copying, distribution or use of the contents of this email is prohibited. 
Internet communications are not 100% secure and therefore we ask that you 
acknowledge this. If you have received this email in error, please notify the 
sender or contact +44(0)20 8943 7000 or [EMAIL PROTECTED] immediately, and 
delete this email and any attachments and copies from your system. Thank you. 

LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex TW11 0LY, UK

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Michael Kubovy
Dear Friends,

Thanks for your input.

FYI: Preview doesn't show PDF aliasing in the image I produced if I  
uncheck the Anti-alias text and line art box under the PDF tab in  
Preferences. So I'm not yet ready to drop Preview from my toolbox.

MK

On Aug 13, 2007, at 12:02 AM, Mark Wardle wrote:

 It may be worth outputting postscript and converting to PDF from
 there. Although Preview can do this, it may be worth looking at
 Ghostscript which *may* not have simila problems.

 I have also had PDFs which have displayed well in Preview and open
 source tools and have been garbled in Adobe Acrobat, so the problems
 aren't limited to Preview.

 Best wishes,

 Mark

 On 13/08/07, Duncan Murdoch [EMAIL PROTECTED] wrote:

 Michael Kubovy wrote:
 On Aug 12, 2007, at 6:24 AM, Duncan Murdoch wrote:

 Michael Kubovy wrote:

 Dear r-helpers,

 In my previous message there were comments in the code that may
 have  made cutting and pasting awkward. Here it is w/o them.

 I have two questions:

 (1) The following produces a pdf with artifacts. How do I prevent
 them?


 What artifacts do you see?  It looks like a smoothly varying field
 when produced by R 2.5.1 and viewed in Acrobat Reader 6.0 on  
 Windows.

 Duncan Murdoch

 require(grDevices)
 imSize - 200
 lambda - 10
 theta - 15
 sigma - 40
 x - 1:imSize
 x0 - x / imSize -.5
 freq = imSize/lambda
 xf = x0 * freq * 2 * pi
 f - function(x, y){r - -((x^2 + y^2)/(sigma ^2)); exp(r)}
 z - outer(xf, xf, f)
 f1 - function(x, y){cos(.1 * x)}
 z1 - outer(xf, xf, f1)
 pdf('gabor.pdf')
 image(xf, xf, z * z1, col = gray(250:1000/1000),
 xlab = '', ylab =  '', bty = 'n', axes = FALSE, asp = 1)
 dev.off()


 I'm working on a Mac. You're right, Acrobat 6.05 renders the figure
 nicely, but when it's included in a LaTeX-produced pdf or viewed  
 with
 the Mac Preview program, a grid of fine white lines is superimposed
 on the figure. So I believe that it's a matter of aliasing, which I
 might be able to prevent by adjusting the parameters of the figures.
 I just don't know enough to figure this out, and would appreciate
 guidance.
 I see the artifacts in Preview on a Mac too.  So it looks to me  
 like a
 Mac bug.

 Preview is actually pretty poor at graphics display; see
 http://www.geuz.org/pipermail/gl2ps/2007/000223.html.

 My only suggestion is not to use Preview.

 Duncan Murdoch
 -- 
 Dr. Mark Wardle
 Clinical research fellow and specialist registrar, Neurology
 Cardiff, UK

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Duncan Murdoch
On 8/13/2007 11:07 AM, Michael Kubovy wrote:
 Dear Friends,
 
 Thanks for your input.
 
 FYI: Preview doesn't show PDF aliasing in the image I produced if I  
 uncheck the Anti-alias text and line art box under the PDF tab in  
 Preferences. So I'm not yet ready to drop Preview from my toolbox.

An alternative to dropping Preview is to report the bug in it to Apple. 
  Apple has an online bug reporting web page somewhere; I haven't found 
them as helpful as R-help, but your mileage may vary.

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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Convert factor to numeric vector of labels

2007-08-13 Thread John Kane
This is one of R's rather _endearing_  little 
idiosyncrasies. I ran into it a while ago.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/98090.html


For some reason, possibly historical, the option
stringAsFactors is set to TRUE.  

As Prof Ripley says FAQ 7.10 will tell you
as.numeric(as.character(f)) # for a one-off conversion

From Gabor Grothendieck  A one-off solution for a
complete data.frame

DF - data.frame(let = letters[1:3], num = 1:3,
 stringsAsFactors = FALSE)

str(DF)  # to see what has happened.

You can reset the option globally, see below.  However
you might want to read Gabor Grothendieck's comment
about this in the thread referenced above since it
could cause problems if you transfer files alot. 

Personally I went with the global option since I don't
tend to transfer programs to other people and I was
getting tired of tracking down errors in my programs
caused by numeric and character variables suddenly
deciding to become factors.

From Steven Tucker:

You can also this option globally with
 options(stringsAsFactors = TRUE)  # in
\library\base\R\Rprofile
 
--- Falk Lieder [EMAIL PROTECTED] wrote:

 Hi,
 
 I have imported a data file to R. Unfortunately R
 has interpreted some
 numeric variables as factors. Therefore I want to
 reconvert these to numeric
 vectors whose values are the factor levels' labels.
 I tried
 as.numeric(factor),
 but it returns a vector of factor levels (i.e.
 1,2,3,...) instead of labels
 (i.e. 0.71, 1.34, 2.61,…).
 What can I do instead?
 
 Best wishes, Falk

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Michael Kubovy
But is it a bug? Can a program anti-alias text and line drawings and  
not bitmaps?

On Aug 13, 2007, at 9:30 AM, Duncan Murdoch wrote:

 On 8/13/2007 11:07 AM, Michael Kubovy wrote:
 Dear Friends,
 Thanks for your input.
 FYI: Preview doesn't show PDF aliasing in the image I produced if  
 I  uncheck the Anti-alias text and line art box under the PDF  
 tab in  Preferences. So I'm not yet ready to drop Preview from my  
 toolbox.

 An alternative to dropping Preview is to report the bug in it to  
 Apple.  Apple has an online bug reporting web page somewhere; I  
 haven't found them as helpful as R-help, but your mileage may vary.

 Duncan Murdoch

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] feature's contribution into classification

2007-08-13 Thread Weiwei Shi
Hi, there:

The following question is more of statistics:

assume i have 5 features in a classification, and I am wondering which
methodology can help me identify which feature contributes the most
to classify a specific sample?

I knew some simple modeling like logistic regression probably can do
it since it provides an explicit formulae for that. Any others?

I tried to use lda{MASS} and posted the question last week but I did
not get any response. So again, I re-phrase my question.

Thanks.

WEIWEI

My previous questions are also attached for reference.


hi,

maybe I should re-phrase my question a bit:

is there a way to get explicit formulae like Y ~ sum of CiXi from the
model build by lda{MASS} to calculate $x (value) ?

I assume scaling is the coeff and Xi is from test data and Y is $x
called LD1. But I want to confirm this.


##

hi,

assume
val is the test data while m is lda model value by using CV=F

x = predict(m, val)

val2 = val[, 1:(ncol(val)-1)] # the last column is class label

# col is sample, row is variable

then I am wondering if

x$x == (apply(val2*m$scaling), 2, sum)

i.e., the scaling (is it coeff vector?) times val data and sum is the
discrimant result $x?


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Duncan Murdoch
On 8/13/2007 11:43 AM, Michael Kubovy wrote:
 But is it a bug? Can a program anti-alias text and line drawings and  
 not bitmaps?

Anti-aliasing is the removal of artifacts caused by displaying an image 
on a low-resolution bitmapped display.  Introducing artifacts is a bug.

If it wasn't a bug, why did it bother you so much?  And why do you think 
it's reasonable to complain about it on R-help, but not to complain 
about it to Apple, who are clearly responsible for it?

Duncan Murdoch

 
 On Aug 13, 2007, at 9:30 AM, Duncan Murdoch wrote:
 
 On 8/13/2007 11:07 AM, Michael Kubovy wrote:
 Dear Friends,
 Thanks for your input.
 FYI: Preview doesn't show PDF aliasing in the image I produced if  
 I  uncheck the Anti-alias text and line art box under the PDF  
 tab in  Preferences. So I'm not yet ready to drop Preview from my  
 toolbox.

 An alternative to dropping Preview is to report the bug in it to  
 Apple.  Apple has an online bug reporting web page somewhere; I  
 haven't found them as helpful as R-help, but your mileage may vary.

 Duncan Murdoch
 
 _
 Professor Michael Kubovy
 University of Virginia
 Department of Psychology
 USPS: P.O.Box 400400Charlottesville, VA 22904-4400
 Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, VA 22903
 Office:B011+1-434-982-4729
 Lab:B019+1-434-982-4751
 Fax:+1-434-982-4766
 WWW:http://www.people.virginia.edu/~mk9y/


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xyplot() with segments() superposed?

2007-08-13 Thread Deepayan Sarkar
On 8/11/07, Yuelin Li [EMAIL PROTECTED] wrote:
 In the hypothetical example below, how do I add two segments() into
 the two panels, respectively?  Say segments(x0=5, y0=10, x1=5, y1=20)
 on the left and segments(x0=15, y0=-10, x1=15, y1=-2) on the right?
 Many thanks in advance,

 Yuelin Li.

 ps. part of the code came from a solution given by Deepayan Sarkar.

 ---
 library(lattice)
 set.seed(12345)
 x - 0:20
 y.male.obs - - 1.2 * x + 22 + rnorm(length(x), sd = 3)
 y.male.prd - - 1.2 * x + 22
 y.fema.obs - - 2.2 * x + 30 + rnorm(length(x), sd = 2)
 y.fema.prd - - 2.2 * x + 30
 tdat - data.frame(x = rep(x, 8),
 y = rep(c(y.male.obs, y.male.prd, y.fema.obs, y.fema.prd), 2),
 sex = rep(rep(c(m, f), each = 2*length(x)), 2),
 cohort = rep(c(1970, 1980), each = 4*length(x)),
 source = rep(rep(c(obs, prd), each = length(x)), 4)  )
 xyplot(y ~ x | as.factor(cohort), data = tdat,
groups = interaction(sex, source),
type = c(p, p, l, l), distribute.type = TRUE)

If this is a one-off requirement, the simplest solution is:

xyplot(y ~ x | as.factor(cohort), data = tdat,
   groups = interaction(sex, source),
   type = c(p, p, l, l), distribute.type = TRUE,
   panel = function(...) {
   panel.xyplot(...)
   switch(panel.number(),
  panel.segments(x0=5, y0=10, x1=5, y1=20),
  panel.segments(x0=15, y0=-10, x1=15, y1=-2))
   })

This is not generalizable, but you haven't told us your general use case.

-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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Systematically biased count data regression model

2007-08-13 Thread Matthew and Kim Bowser
Dear all,

Thank you for your helpful comments.  I have acquired and read
Steyerberg (2001).  I may try some of the methods from that paper.

This did prompt a thorough examination of the data.  Sure enough, my
worst outlier, where little diversity was observed and the NDVI
measurment was very high, had been stripped of vegetation between the
time of the NDVI data and the arthropod sampling by an avalanche.

Sincerely,

Matthew Bowser


On 8/9/07, Steven McKinney [EMAIL PROTECTED] wrote:
 Hi Matthew,

 You may be experiencing the classic
 'regression towards the mean' phenomenon,
 in which case shrinkage estimation may help
 with prediction (extremely low and high values
 need to be shrunk back towards the mean)

 Here's a reference that discusses the issue
 in a manner somewhat related to your situation,
 and it has plenty of good references


 Application of Shrinkage Techniques in Logistic Regression Analysis: A Case 
 Study

 E. W. Steyerberg

 Statistica Neerlandica, 2001, vol. 55, issue 1, pages 76-88




 Steven McKinney

 Statistician
 Molecular Oncology and Breast Cancer Program
 British Columbia Cancer Research Centre

 email: smckinney +at+ bccrc +dot+ ca

 tel: 604-675-8000 x7561

 BCCRC
 Molecular Oncology
 675 West 10th Ave, Floor 4
 Vancouver B.C.
 V5Z 1L3
 Canada




 -Original Message-
 From: [EMAIL PROTECTED] on behalf of Matthew and Kim Bowser
 Sent: Thu 8/9/2007 8:43 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Systematically biased count data regression model

 Dear all,

 I am attempting to explain patterns of arthropod family richness
 (count data) using a regression model.  It seems to be able to do a
 pretty good job as an explanatory model (i.e. demonstrating
 relationships between dependent and independent variables), but it has
 systematic problems as a predictive model:  It is biased high at low
 observed values of family richness and biased low at high observed
 values of family richness (see attached pdf).  I have tried diverse
 kinds of reasonable regression models mostly as in Zeileis, et al.
 (2007), as well as transforming my variables, both with only small
 improvements.

 Do you have suggestions for making a model that would perform better
 as a predictive model?

 Thank you for your time.

 Sincerely,

 Matthew Bowser

 STEP student
 USFWS Kenai National Wildlife Refuge
 Soldotna, Alaska, USA

 M.Sc. student
 University of Alaska Fairbanks
 Fairbankse, Alaska, USA

 Reference

 Zeileis, A., C. Kleiber, and S. Jackman, 2007. Regression models for
 count data in R. Technical Report 53, Department of Statistics and
 Mathematics, Wirtschaftsuniversität Wien, Wien, Austria. URL
 http://cran.r-project.org/doc/vignettes/pscl/countreg.pdf.

 Code

 `data` -
 structure(list(D = c(4, 5, 12, 4, 9, 15, 4, 8, 3, 9, 6, 17, 4,
 9, 6, 9, 3, 9, 7, 11, 17, 3, 10, 8, 9, 6, 7, 9, 7, 5, 15, 15,
 12, 9, 10, 4, 4, 15, 7, 7, 12, 7, 12, 7, 7, 7, 5, 14, 7, 13,
 1, 9, 2, 13, 6, 8, 2, 10, 5, 14, 4, 13, 5, 17, 12, 13, 7, 12,
 5, 6, 10, 6, 6, 10, 4, 4, 12, 10, 3, 4, 4, 6, 7, 15, 1, 8, 8,
 5, 12, 0, 5, 7, 4, 9, 6, 10, 5, 7, 7, 14, 3, 8, 15, 14, 7, 8,
 7, 8, 8, 10, 9, 2, 7, 8, 2, 6, 7, 9, 3, 20, 10, 10, 4, 2, 8,
 10, 10, 8, 8, 12, 8, 6, 16, 10, 5, 1, 1, 5, 3, 11, 4, 9, 16,
 3, 1, 6, 5, 5, 7, 11, 11, 5, 7, 5, 3, 2, 3, 0, 3, 0, 4, 1, 12,
 16, 9, 0, 7, 0, 11, 7, 9, 4, 16, 9, 10, 0, 1, 9, 15, 6, 8, 6,
 4, 6, 7, 5, 7, 14, 16, 5, 8, 1, 8, 2, 10, 9, 6, 11, 3, 16, 3,
 6, 8, 12, 5, 1, 1, 3, 3, 1, 5, 15, 4, 2, 2, 6, 5, 0, 0, 0, 3,
 0, 16, 0, 9, 0, 0, 8, 1, 2, 2, 3, 4, 17, 4, 1, 4, 6, 4, 3, 15,
 2, 2, 13, 1, 9, 7, 7, 13, 10, 11, 2, 15, 7), Day = c(159, 159,
 159, 159, 166, 175, 161, 168, 161, 166, 161, 166, 161, 161, 161,
 175, 161, 175, 161, 165, 176, 161, 163, 161, 168, 161, 161, 161,
 161, 161, 165, 176, 175, 176, 163, 175, 163, 168, 163, 176, 176,
 165, 176, 175, 161, 163, 163, 168, 163, 175, 167, 176, 167, 165,
 165, 169, 165, 169, 165, 161, 165, 175, 165, 176, 175, 167, 167,
 175, 167, 164, 167, 164, 181, 164, 167, 164, 176, 164, 167, 164,
 167, 164, 167, 175, 167, 173, 176, 173, 178, 167, 173, 172, 173,
 178, 178, 172, 181, 182, 173, 162, 162, 173, 178, 173, 172, 162,
 173, 162, 173, 162, 173, 170, 178, 166, 166, 162, 166, 177, 166,
 170, 166, 172, 172, 166, 172, 166, 174, 162, 164, 162, 170, 164,
 170, 164, 170, 164, 177, 164, 164, 174, 174, 162, 170, 162, 172,
 162, 165, 162, 165, 177, 172, 162, 170, 162, 170, 174, 165, 174,
 166, 172, 174, 172, 174, 170, 170, 165, 170, 174, 174, 172, 174,
 172, 174, 165, 170, 165, 170, 174, 172, 174, 172, 175, 175, 170,
 171, 174, 174, 174, 172, 175, 171, 175, 174, 174, 174, 175, 172,
 171, 171, 174, 160, 175, 160, 171, 170, 175, 170, 170, 160, 160,
 160, 171, 171, 171, 171, 160, 160, 160, 171, 171, 176, 171, 176,
 176, 171, 176, 171, 176, 176, 176, 176, 159, 166, 159, 159, 166,
 168, 169, 159, 168, 169, 166, 163, 180, 163, 165, 164, 180, 166,
 166, 164, 164, 177, 166), NDVI = c(0.187, 0.2, 0.379, 0.253,
 0.356, 0.341, 0.268, 0.431, 0.282, 0.181, 0.243, 

Re: [R] Unexpected behavior in PBSmapping package

2007-08-13 Thread Haigh, Rowan
Hi David,
Thanks for the message. Essentially, the argument 'col' is treated like
a vector which remains independent from (X,Y) and is simply repeated as
need for the number of points. If you specify
col=c(red,blue,green,yellow) as below, and there are only 2
points, only red and blue will be used (hence the perceived
mismatch).

To keep your colour column matched with X,Y, there is an argument called
polyProps that automatically looks for the column col. Unfortunately,
polyProps doesn't appear to be functional with EventData (bug, I think)
but will work with PolyData. Take a look at the R-code below. I've
redefined your EventData to be PolyData which can serve double duty as
EventData and PolyData, i.e., you can pass events to plotPoints() as
well as using polyProps=events. I've also added the label field to
events to simplify things, and used PBSmapping's addLabels() function. 

The plotPoints() code should have been able to do this with EventData
also. We will have to revisit this code. Thanks David for taking the
time to show us user-related problems. It helps us to re-evaluate
functionalities. Undoubtedly, the package has many little imperfections
but we try to iron them out over time.
Cheers, Rowan

### Begin Example ###
library( PBSmapping )

# Define some EventData
events - as.PolyData( read.table( textConnection(
'PID X  Y  col
1 494 1494 red
2 497 1497 blue
3 500 1500 green
4 503 1503 yellow' ), header=TRUE, strings=FALSE ),
projection='UTM', zone=10 )
events$label - toupper(substring(events$col,1,1));

par( mfrow=c(3,1) )

# Plot the events with plot limits large enough to show
# the full extent of all the symbols
plotPoints( events, pch=16, cex=5, polyProps=events,
   xlim=c(490,508), ylim=c(1490,1508),proj=UTM)
addLabels(events, polyProps=events, font=2, cex=2, col=1) 

# Normal plot extents; partial symbols cut off by edges
# of plotting region (as expected)
plotPoints( events, pch=16, cex=5, polyProps=events,proj=UTM)
addLabels(events, polyProps=events, font=2, cex=2, col=1) 

## Now use more-restrictive plot limits
plotPoints( events, pch=16, cex=5, polyProps=events,
   xlim=c(499,505), ylim=c(1499,1505),proj=UTM)
addLabels(events, polyProps=events, font=2, cex=2, col=1) 

### End example ###

P.S. Once you've defined your EventData/PolyData/PolySet with attribute
projection=UTM, plotMap() will attempt to use this but plotLines() and
plotPoints() will simply tell you if it matched the specified projection
in the function call. When you specified plotPoints(...,proj=TRUE), you
are probably overriding the earlier specified UTM projection (of events)
with proj=1. In this case, the 2 projections (UTM, 1) are the same. If
your Poly dataset was set to projection=LL, they would not be.
==

-Original Message-
From: Schnute, Jon 
Sent: Monday, August 13, 2007 8:19 AM
To: Haigh, Rowan
Subject: FW: Unexpected behavior in PBSmapping package


Hi Rowan - Could you please check into this when you get a chance?
Thanks - Jon 

-Original Message-
From: D. Dailey [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 11:38 PM
To: r-help@stat.math.ethz.ch; Schnute, Jon
Subject: Unexpected behavior in PBSmapping package

Using R 2.5.1 on Windows XP Professional, and PBSmapping package version

2.51, I have encountered some behavior which puzzles me.  I am including

the package's listed maintainer on this email but also seek the thoughts

of the R-help community.

I have a set of EventData, which I want to plot as points, and to color 
the points according to some criterion.  It turns out that some of my 
points fall outside my desired plotting region.  It looks like this 
causes the PBSmapping functions plotPoints and addPoints to incorrectly 
deal with the color assignments.

Consider the following toy example:

### Begin Example ###

library( PBSmapping )

# Define some EventData
events - as.EventData( read.table( textConnection(
'EID X  Y   Color
1 494 1494 red
2 497 1497 blue
3 500 1500 green
4 503 1503 yellow' ), header=TRUE, strings=FALSE ),
proj='UTM', zone=10 )

par( mfrow=c(3,1) )

# Plot the events with plot limits large enough to show
# the full extent of all the symbols
plotPoints( events, pch=16, cex=5, col=events$Color,
   xlim=c(490,508), ylim=c(1490,1508), proj=TRUE )
with( events, text( X, Y, toupper( substr( Color, 1, 1 ) ),
   font=2, cex=2 ) )

# Normal plot extents; partial symbols cut off by edges
# of plotting region (as expected)
plotPoints( events, pch=16, cex=5, col=events$Color, proj=TRUE )
with( events, text( X, Y, toupper( substr( Color, 1, 1 ) ),
   font=2, cex=2 ) )

## Now use more-restrictive plot limits
plotPoints( events, pch=16, cex=5, col=events$Color,
   xlim=c(499,505), ylim=c(1499,1505), proj=TRUE )
with( events, text( X, Y, toupper( substr( Color, 1, 1 ) ),
   font=2, cex=2 ) )
# Note that symbols are plotted in the right places (note text labels)
# but colors are not as expected

### End example 

Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Michael Kubovy
Hi Duncan,

I was trying to learn to remove the artifacts by setting the  
parameters of the image so that anti-aliasing wouldn't produce them  
(analogous to making sure that the screens of two halftone screen  
process images are in register before combining them so as to avoid  
Moiré patterns). So, I wasn't complaining; I was looking for  
instruction. Since the image was computed with R, it's reasonable for  
me to ask R experts to help me out of what I thought was caused by my  
ineptitude. (Regarding your question, If it wasn't a bug, why did it  
bother you so much?---there are many things that bother me that are  
not bugs.)

Moreover, I'm not opposed to complaining to Apple, once I have been  
assured that I'm not reporting a bug where there's none.

On Aug 13, 2007, at 9:56 AM, Duncan Murdoch wrote:

 On 8/13/2007 11:43 AM, Michael Kubovy wrote:
 But is it a bug? Can a program anti-alias text and line drawings  
 and  not bitmaps?

 Anti-aliasing is the removal of artifacts caused by displaying an  
 image on a low-resolution bitmapped display.  Introducing artifacts  
 is a bug.

 If it wasn't a bug, why did it bother you so much?  And why do you  
 think it's reasonable to complain about it on R-help, but not to  
 complain about it to Apple, who are clearly responsible for it?

 Duncan Murdoch

 On Aug 13, 2007, at 9:30 AM, Duncan Murdoch wrote:
 On 8/13/2007 11:07 AM, Michael Kubovy wrote:
 Dear Friends,
 Thanks for your input.
 FYI: Preview doesn't show PDF aliasing in the image I produced  
 if  I  uncheck the Anti-alias text and line art box under the  
 PDF  tab in  Preferences. So I'm not yet ready to drop Preview  
 from my  toolbox.

 An alternative to dropping Preview is to report the bug in it to   
 Apple.  Apple has an online bug reporting web page somewhere; I   
 haven't found them as helpful as R-help, but your mileage may vary.

 Duncan Murdoch
 _
 Professor Michael Kubovy
 University of Virginia
 Department of Psychology
 USPS: P.O.Box 400400Charlottesville, VA 22904-4400
 Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, VA 22903
 Office:B011+1-434-982-4729
 Lab:B019+1-434-982-4751
 Fax:+1-434-982-4766
 WWW:http://www.people.virginia.edu/~mk9y/

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Duncan Murdoch
On 8/13/2007 1:33 PM, Michael Kubovy wrote:
 Hi Duncan,
 
 I was trying to learn to remove the artifacts by setting the  
 parameters of the image so that anti-aliasing wouldn't produce them  
 (analogous to making sure that the screens of two halftone screen  
 process images are in register before combining them so as to avoid  
 Moiré patterns). So, I wasn't complaining; I was looking for  
 instruction. Since the image was computed with R, it's reasonable for  
 me to ask R experts to help me out of what I thought was caused by my  
 ineptitude. (Regarding your question, If it wasn't a bug, why did it  
 bother you so much?---there are many things that bother me that are  
 not bugs.)
 
 Moreover, I'm not opposed to complaining to Apple, once I have been  
 assured that I'm not reporting a bug where there's none.

Let me explain my point of view a bit more:

  - You saw ugly artifacts in a graph you produced.  That's a bug.  The 
question is, what caused it?
  - You rightly asked on R-help.  It might have been a bug in the way 
you were doing things, or a bug in R, or a bug in the way you were 
viewing the image.
  - It was demonstrated that this only appears in Preview, not in 
Acrobat Reader, so it's probably a bug there.

It's only at the last point that I object to what you did:  your 
question quoted below makes it look as though you think Apple's time is 
more valuable than ours.  I remind you that you paid for Preview, and 
you didn't pay for R.  Apple has a stronger obligation to help you than 
any of us do.  My experience with them (and with most other commercial 
software vendors) is that you'll get much worse help from them than from 
us --- but that doesn't mean you shouldn't try.  Perhaps when anyone 
searching for Mac OSX Preview on Google shows up a page full of 
unhandled bug reports they'll actually do something.

Duncan Murdoch

 
 On Aug 13, 2007, at 9:56 AM, Duncan Murdoch wrote:
 
 On 8/13/2007 11:43 AM, Michael Kubovy wrote:
 But is it a bug? Can a program anti-alias text and line drawings  
 and  not bitmaps?
... [deletions] ...
 An alternative to dropping Preview is to report the bug in it to   
 Apple.  Apple has an online bug reporting web page somewhere; I   
 haven't found them as helpful as R-help, but your mileage may vary.

 Duncan Murdoch
... [the rest 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
and provide commented, minimal, self-contained, reproducible code.


[R] Extract part of vector

2007-08-13 Thread Lauri Nikkinen
Dear R-users,

How do I extract numbers between asp?P= and VID from my txt vector? I have
tried grep function with no luck.

txt - c(
http://www.mysite.com/system/empty.asp?P=2VID=defaultSID=421384237289476S=1C=18631;,

http://www.mysite.com/system/empty.asp?P=123VID=defaultSID=421384237289476S=1C=18643;,

http://www.mysite.com/system/empty.asp?P=342VID=defaultSID=421384237289476S=1C=18634
,
http://www.mysite.com/system/empty.asp?P=232VID=defaultSID=421384237289476S=1C=18645;,

http://www.mysite.com/system/empty.asp?P=2345VID=defaultSID=421384237289476S=1C=18254;,

http://www.mysite.com/system/empty.asp?P=257654VID=defaultSID=421384237289476S=1C=18732;,

http://www.mysite.com/system/empty.asp?P=22VID=defaultSID=421384237289476S=1C=18637;,

http://www.mysite.com/system/empty.asp?P=2463VID=defaultSID=421384237289476S=1C=18575
)

The result should be like
2
123
342
232
2345
257654
22
2463

Thanks,
Lauri

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] SEM for categorical data

2007-08-13 Thread Upasna Sharma
Hi

I am looking for a structural equation modeling package in R which can be
used for categorical data. Is anyone aware of the existence of such a
package? Would appreciate any help on this.

Thank you
Upasna

-- 
-
Upasna Sharma
Research Scholar
Shailesh J. Mehta School of Management,
Indian Institute of Technology, Bombay
Powai, Mumbai - 400076, India
-
Homepage:
http://www.som.iitb.ac.in/people/upasna/
-
The past is a history, the future is a mystery, and this moment is a
gift. That is why this moment is called 'the present'. Anonymous

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Q: how to extract coefisients from one glm and implement them in to an other glm?

2007-08-13 Thread Tom Willems
Dear R ussers,

I'm still working with the categorical models, and i can not do cross 
validation on them because odf their nature.
not cv works perfectly on other models so i wonderd if it is possible to 
extract the beta's from a categorical model, then use their value  in a 
0/1 glm.
Their formula is the same, so their assumptions should still hold.

Is this possible in R.

kind regards,
Tom W.


Disclaimer: click here
[[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
and provide commented, minimal, self-contained, reproducible code.


[R] rates and rate ratios for survey-weighted data

2007-08-13 Thread Paul Cleary
Hello,

I am looking at data on child survival from a survey with a stratified
two-stage design. I have been trying out the excellent survey package, with
which I have done a descriptive analysis and Cox models. I need to calculate
rates (with a child-year denominator) and various rate ratios plus
confidence intervals (basically, something like the STATA commands strate
and stmh used after svyset and stset) but haven't been able to find a
convenient way of doing this in R despite much searching. Is this possible,
either with the survey package or any other way? Many thanks for any advice.

Paul

-- 

Dr. Paul Cleary,
Specialist Registrar in Public Health,
Chester Health Protection Unit.

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xyplot() with segments() superposed?

2007-08-13 Thread Yuelin Li
Thanks for the quick response.  The general use is like the following.
Suppose I have another variable, tkmark, which for cohort 1970 is
coded 1.0 at x = c(7, 19) and 0 otherwise.  For cohort 1980, tkmark
is coded 1.0 at x = c(2, 11, 12, 19) and 0 otherwise.  For each
cohort, I want to mark with a short vertical bar the observed Y at
(x[tkmark == 1  source == obs], y[tkmark == 1  source == obs]).
I may have up to 65 different cohorts.  Different cohorts have
different numbers of tkmark positions (some have none).

The real data come from a computerized cigarette smoking reduction
program.  I want to plot each smoker's tapering of cigarettes (y) over
days (x), and mark the quit attempts.  Some participants try to quit
on days 3, 7, and 17 but resume smoking the next day, some follow the
programmed tapering exactly with no interim quit attempts, and some
ignored the tapering program.  I want to plot each participant's
**scheduled** and **observed** smoking pattern over days and mark the
quit attempts.  Hope this is clear.

Yuelin.

-- Deepayan Sarkar wrote --|Mon (Aug/13/2007)[09:35]|--:
   On 8/11/07, Yuelin Li [EMAIL PROTECTED] wrote:
In the hypothetical example below, how do I add two segments() into
the two panels, respectively?  Say segments(x0=5, y0=10, x1=5, y1=20)
on the left and segments(x0=15, y0=-10, x1=15, y1=-2) on the right?
Many thanks in advance,
   
Yuelin Li.
   
ps. part of the code came from a solution given by Deepayan Sarkar.
   
---
library(lattice)
set.seed(12345)
x - 0:20
y.male.obs - - 1.2 * x + 22 + rnorm(length(x), sd = 3)
y.male.prd - - 1.2 * x + 22
y.fema.obs - - 2.2 * x + 30 + rnorm(length(x), sd = 2)
y.fema.prd - - 2.2 * x + 30
tdat - data.frame(x = rep(x, 8),
y = rep(c(y.male.obs, y.male.prd, y.fema.obs, y.fema.prd), 2),
sex = rep(rep(c(m, f), each = 2*length(x)), 2),
cohort = rep(c(1970, 1980), each = 4*length(x)),
source = rep(rep(c(obs, prd), each = length(x)), 4)  )
xyplot(y ~ x | as.factor(cohort), data = tdat,
   groups = interaction(sex, source),
   type = c(p, p, l, l), distribute.type = TRUE)
   
   If this is a one-off requirement, the simplest solution is:
   
   xyplot(y ~ x | as.factor(cohort), data = tdat,
  groups = interaction(sex, source),
  type = c(p, p, l, l), distribute.type = TRUE,
  panel = function(...) {
  panel.xyplot(...)
  switch(panel.number(),
 panel.segments(x0=5, y0=10, x1=5, y1=20),
 panel.segments(x0=15, y0=-10, x1=15, y1=-2))
  })
   
   This is not generalizable, but you haven't told us your general use case.
   
   -Deepayan

 
 =
 
 Please note that this e-mail and any files transmitted with it may be 
 privileged, confidential, and protected from disclosure under 
 applicable law. If the reader of this message is not the intended 
 recipient, or an employee or agent responsible for delivering this 
 message to the intended recipient, you are hereby notified that any 
 reading, dissemination, distribution, copying, or other use of this 
 communication or any of its attachments is strictly prohibited.  If 
 you have received this communication in error, please notify the 
 sender immediately by replying to this message and deleting this 
 message, any attachments, and all copies and backups from your 
 computer.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with fisher.g.test

2007-08-13 Thread Bunty Gill
I am trying to analyse a mouse dataset with 45000 genes and 24 or 48
timpoints to find cycling genes using GeneCycle. However the function
fisher.g.test never runs. I am pasting the input/output summary below. I
would be grateful if someone could provide any insight.

I 've run GeneCycle successfully in the past on similar data, but I had to
reinstall R and the packages again, so this version may be different from
the previous one. My R version is Release Version 1.20 (4534) - supplied
with R 2.5.1 and GeneCycle was downloaded and applied only 3-4 days ago.

Thanks in advance,
S





[Workspace restored from /Users/howler/.RData]

 ctraw-read.csv(ct.csv, header = TRUE, sep = ,, quote=\)
 ct-t(ctraw)
 ftraw-read.csv(ft.csv, header = TRUE, sep = ,, quote=\)


 ft-t(ftraw)
 library(GeneCycle)
Loading required package: longitudinal
Loading required package: corpcor
Loading required package: fdrtool
Loading required package: locfdr
Loading required package: splines
 ctgtest-fisher.g.test(ctanalysis)
Error in r[i1] - r[-length(r):-(length(r) - lag + 1)] :
non-numeric argument to binary operator

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] help with scatterplot3d

2007-08-13 Thread Ryan Briscoe Runquist

Hello,

I am having a bit of trouble with scatterplot3d().

I was able to plot a 3d cloud of points using the following code:

my.3dplot-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
angle=30, box=FALSE)

where my.coords is a data frame that contains x, y, and z coordinates for
grid points whose elevation we sampled.

The problem occurs when I try to add points using points3d.  I tried to
follow the code in the examples of the package pdf.

First, I tried the following code to add all of the points that I wanted:

my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
seq(3100,1000,0.135), col=blue, type=h, pch=16)

and got the following error:
Error in seq.default(600, 400, 0.295) : wrong sign in 'by' argument

So I just tried to add the first point using the following code:

my.3dplot$points3d(seq(400,600,0.19), col=blue, type=h, pch=16)

and got the following error message:

Error in xyz.coords(x, y, z) : 'x', 'y' and 'z' lengths differ.

Does anyone know how I can use this function in the scatterplot3d package?

Thanks so much!

Ryan


~~
Ryan D. Briscoe Runquist
Population Biology Graduate Group
University of California, Davis
[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rfImpute

2007-08-13 Thread Liaw, Andy
I seem to recall that rfImpute() can sometimes come up with NAs at some
point in the iterations.  Could you please send me a (small) set of
data/code that reproduces the problem?

Andy

From: Eric Turkheimer
 
 I am having trouble with the rfImpute function in the 
 randomForest package.
 Here is a sample...
 
 clunk.roughfix-na.roughfix(clunk)
 
  clunk.impute-rfImpute(CONVERT~.,data=clunk)
 ntree  OOB  1  2
   300:  26.80%  3.83% 85.37%
 ntree  OOB  1  2
   300:  18.56%  5.74% 51.22%
 Error in randomForest.default(xf, y, ntree = ntree, ..., 
 do.trace = ntree,
 :
 NA not permitted in predictors
 
 So roughFix works, but rfImpute doesn't
 
 Thanks,
 Eric
  ent3c *at* virginia.edu
 
 -- 
 Eric Turkheimer, PhD
 Department of Psychology
 University of Virginia
 PO Box 400400
 Charlottesville, VA  22904-4400
 
 434-982-4732
 434-982-4766 (FAX)
 
   [[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
 and provide commented, minimal, self-contained, reproducible code.
 
 
 


--
Notice:  This e-mail message, together with any attachments,...{{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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xyplot() with segments() superposed?

2007-08-13 Thread Deepayan Sarkar
On 8/13/07, Yuelin Li [EMAIL PROTECTED] wrote:
 Thanks for the quick response.  The general use is like the following.
 Suppose I have another variable, tkmark, which for cohort 1970 is
 coded 1.0 at x = c(7, 19) and 0 otherwise.  For cohort 1980, tkmark
 is coded 1.0 at x = c(2, 11, 12, 19) and 0 otherwise.  For each
 cohort, I want to mark with a short vertical bar the observed Y at
 (x[tkmark == 1  source == obs], y[tkmark == 1  source == obs]).
 I may have up to 65 different cohorts.  Different cohorts have
 different numbers of tkmark positions (some have none).

 The real data come from a computerized cigarette smoking reduction
 program.  I want to plot each smoker's tapering of cigarettes (y) over
 days (x), and mark the quit attempts.  Some participants try to quit
 on days 3, 7, and 17 but resume smoking the next day, some follow the
 programmed tapering exactly with no interim quit attempts, and some
 ignored the tapering program.  I want to plot each participant's
 **scheduled** and **observed** smoking pattern over days and mark the
 quit attempts.  Hope this is clear.

Sounds like you need to pass your 'tkmarks' variable on to the panel
function and then use 'subscripts' inside your panel function. Read
the entry on 'panel' in ?xyplot. Also, there's a fairly long thread on
a similar problem which you might find useful. It starts with

https://stat.ethz.ch/pipermail/r-help/2007-July/136188.html

-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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help with scatterplot3d

2007-08-13 Thread Duncan Murdoch
On 8/13/2007 3:03 PM, Ryan Briscoe Runquist wrote:
 Hello,
 
 I am having a bit of trouble with scatterplot3d().
 
 I was able to plot a 3d cloud of points using the following code:
 
my.3dplot-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
 angle=30, box=FALSE)
 
 where my.coords is a data frame that contains x, y, and z coordinates for
 grid points whose elevation we sampled.
 
 The problem occurs when I try to add points using points3d.  I tried to
 follow the code in the examples of the package pdf.
 
 First, I tried the following code to add all of the points that I wanted:
 
my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
 seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
 seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
 seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
 seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
 seq(3100,1000,0.135), col=blue, type=h, pch=16)

The header to the function (which you can see by evaluating 
my.3dplot$points3d) is

function (x, y = NULL, z = NULL, type = p, ...)

so you are setting x to seq(400,600,0.19), y to seq(600,400,0.295), etc.

I think you probably want

my.3dplot$points3d(x=c(400, 600, ...),
y=c(600, 400, ...),
z=c(0.19, 0.295, ...), ...)

(where the ... is to be filled in by you.)
 
 and got the following error:
 Error in seq.default(600, 400, 0.295) : wrong sign in 'by' argument
 
 So I just tried to add the first point using the following code:
 
my.3dplot$points3d(seq(400,600,0.19), col=blue, type=h, pch=16)
 
 and got the following error message:
 
 Error in xyz.coords(x, y, z) : 'x', 'y' and 'z' lengths differ.
 
 Does anyone know how I can use this function in the scatterplot3d package?

try

my.3dplot$points3d(x=400, y=600, z=0.19, col=blue, type=h, pch=16)

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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Extract part of vector

2007-08-13 Thread jim holtman
This should do it:

 txt
[1] 
\nhttp://www.mysite.com/system/empty.asp?P=2VID=defaultSID=421384237289476S=1C=18631;
[2] 
\nhttp://www.mysite.com/system/empty.asp?P=123VID=defaultSID=421384237289476S=1C=18643;
[3] 
\nhttp://www.mysite.com/system/empty.asp?P=342VID=defaultSID=421384237289476S=1C=18634\n;
[4] 
\nhttp://www.mysite.com/system/empty.asp?P=232VID=defaultSID=421384237289476S=1C=18645;
[5] 
\nhttp://www.mysite.com/system/empty.asp?P=2345VID=defaultSID=421384237289476S=1C=18254;
[6] 
\nhttp://www.mysite.com/system/empty.asp?P=257654VID=defaultSID=421384237289476S=1C=18732;
[7] 
\nhttp://www.mysite.com/system/empty.asp?P=22VID=defaultSID=421384237289476S=1C=18637;
[8] 
\nhttp://www.mysite.com/system/empty.asp?P=2463VID=defaultSID=421384237289476S=1C=18575\n;

 gsub(^.*asp.P=([[:digit:]]+).*$, '\\1', txt)
[1] 2  1233422322345   257654 22 2463



On 8/13/07, Lauri Nikkinen [EMAIL PROTECTED] wrote:
 Dear R-users,

 How do I extract numbers between asp?P= and VID from my txt vector? I have
 tried grep function with no luck.

 txt - c(
 http://www.mysite.com/system/empty.asp?P=2VID=defaultSID=421384237289476S=1C=18631;,
 
 http://www.mysite.com/system/empty.asp?P=123VID=defaultSID=421384237289476S=1C=18643;,
 
 http://www.mysite.com/system/empty.asp?P=342VID=defaultSID=421384237289476S=1C=18634
 ,
 http://www.mysite.com/system/empty.asp?P=232VID=defaultSID=421384237289476S=1C=18645;,
 
 http://www.mysite.com/system/empty.asp?P=2345VID=defaultSID=421384237289476S=1C=18254;,
 
 http://www.mysite.com/system/empty.asp?P=257654VID=defaultSID=421384237289476S=1C=18732;,
 
 http://www.mysite.com/system/empty.asp?P=22VID=defaultSID=421384237289476S=1C=18637;,
 
 http://www.mysite.com/system/empty.asp?P=2463VID=defaultSID=421384237289476S=1C=18575
 )

 The result should be like
 2
 123
 342
 232
 2345
 257654
 22
 2463

 Thanks,
 Lauri

[[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
 and provide commented, minimal, self-contained, reproducible code.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is 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
and provide commented, minimal, self-contained, reproducible code.


[R] 'From' and 'to' arguments in panel.abline

2007-08-13 Thread Sébastien
Dear R-users,

The help does not give much details on the use of the arguments 'from' 
and 'to' in the panel.abline function. I have looked in the archives but 
did not find how to implement them. My different tries failed miserably. 
E.g, the following code doesn't seem to work, in a sense that the line 
is not limited to the (0,10) range.
Do these arguments really apply to panel.abline? If so, how should they 
be specified?

xy-data.frame(x-0.1:10,y-0.1:10)
xyplot(y~x,data=xy,
 panel = function(x, y, ...){
   panel.abline(a=0,b=1,from=0,to=10)
   panel.xyplot(x,y)
   })

Thanks you in advance for your help.

Sebastien

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] vertically oriented color key in heatmaps

2007-08-13 Thread Rajarshi Guha
Hi, I have some data which I was plotting using image(). I wanted to  
add a vertical color key to the plot and I found that heatmap.2 in  
gplots does let me add a color key. However, I was thinking of a  
vertical bar with the color range rather than  the style that gplots  
provides.

Is there any package (or code snippet) that would let me add a  
vertical color key to an image() or heatmap plot?

Thanks,

---
Rajarshi Guha  [EMAIL PROTECTED]
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
---
Q:  What do you get when you put a spinning flywheel in a casket and
 turn a corner?
A:  A funeral precession.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] GML with tweedie: AIC=NA

2007-08-13 Thread Gordon Smyth
Dear Catarina,

I prefer to leave the AIC value as NA for the tweedie GLM family 
because it takes extra time to compute and is only occasionally 
wanted. It's easy to compute the AIC yourself using the dtweedie() 
function of the tweedie package.

Best wishes
Gordon

At 03:05 AM 14/08/2007, Catarina Miranda wrote:
Dear Gordon;

I have also sent this email to R help mailing list, so I apologize 
for duplicated mailing.
I am modelling densities of some species of birds, and I have a 
problem with a great amount of zeros.
I have decided to try GLMs with the tweedie family, but in all the 
models I have tried  I got an NA for the AIC value.
Just  to check the problem I've compared the a glm using the 
Gaussian family with the identity link and a glm using the tweedie 
family with var.power=0 and link.power=1. These are equal, as 
expected, except the fact that the tweedie output gives me an NA for the AIC.
Could you help me with this problem?
Below you can find the two outputs I refer.

Best Wishes;

Catarina

  summary(glm(formula=ACIN~DIST_REF+DIST_H2O+DIST_OST+ 
 COTA+H2O_SUP+vasa,family=gaussian(link=identity)))
Call:glm(formula = ACIN ~ DIST_REF + DIST_H2O + DIST_OST + COTA 
+ H2O_SUP + vasa, family = gaussian(link = identity))
Deviance 
Residuals:   Min 1Q Median 3QMax 
-0.112792   -0.042860  -0.021113  -0.006311   1.551824
Coefficients:  Estimate Std. Error t value 
Pr(|t|)  (Intercept) 
-6.625e-02  5.454e-02  -1.215   0.2256  DIST_REF 3.581e-06 
1.336e-05   0.268   0.7889  DIST_H2O- 
3.168e-05  1.527e-05  -2.074   0.0391 
*DIST_OST-1.799e-05  1.953e-05  -0.921   0.3579  COTA 
5.648e-04  2.470e-04   2.287   0.0230 
*H2O_SUP -2.172e-04  3.994e-04  -0.544   0.5870  vasa 
3.695e-02  4.573e-020.808   0.4199  ---Signif. codes:  0 '***' 
0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for gaussian family taken to be 0.02151985)
 Null deviance: 5.6028   on 257  degrees of freedomResidual 
 deviance: 5.4015  on 251  degrees of freedomAIC: -249.33
Number of Fisher Scoring iterations: 2


  summary(glm(formula=ACIN~DIST_REF+DIST_H2O+DIST_OST+ 
 COTA+H2O_SUP+vasa,control= 
 glm.control(maxit=750),family=tweedie(var.power=0, link.power=1)))
Call:glm(formula = ACIN ~ DIST_REF + DIST_H2O + DIST_OST + COTA 
+ H2O_SUP + vasa, family = tweedie(var.power = 0, link.power = 
1), control = glm.control (maxit = 750))
Deviance 
Residuals:   Min 1Q Median 3QMax 
-0.112792  -0.042860  -0.021113  -0.006311   1.551824
Coefficients:  Estimate Std. Error t value 
Pr(|t|)  (Intercept) - 
6.625e-02  5.454e-02  -1.215   0.2256  DIST_REF 3.581e-06 
1.336e-05   0.268   0.7889  DIST_H2O-3.168e-05  1.527e-05 
-2.074   0.0391 
*DIST_OST-1.799e-05  1.953e-05  -0.921   0.3579  COTA 
5.648e-04  2.470e-042.287   0.0230 
*H2O_SUP -2.172e-04  3.994e-04  -0.544   0.5870  vasa 
3.695e-02  4.573e-02   0.808   0.4199  ---Signif. codes:  0 '***' 
0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for Tweedie family taken to be 0.02151985)
 Null deviance: 5.6028  on 257  degrees of freedomResidual 
 deviance: 5.4015  on 251  degrees of freedomAIC: NA
Number of Fisher Scoring iterations: 2



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 'From' and 'to' arguments in panel.abline

2007-08-13 Thread Deepayan Sarkar
On 8/13/07, Sébastien [EMAIL PROTECTED] wrote:
 Dear R-users,

 The help does not give much details on the use of the arguments 'from'
 and 'to' in the panel.abline function.

Not surprising, since panel.abline doesn't actually have arguments
called 'from' and 'to'.

 I have looked in the archives but
 did not find how to implement them. My different tries failed miserably.
 E.g, the following code doesn't seem to work, in a sense that the line
 is not limited to the (0,10) range.
 Do these arguments really apply to panel.abline?

No, they do not. It is common to have many functions documented in one
help page, and you need to look at the usage section (near the top) to
figure out which arguments are releant for which functions. The help
page has:


Usage:

 panel.abline(a = NULL, b = 0,
  h = NULL, v = NULL,
  reg = NULL, coef = NULL,
  col, col.line, lty, lwd, type,
  ...)

 panel.curve(expr, from, to, n = 101,
 curve.type = l,
 col, lty, lwd, type,
 ...)

etc. If you want to limit the range, use panel.curve, e.g.

  panel.curve(0 + 1 * x,from=0,to=10)

-Deepayan


 If so, how should they
 be specified?

 xy-data.frame(x-0.1:10,y-0.1:10)
 xyplot(y~x,data=xy,
  panel = function(x, y, ...){
panel.abline(a=0,b=1,from=0,to=10)
panel.xyplot(x,y)
})

 Thanks you in advance for your help.

 Sebastien

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R^2 for multilevel models

2007-08-13 Thread Andy Fugard
Hi there,

In multiple regression one way to view R^2 is as (the square of) the 
correlation between original y's and the estimated y's.

Suppose you fit a multilevel model with random intercept for each 
cluster.  Would it be valid to compute an R^2 by using fixed effects 
plus the group intercepts to reduce the residuals?

I suspect this has been done and, given its absence from the lmer 
output, refuted somewhere.  A reference would be lovely.

Code below.

Many thanks,

Andy

#

require(lme4)

# First generate some data

people = 100
obs = 4

# The random intercepts:

sub_noise = data.frame(id = 1:people, rand_int = rnorm(people,0,60))

# Merge everything

id = rep(1:people,obs)
thedata = data.frame(id)
thedata = merge(sub_noise, thedata)
thedata$x = rep(1:obs,people)

# Setup the relationship between x and y

thedata$y = 23*thedata$x + 20 + thedata$rand_int
   + rnorm(people*obs, 0, 20) # plus residuals

# Have a look

plot(y~x, data = thedata)

# Now fit a standard regression model

lm1 = lm(y ~ x, data = thedata)
summary(lm1)

# Use the model to get the R^2
predicted = coef(lm1)[1] + thedata$x * coef(lm1)[2]
plot(thedata$y, predicted)

# It's a noisy mess

cor(thedata$y, predicted)^2

# Now how about adjusting everyone's intercept towards the group
# intercept?

lmer1 = lmer(y ~ x + (1|id), data=thedata)
summary(lmer1)

# Get the random intercepts and stick them in a table

ran_effects = data.frame(rownames(ranef(lmer1)$id), ranef(lmer1)$id[1])
names(ran_effects) = c(id, b)
ran_effects_data = merge(thedata, ran_effects)

# Now compute

predicted.ml = fixef(lmer1)[1] + ran_effects_data$x * fixef(lmer1)[2]
   + ran_effects_data$b
plot(thedata$y, predicted.ml)
cor(thedata$y, predicted.ml)^2

# Looks much nicer

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] invert 160000x160000 matrix

2007-08-13 Thread Jiao Yang
Can R invert a 16x16 matrix with all positive numbers?  Thanks a lot!

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] BDS test - results unclear to me

2007-08-13 Thread Nicolas Navet
Hello,

I would like to use the BDS test from the tseries package, but there is 
something I don't understand in the results of the test. Let's say, I 
want the BDS values for an embedding dimension equal to 2 :

  bds.test(c, m = 2, eps = seq(0.5 * sd(c), 2 * sd(c), length = 
4),trace=FALSE);
Here are the outputs:
data:  c
Embedding dimension =  2
Epsilon for close points =  0.0097 0.0194 0.0291 0.0388
Standard Normal =
  [ 0.0097 ] [ 0.0194 ] [ 0.0291 ] [ 0.0388 ]
[ 2 ]14.600613.900312.574511.4012


Now for dimension 3 (m=3), we obtain:

Standard Normal =
  [ 0.0097 ] [ 0.0194 ] [ 0.0291 ] [ 0.0388 ]
[ 2 ]14.554413.875812.554011.3897
[ 3 ]20.914918.764016.156214.2518

what I don't understand is why the values for embedding dimension 2 are 
not equal when BDS is computed with parameter m=2 and m=3, could someone 
please explain that to me ? In the documentation, it is said that m is 
an integer indicating that the BDS test statistic is computed for 
embedding dimensions 2, ..., m., so why don't we get the same result in 
both cases?

Thank you for your help,
Best regards,

Nicolas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 'From' and 'to' arguments in panel.abline

2007-08-13 Thread Sébastien
Thanks Deepayan,

I actually looked at the upper section but couldn't not spot these 
arguments. I thought they were optional arguments in '...'. I will try 
to open my eyes next time ;)

Deepayan Sarkar a écrit :
 On 8/13/07, Sébastien [EMAIL PROTECTED] wrote:
   
 Dear R-users,

 The help does not give much details on the use of the arguments 'from'
 and 'to' in the panel.abline function.
 

 Not surprising, since panel.abline doesn't actually have arguments
 called 'from' and 'to'.

   
 I have looked in the archives but
 did not find how to implement them. My different tries failed miserably.
 E.g, the following code doesn't seem to work, in a sense that the line
 is not limited to the (0,10) range.
 Do these arguments really apply to panel.abline?
 

 No, they do not. It is common to have many functions documented in one
 help page, and you need to look at the usage section (near the top) to
 figure out which arguments are releant for which functions. The help
 page has:


 Usage:

  panel.abline(a = NULL, b = 0,
   h = NULL, v = NULL,
   reg = NULL, coef = NULL,
   col, col.line, lty, lwd, type,
   ...)

  panel.curve(expr, from, to, n = 101,
  curve.type = l,
  col, lty, lwd, type,
  ...)

 etc. If you want to limit the range, use panel.curve, e.g.

   panel.curve(0 + 1 * x,from=0,to=10)

 -Deepayan


   
 If so, how should they
 be specified?

 xy-data.frame(x-0.1:10,y-0.1:10)
 xyplot(y~x,data=xy,
  panel = function(x, y, ...){
panel.abline(a=0,b=1,from=0,to=10)
panel.xyplot(x,y)
})

 Thanks you in advance for your help.

 Sebastien

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] invert 160000x160000 matrix

2007-08-13 Thread jim holtman
You would need 200GB to store a since image, so if you have about 1TB
of physical memory on your computer, it might be possible.

On 8/13/07, Jiao Yang [EMAIL PROTECTED] wrote:
 Can R invert a 16x16 matrix with all positive numbers?  Thanks a lot!

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Q: how to extract coefisients from one glm and implement them in to an other glm?

2007-08-13 Thread Charles C. Berry


Part of the homework you were supposed to do before asking this question:


help.search(coefficients)
.
.
.
coef(stats) Extract Model Coefficients
.
.
.

So, go read

?coef

and

 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

As your email says.


Then go read ?predict which is probably more germane to your goal.



On Mon, 13 Aug 2007, Tom Willems wrote:

 Dear R ussers,

 I'm still working with the categorical models, and i can not do cross
 validation on them because odf their nature.
 not cv works perfectly on other models so i wonderd if it is possible to
 extract the beta's from a categorical model, then use their value  in a
 0/1 glm.
 Their formula is the same, so their assumptions should still hold.

 Is this possible in R.

 kind regards,
 Tom W.


 Disclaimer: click here
   [[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
 and provide commented, minimal, self-contained, reproducible code.


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] invert 160000x160000 matrix

2007-08-13 Thread Paul Gilbert
I don't think you can define a matrix this large in R, even if you have 
the memory. Then, of course, inverting it there may be other programs 
that have limitations.

Paul

Jiao Yang wrote:
 Can R invert a 16x16 matrix with all positive numbers?  Thanks a lot!
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


La version française suit le texte anglais.



This email may contain privileged and/or confidential inform...{{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
and provide commented, minimal, self-contained, reproducible code.


[R] simulate data from multivariate normal with pre-specified correlation matrix

2007-08-13 Thread Jiao Yang
For example, the correlation matrix is 3x3 and looks like 

1   0.75  0  0  0
0.751 0  0  0
 0   0 0   0  0

Can I write the code like  this?

p- 3 # number of variables per observation
N- 10 # number of samples

# define population correlation matrix sigma
sigma-matrix(0,p,p) #creates a px p matrix of 0
rank-2
for (i in 1:rank){
for (j in 1:rank){
rho-0.75
 sigma[i,j]-rho^abs(i-j)
sigma[i,i]-1
 }
}

# create a data set of 10 observations from multivariate normalcovariance 
matrix sigma  
library(MASS)
Xprime-mvrnorm(N,rep(1,p), sigma )

Also, if I calculate

S- cov(Xprime) 

will S be the sample correlation matrix?

Thank you very much for your time!

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error message when using zero-inflated count regression model in package zicounts

2007-08-13 Thread James Milks
I have data on number of vines per tree for ~550 trees.  Over half of  
the trees did not have any vines and the data is fairly skewed  
(median = 0, mean = 1.158, 3rd qu. = 1.000).  I am attempting to  
investigate whether plot location (four sites), species (I'm using  
only the four most common species), or tree dbh has a significant  
influence on the number of vines per tree.  When I attempted to use  
the zicounts function, R gave me the following error message:

  vines.zip-zicounts(resp=Total.vines~.,x=~Site+Species+DBH,z=~Site 
+Species+DBH,distrname=ZIP,data=sycamores.1)
Error in ifelse(y == 0, 1, y/mu) : dim- : dims [product 12] do not  
match the length of object [549]
In addition: Warning messages:
1: longer object length
is not a multiple of shorter object length in: x[good, ] * w
2: longer object length
is not a multiple of shorter object length in: eta + offset
3: longer object length
is not a multiple of shorter object length in: y/mu

I do not know enough about the calculations done in the function to  
interpret the error messages.  Is there a glitch in my data and if  
yes, what is it?

Thanks for your help.

Jim Milks

Graduate Student
Environmental Sciences Ph.D. Program
136 Biological Sciences
Wright State University
3640 Colonel Glenn Hwy
Dayton, OH 45435



[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help with scatterplot3d

2007-08-13 Thread Ben Bolker
Ryan Briscoe Runquist rdbriscoe at ucdavis.edu writes:

 
 
 Hello,
 
 I am having a bit of trouble with scatterplot3d().
 
 I was able to plot a 3d cloud of points using the following code:
 
 my.3dplot-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
 angle=30, box=FALSE)
 
 where my.coords is a data frame that contains x, y, and z coordinates for
 grid points whose elevation we sampled.
 
 The problem occurs when I try to add points using points3d.  I tried to
 follow the code in the examples of the package pdf.
 
 First, I tried the following code to add all of the points that I wanted:
 
 my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
 seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
 seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
 seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
 seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
 seq(3100,1000,0.135), col=blue, type=h, pch=16)

  I think you probably want:

xvals - c(400,600,800,1000,1200,1200,1300,1700,1700,1900,
2300,2600,2700,2700,3100)
yvals - c(600,400,500,1400,600,1500,1400,500,600,
 1400,1400,1300,400,1300,1000)
zvals - c(0.19,0.295,0.24,0.22,0.24,0.28,0.205,0.26,
   0.21,0.255,0.275,0.225,0.235,0.265,0.135)
my.3dplot$points3d(x=xvals,y=yvals,z=zvals,col=blue,type=h,pch=16)

   Look carefully at ?seq and you may understand what you've
done wrong ...

  Ben Bolker

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reading polygon shapefiles in splancs

2007-08-13 Thread Enrico R. Crema
Dear List,

I'm trying to import a multiple polygon shapefile in splancs. I've found the 
following command but it seems to work only for single polygons:

  Name_of_splancs_polygon-getPolygonCoordsSlot 
(getPolygonsPolygonsSlot(getSpPpolygonsSlot(name_of_sp_polygon) [[1]]) [[1]])


I've tried to change the numbers but it seams to choose polygons  instead of 
importing them altogether.
Can somebody help me?


Many Thanks,

Enrico
  
   
-

-

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Legend on graph

2007-08-13 Thread Nguyen Dinh Nguyen
Hi Akki, 
Then you may need to increase y-axis scale by ylim=c(min,max)
Cheers
Nguyen

On 8/12/07, akki [EMAIL PROTECTED] wrote:
 Hi,
 I have a problem when I want to put a legend on the graph.
 I do:

 legend(topright, names(o), cex=0.9, col=plot_colors,lty=1:5, bty=n)

 but the legend is writen into the graph (graphs' top but into the graph),
 because I have values on this position. How can I write the legend on top
 the graph without the legend writes on graph's values.

 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
and provide commented, minimal, self-contained, reproducible code.


[R] predict kernelmatrix

2007-08-13 Thread Nelson Hernandez Gonzalez
HI

I got a problem in the predict function of the kernlab.

I want to use ksvm and predict with  kernelmatrix (S4 method for signature 
'kernelMatrix')

#executing the following sentences 

library(kernlab)
# identity kernel

k - function(x,y) {
 n-length(x)
 cont-0
  for(i in 1:n){
   
if(x[i]==y[i]){
  cont-cont+1
}
  }
cont
}
class(k) - kernel

data(promotergene) 
ind - sample(1:dim(promotergene)[1],20) 
genetrain - promotergene[-ind, -1]
genetest - promotergene[ind,-1 ]

kx - kernelMatrix(k, as.matrix(genetrain))
#y-as.vector(promotergene[-ind,1 ])
y-as.factor(promotergene[-ind,1 ])
y
gene1 - ksvm(kx, y, type=C-svc)
gene1
genetype - predict(gene1,genetest)
Error en as.matrix(Z) : objeto Z no encontrado

#genetest1-as.matrix(genetest)
#genetype - predict(gene1,genetest1)
genetype

thank you,
nelsonhernandez
[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] deldir package - voronoi

2007-08-13 Thread zubin
Team, we figured this out, Roger at XLSOLUTIONS solved the puzzle for 
us..!!  Okay you can easily change the color palette.

see below:

library(MASS)
library(deldir)

set.seed(1123)

y - runif(20)
x - runif(20)

#run voronoi from deldir package
ddd - deldir(x,y)
ttt - tile.list(ddd)
plot.deldir(ddd,wlines=tess)

#play with colors
*ccc - colors()[1:20] or ccc -heat.colors(20) or ccc -terrain.colors(20)*
plot(ttt,polycol=ccc,close=T)


Rolf Turner wrote:

 On 12/08/2007, at 1:22 PM, zubin wrote:

 Hello!

 I am using the deldir package to visualize my data, pretty neat.
 However, i need to fill the colors using polycol =, fill with colors
 like a heatmap - more of a gradient fill.   The only colors i get are
 very blocky - how do i assign the correct colors for a gradient, even a
 grayscale?  i tried the chart of R colors, using 200 numbers for
 grayscale but not getting them.  The polycol = colors the cells in the
 tesselation with the value a specific vector for color.

 snip

 I'm sorry, but I can't help here.  I've been struggling with colors, 
 in a different
 context, recently myself, and I'm unclear as to how they work.  There 
 are a bunch
 of functions --- palette(), colorRamp(), colorRampPalette() that 
 probably relate
 to what you want to do, but I'm not sure just *how* they relate.

 With a bit of luck, someone cleverer than I will come to your rescue.

 cheers,

 Rolf Turner

 ##
 Attention:This e-mail message is privileged and confidential. If you 
 are not theintended recipient please delete the message and notify the 
 sender.Any views or opinions presented are solely those of the author.

 This e-mail has been scanned and cleared by 
 MailMarshalwww.marshalsoftware.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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Ken Knoblauch
Hi Duncan, Hi Michael,

Duncan Murdoch murdoch at stats.uwo.ca writes:

 On 8/13/2007 1:33 PM, Michael Kubovy wrote:
 
   - You saw ugly artifacts in a graph you produced.  That's a bug.  The 
 question is, what caused it?
   - You rightly asked on R-help.  It might have been a bug in the way 
 you were doing things, or a bug in R, or a bug in the way you were 
 viewing the image.
   - It was demonstrated that this only appears in Preview, not in 
 Acrobat Reader, so it's probably a bug there.
 
 It's only at the last point that I object to what you did:  your 
 question quoted below makes it look as though you think Apple's time is 
 more valuable than ours.  I remind you that you paid for Preview, and 
 you didn't pay for R.  Apple has a stronger obligation to help you than 
 any of us do.  My experience with them (and with most other commercial 
 software vendors) is that you'll get much worse help from them than from 
 us --- but that doesn't mean you shouldn't try.  Perhaps when anyone 
 searching for Mac OSX Preview on Google shows up a page full of 
 unhandled bug reports they'll actually do something.
 
 Duncan Murdoch
 
  
  On Aug 13, 2007, at 9:56 AM, Duncan Murdoch wrote:
  
  On 8/13/2007 11:43 AM, Michael Kubovy wrote:
  But is it a bug? Can a program anti-alias text and line drawings  
  and  not bitmaps?
 ... [deletions] ...
  An alternative to dropping Preview is to report the bug in it to   
  Apple.  Apple has an online bug reporting web page somewhere; I   
  haven't found them as helpful as R-help, but your mileage may vary.
 
  Duncan Murdoch

I'm entering this late.  I just wanted to point out that there are earlier 
threads on this issue on the R-Sig-Mac list that might be useful 
to follow through.

https://stat.ethz.ch/pipermail/r-sig-mac/2005-March/001650.html

https://stat.ethz.ch/pipermail/r-sig-mac/2006-February/002678.html

Simon Urbanek suggested one patch on the later thread.  My solution, 
at the time, was to capture the image from the acrobat rendition.  

best,

ken

-- 
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.lyon.inserm.fr/846/english.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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Legend on graph

2007-08-13 Thread Bert Gunter
You can get the legend outside the plot region by

1. First changing the clipping region via par(xpd = TRUE) ; (or xpd=NA). see
?par

2. Specifying x and y coodinates for legend placement outside the limits of
the plot region.

This allows you to include a legend without adding a bunch of useless
whitespace to the plot region; or to add a grid to the plot without
interfering with the legend.


Bert Gunter
Genentech Nonclinical Statistics


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nguyen Dinh Nguyen
Sent: Monday, August 13, 2007 3:42 PM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: [R] Legend on graph

Hi Akki, 
Then you may need to increase y-axis scale by ylim=c(min,max)
Cheers
Nguyen

On 8/12/07, akki [EMAIL PROTECTED] wrote:
 Hi,
 I have a problem when I want to put a legend on the graph.
 I do:

 legend(topright, names(o), cex=0.9, col=plot_colors,lty=1:5, bty=n)

 but the legend is writen into the graph (graphs' top but into the graph),
 because I have values on this position. How can I write the legend on top
 the graph without the legend writes on graph's values.

 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] binomial simulation

2007-08-13 Thread Moshe Olshansky
As I understand this, 
P(T+ | D-)=1-P(T+ | D+)=0.05
is the probability not to detect desease for a person
at ICU who has the desease. Correct?

What I asked was whether it is possible to mistakenly
detect the desease for a person who does not have it?

Assuming that this is impossible the formula is below:

If there are N patients, each has a probability p to
have the desease (p=0.6 in your case) and q is the
probability to detect the desease for a person who has
it (q = 0.95 for ICU and q = 0.8 for a regular unit),
then

P(k have the desease AND m are detected) = 
P(k have the desease)*P(m are detected / k have the
desease) = 
C(N,k)*p^k*(1-p)^(N-k)*C(k,m)*q^m*(1-q)^(k-m)
where C(a,b) is the Binomial coefficient a above b -
the number of ways to choose b items out of a (when
the order does not matter). You of course must assume
that N = k = m = 0 (otherwise the probability is
0).

To generate such pairs (k infected and m detected) you
can do the following:

k - rbinom(N,1,p)
m - rbinom(k,1,q)

Regards,

Moshe.

--- sigalit mangut-leiba [EMAIL PROTECTED] wrote:

 Hi,
 The probability of false detection is: P(T+ |
 D-)=1-P(T+ | D+)=0.05.
 and I want to find the joint probability
 P(T+,D+)=P(T+|D+)*P(D+)
 Thank you for your reply,
 Sigalit.
 
 
 On 8/13/07, Moshe Olshansky [EMAIL PROTECTED]
 wrote:
 
  Hi Sigalit,
 
  Do you want to find the probability P(T+ = t AND
 D+ =
  d) for all the combinations of t and d (for ICU
 and
  Reg.)?
  Is the probability of false detection (when there
 is
  no disease) always 0?
 
  Regards,
 
  Moshe.
 
  --- sigalit mangut-leiba [EMAIL PROTECTED]
 wrote:
 
   hello,
   I asked about this simulation a few days ago,
 but
   still i can't get what i
   need.
   I have 2 units: icu and regular. from icu I want
 to
   take 200 observations
   from binomial distribution, when probability for
   disease is: p=0.6.
   from regular I want to take 300 observation with
 the
   same probability: p=0.6
   .
   the distribution to detect disease when disease
   occurred- *for someone from
   icu* - is: p(T+ | D+)=0.95.
   the distribution to detect disease when disease
   occurred- *for someone from
   reg.unit* - is: p(T+ | D+)=0.8.
   I want to compute the joint distribution for
 each
   unit: p(T+,D+) for icu,
   and the same for reg.
   I tried:
  
   pdeti - 0
  
   pdetr - 0
  
   picu - pdeti*.6
  
   preg - pdetr*.6
  
   dept - c(icu,reg)
  
   icu - rbinom(200, 1, .6)
  
   reg - rbinom(300, 1, .6)
  
   for(i in 1:300) {
  
   if(dept==icu) pdeti==0.95
  
   if (dept==reg) pdetr==0.80
  
   }
  
   print(picu)
  
   print(preg)
  
   and got 50 warnings:
  
   the condition has length  1 and only the first
   element will be used in: if
   (dept == icu) pdeti == 0.95
   the condition has length  1 and only the first
   element will be used in: if
   (dept == reg) pdetr == 0.8
  
   I would appreciate any suggestions,
  
   thank you,
  
   Sigalit.
  
 [[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
   and provide commented, minimal, self-contained,
   reproducible code.
  
 
 
 
   [[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
 and provide commented, minimal, self-contained,
 reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] invert 160000x160000 matrix

2007-08-13 Thread Moshe Olshansky
While inverting the matrix may be a problem, if you
need to solve an equation A*x = b you do not need to
invert A, there exist iterative methods which do need
A or inv(A) - all you need to provide is a function
that computes A*x for an arbitrary vector x.
For such a large matrix this may be slow but possible.

--- Paul Gilbert [EMAIL PROTECTED]
wrote:

 I don't think you can define a matrix this large in
 R, even if you have 
 the memory. Then, of course, inverting it there may
 be other programs 
 that have limitations.
 
 Paul
 
 Jiao Yang wrote:
  Can R invert a 16x16 matrix with all
 positive numbers?  Thanks a lot!
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained,
 reproducible code.


 
 La version française suit le texte anglais.
 


 
 This email may contain privileged and/or
 confidential inform...{{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
 and provide commented, minimal, self-contained,
 reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] State Space Modelling

2007-08-13 Thread Bernardo Ribeiro
Hey all,

I am trying to work under a State Space form, but I didn't get the help
exactly.
Have anyone eles used this functions?

I was used to work with S-PLUS, but I have some codes I need to adpt.

Thanks alot,

Bernardo

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Fatal Error - R in Windows XP

2007-08-13 Thread Siddhartha Dalal
I would greatly appreciate if someone can tell me how to solve the issue I have 
been facing. After creating a large sparse matrix (6300 by 8300 matrix), I 
saved image of it in my work space to do further computation. Since then  
whenever I start R (version 2.5.1 on Windows XP, SP2), I seem to get an error: 
 Fatal error: unable to restore saved data in .RData and then R crashes. I 
reinstalled R, and same thing happens. 

Thanks in advance for suggestions. 
Sid Dalal

   
-
Pinpoint customers who are looking for what you sell. 
[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vertically oriented color key in heatmaps

2007-08-13 Thread Vladimir Eremeev

colorbar() from the package matlab.


nightly.py wrote:
 
 Hi, I have some data which I was plotting using image(). I wanted to  
 add a vertical color key to the plot and I found that heatmap.2 in  
 gplots does let me add a color key. However, I was thinking of a  
 vertical bar with the color range rather than  the style that gplots  
 provides.
 
 Is there any package (or code snippet) that would let me add a  
 vertical color key to an image() or heatmap plot?
 

-- 
View this message in context: 
http://www.nabble.com/vertically-oriented-color-key-in-heatmaps-tf4263271.html#a12138673
Sent from the R help mailing list archive at Nabble.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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] State Space Modelling

2007-08-13 Thread gyadav

try help.search(state space) you will get pointer where you want to go


cm.state(CreditMetrics)   Computation of state space
dlmLL(dlm)Log likelihood evaluation for a 
state space model
SS(dse1)  State Space Models
balanceMittnik(dse1)  Balance a state space model
estSSMittnik(dse1)Estimate a State Space Model
estSSfromVARX(dse1)   Estimate a state space TSmodel 
using VAR estimation
l.SS(dse1)Evaluate a state space TSmodel
nstates(dse1) State Dimension of a State Space 
Model
toSS(dse1)Convert to State Space Model
toSSChol(dse1)Convert to Non-Innovation State 
Space Model
toSSinnov(dse1)   Convert to State Space 
Innovations Model
generateSSmodel(dse2) Randomly generate a state space 
model
ets(forecast) Exponential smoothing state 
space model
SS(sspir) Representation of Gaussian State 
Space Model
kfilter(sspir)Kalman filter for Gaussian state 
space model
recursion(sspir)  Simulate from a Gaussian state 
space model
smoother(sspir)   Kalman smoother for Gaussian 
state space model
ssm(sspir)Define state-space model in a 
glm-style call.
sspir(sspir)  State Space Models in R


and 
 RSiteSearch(state space)
http://search.r-project.org/cgi-bin/namazu.cgi?query=state+spacemax=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxname=docs


post your code of S Plus, i feel there are many who can help you in this 
regards

HTH




Bernardo Ribeiro [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
08/14/2007 06:57 AM

To
r-help@stat.math.ethz.ch
cc

Subject
[R] State Space Modelling






Hey all,

I am trying to work under a State Space form, but I didn't get the help
exactly.
Have anyone eles used this functions?

I was used to work with S-PLUS, but I have some codes I need to adpt.

Thanks alot,

Bernardo

 [[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
and provide commented, minimal, self-contained, reproducible code.




DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{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
and provide commented, minimal, self-contained, reproducible code.


[R] diffusing GIS data in maps

2007-08-13 Thread Lawrence D. Brenninkmeyer
Hi-

I am trying to find a way to diffuse GIS data on a European map. I have a
dataset consisting of particular locations scattered across Europe,
along with magnitude and value information. I can plot these as discrete
points with something like the following:

geocode is a dataframe with four columns: LAT; LONG; MAGNITUDE;VALUE.

library(maps)
library(mapdata)
map(worldHires, regions=c(Germany, Belgium, Netherlands))
points(geocode$LONG, geocode$LAT, cex=geocode$MAGNITUDE / 2500,
col=rainbow(length(geocode$VALUE), start=0, end=.4)[rank(geocode$VALUE)])

This gives me a map of Europe with my datapoints highlighted in two ways:
magnitude is represented by the size of the point, and value is
represented by the color.

However, what I would really like is for there to be some sort of
diffusion, such that instead of discrete points, the European map is
covered in color so I can see more clearly whether there are regional
patterns (something that will presumably look like this contour chart:
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=20  only
on the European map).

I have absolutely no idea where to start because I can't find a function
that will allow me to diffuse the datapoints on a map.

thank you for any help
ldb

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.