Re: [R] [R-sig-Geo] envi clone in R

2006-02-09 Thread Wladimir Eremeev
Dear Barry,

Wednesday, February 8, 2006, 9:09:19 PM, you wrote:

BR Wladimir Eremeev wrote:
 Hello all,
 
   Research Systems (www.rsinc.com) have developed and distributes the 
 language IDL,
   and the GIS ENVI, written in IDL.

BR   I find it hard to believe they wrote it all in IDL! I'm guessing its
BR probably scriptable in IDL, but underneath its written in something
BR else... I could be wrong though!

Well, not in IDL completely, I think, there is also C and Fortran code
underneath.

   To my oppinion, R language is superior, compared to IDL, in all aspects.
   However, ENVI is the rather convenient and feature rich tool.

By the way, even the interface to an external code is implemented in R
much more conveniently, compared to IDL.
It took me several hours to make IDL to call my C functions from DLL.
I have read the documentation carefully 2 or 3 times...

And I have done the same task in R in several minutes.

---
Best regards,
Wladimirmailto:[EMAIL PROTECTED]

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


Re: [R] Plotting a count process

2006-02-09 Thread Dieter Menne
 voodooochild at gmx.de writes:

 i want to plot a count process in the following way, but i don't know
 how i can do that. i have data for example x-(0,2,6,2,8,4,.) and
 dates y which is a vector of weekly dates for example
 (01/01/06, 08/01/06, 15/01/06, 22/01/06, ), now i want to plot the
 y's an the horizontal axis. On each date the count process jumps upwards
 1 unit, so the vertical axis is 0, 1, 2, 3, ..
 the distance between the dates is shown in vector x, so for example the
 distance between 08/01/06 and 15/01/06 should be 2. maybe i can use some
 times series functions for doing this?
 

If I understand you correctly, this means plotting equidistant point against 
the cumulative sum. Forgetting about the dates now, this would do it.

x = floor(pmax(rnorm(30,5,2),1))
xcum = cumsum(x)
plot(xcum,1:30)

Dieter

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


Re: [R] Simple optim - question

2006-02-09 Thread Dieter Menne
Carsten Steinhoff carsten.steinhoff at gmx.de writes:

 I want to find the parameters mu and sigma that minimize the following
 function.
 It's important, that mu and sigma are strictly positive.
 
 -
 optimiere = function(fmean,smean,d,x,mu,sigma)
 {
 merk = c()
 for (i in 1:length(d))
   merk=c(merk,1/(d[i]^2)*(d[i]-1/(fmean*(1-plnorm(x[i],mu,sigma^2)
 return(sum(merk))
 }
 -
 


Try optim or nlminb, both can be used with constraints. Or, as your example 
looks like a least-square problem, reformulate optim and use nls.

Dieter

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


Re: [R] logical condition in vector operation

2006-02-09 Thread Christoph Buser
Dear Frederico

From your example it is not clear to me what you like to obtain: 
Please have a look on the slightly changed example here (I
changed two values to show a potentially undesired side effect of
your coding.


test - data.frame(rbind(c(3,3,10,21,0), c(2,3,11,12,0), c(3,4,12,23,0),
 c(3,5,13,24,0)))
names(test) - c(x,y,p,d,su)
test

   x y  p  d su
 1 3 3 10 21  0
 2 2 3 11 12  0
 3 3 4 12 23  0
 4 3 5 13 24  0

j - 3
test[test[,1] == j, 5] - test[test[,1] == j,2] + test[test[,2] == j,1]

   Warning message:
 longer object length
  is not a multiple of shorter object length in: 
 test[test[, 1] == j, 2] + test[test[, 2] == j, 1] 

Your code example produces now a warning for the adapted
data frame test, since one tries to add two vectors of length 2
and 3, respectively. The result is based on recycling of the
smaller vector. In your example there was no warning since the
second column had only one entry.
The result with the adapted data frame is:

test
   x y  p  d su
 1 3 3 10 21  6
 2 2 3 11 12  0
 3 3 4 12 23  6
 4 3 5 13 24  8

Is that kind of recycling desired in your application. Otherwise
you should be careful with the coding example above.

Regards,

Christoph Buser

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






Federico Calboli writes:
  HI All,
  
  I have a data frame such as:
  
   test
   x y  p  d
  [1,] 1 0 10 21 0
  [2,] 2 3 11 12 0
  [3,] 3 4 12 23 0
  [4,] 3 5 13 24 0
  
  
  and I want to perfor some operations on the first two coulums,
  conditional on the uneqaulity values on the 3rd and 4th columns.
  
  For instance:
  
  j = 3
  test[test[,1] == j, 5] = test[test[,1] == j,2] + test[test[,2] == j,1]
  
  gives me the result:
  
  test:
  
   x y  p  d
  [1,] 1 0 10 21 0
  [2,] 2 3 11 12 0
  [3,] 3 4 12 23 6
  [4,] 3 5 13 24 7
  
  
  My probblem is the following: I want to perform the operation
  test[test[,1] == j,2] + test[test[,2] == j,1] only if the value of
  column p and column d are different at the positions where x or y = j.
  In practice, I don't want to perform the first operation because
  test[2,4 is 12 and test[1,3] is 12 as well.
  
  I tried an if statement with little success:
  
  if(test[test[,1] == j,3] != test[test[,2] == j,4]){
  test[test[,1] == j, 5] = test[test[,1] == j,2] + test[test[,2] == j,1]
  }
  Warning message:
  the condition has length  1 and only the first element will be used in:
  if (test[test[, 1] == j, 3] != test[test[, 2] == j, 4]) {
  
  Could anyone lend some advice?
  
  Cheers,
  
  Federico
  -- 
  Federico C. F. Calboli
  Department of Epidemiology and Public Health
  Imperial College, St Mary's Campus
  Norfolk Place, London W2 1PG
  
  Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
  
  f.calboli [.a.t] imperial.ac.uk
  f.calboli [.a.t] gmail.com
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] writing a file using both cat() and paste()

2006-02-09 Thread Jim Lemon
Taka Matzmoto wrote:
 Hi R users
 
 I like to create a ASCII type file using cat() and paste()
 
 x - round(runif(30),3)
 cat(vector =( , paste(x,sep=),  )\n, file = vector.dat,sep=,)
 
 when I open vector.dat it was a long ugly file
 
 vector =( 
 ,0.463,0.515,0.202,0.232,0.852,0.367,0.432,0.74,0.413,0.022,0.302,0.114,0.583,0.002,0.919,0.066,0.829,0.405,0.363,0.665,0.109,0.38,0.187,0.322,0.582,0.011,0.586,0.112,0.873,0.671,
  
 )
 
 Also there was some problems right after opening parenthesis and before the 
 closing parenthesis. Two comma were there
 
 I like to to have a nice formatted one like below. That is, 5 random values 
 per a line
 
 vector =( 0.463,0.515,0.202,0.232,0.852,
 0.367,0.432,0.74,0.413,0.022,
 0.302,0.114,0.583,0.002,0.919,
 0.066,0.829,0.405,0.363,0.665,
 0.109,0.38,0.187,0.322,0.582,
 0.011,0.586,0.112,0.873,0.671)
 
First, you might want to avoid using vector, as that is the name of an 
R function. Say you have a 30 element data vector as above. If you 
wanted to write a fairly general function to do this, here is a start:

vector2file-function(x,file=,values.per.line=5) {
  if(nchar(file)) sink(file)
  cat(deparse(substitute(x)),-c(\n)
  xlen-length(x)
  for(i in 1:xlen) {
   cat(x[i])
   if(ixlen) cat(,)
   if(i%%values.per.line == 0) cat(\n)
  }
  cat())
  if(i%%values.per.line) cat(\n)
  if(nchar(file))sink()
}

Jim

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


Re: [R] Plotting a count process

2006-02-09 Thread voodooochild
Thank you for your advice, but this is not the exaxt thing i'm looking for
http://robotics.caltech.edu/~zoran/Research/poisson/img1.png
this picture gives an example what i want to get. instead of t0, t1, 
t2, i want to draw my dates.
In my description i forgot the the horizontal line, which indicates the 
time between two dates each, sorry for that.

regards
andreas


Dieter Menne wrote:

 voodooochild at gmx.de writes:

  

i want to plot a count process in the following way, but i don't know
how i can do that. i have data for example x-(0,2,6,2,8,4,.) and
dates y which is a vector of weekly dates for example
(01/01/06, 08/01/06, 15/01/06, 22/01/06, ), now i want to plot the
y's an the horizontal axis. On each date the count process jumps upwards
1 unit, so the vertical axis is 0, 1, 2, 3, ..
the distance between the dates is shown in vector x, so for example the
distance between 08/01/06 and 15/01/06 should be 2. maybe i can use some
times series functions for doing this?




If I understand you correctly, this means plotting equidistant point against 
the cumulative sum. Forgetting about the dates now, this would do it.

x = floor(pmax(rnorm(30,5,2),1))
xcum = cumsum(x)
plot(xcum,1:30)

Dieter

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


  


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


[R] echo output to screen

2006-02-09 Thread Chun-Ying Lee
Hi all,
 
  I want to echo output to screen before next step, 
like the following when i type library(pkname),

library(pkname)

a few description about the package






how should I do to get this?
Thanks in advanced!!

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

Re: [R] (user) ERROR: no applicable method for TukeyHSD

2006-02-09 Thread Prof Brian Ripley
On Wed, 8 Feb 2006, Darren Weber wrote:

 Why do I see this error?

Because there _is_ no applicable method.

Please don't name objects after R functions, but in your case you need to
do

class(aov)
?TukeyHSD
?aov

and see what TukeyHSD says it handles and what aov says it returns.

This question has been answered at length on this list quite recently, so 
please also search the archives.


 library(stats)
 require(stats)
 [1] TRUE

 tHSD - TukeyHSD(aov)
 Error in TukeyHSD(aov) : no applicable method for TukeyHSD


 In case it helps:


 aov

 Call:
 aov(formula = roi ~ (Cue * Hemisphere) + Error(Subject/(Cue *
Hemisphere)), data = roiDataframe)

 Grand Mean: 8.195069

 Stratum 1: Subject

 Terms:
Residuals
 Sum of Squares   645.7444
 Deg. of Freedom 7

 Residual standard error: 9.604645

 Stratum 2: Subject:Cue

 Terms:
 Cue Residuals
 Sum of Squares  0.386987  4.015740
 Deg. of Freedom1 7

 Residual standard error: 0.7574148
 1 out of 2 effects not estimable
 Estimated effects are balanced

 Stratum 3: Subject:Hemisphere

 Terms:
Hemisphere Residuals
 Sum of Squares153.4860  827.6699
 Deg. of Freedom  1 7

 Residual standard error: 10.87376
 1 out of 2 effects not estimable
 Estimated effects are balanced

 Stratum 4: Subject:Cue:Hemisphere

 Terms:
Cue:Hemisphere Residuals
 Sum of Squares5.085930  4.279707
 Deg. of Freedom  1 7

 Residual standard error: 0.7819122
 Estimated effects are balanced


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


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

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


Re: [R] [R-sig-Geo] envi clone in R

2006-02-09 Thread Wladimir Eremeev
Dear Barry,

By the way...
BR   I settled on OpenEV - it has vector and raster support, its extensible
BR in Python and uses Gtk for dialogs which you can customise.

I have seen OpenEV.
Unfortunately, I could not find a documentation or user guide for
quick start and had not too much time to realize what is what and
how to use its features with 'mouse point-and-click' :)

Do you have a link to such a document?

---
Best regards,
Wladimirmailto:[EMAIL PROTECTED]

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


Re: [R] echo output to screen

2006-02-09 Thread Uwe Ligges
Chun-Ying Lee wrote:
 Hi all,
  
   I want to echo output to screen before next step, 
 like the following when i type library(pkname),
 
 
library(pkname)
 
 
 a few description about the package
 
 
 


 
 how should I do to get this?

?cat

Uwe Ligges

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

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


[R] echo output to screen

2006-02-09 Thread Chun-Ying Lee
On Thu, 09 Feb 2006 10:02:49 +0100, Uwe Ligges wrote
 Chun-Ying Lee wrote:
  Hi all,
   
I want to echo output to screen before next step, 
  like the following when i type library(pkname),
  
  
 library(pkname)
  
  
  a few description about the package
  
  
  
 
 
  
  how should I do to get this?
 
 ?cat

I know the use of cat

but I mean that the description appear automatically
when I type library(pkname)

 
 Uwe Ligges
 
  Thanks in advanced!!
  
 

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

Re: [R] echo output to screen

2006-02-09 Thread Uwe Ligges
Chun-Ying Lee wrote:

 On Thu, 09 Feb 2006 10:02:49 +0100, Uwe Ligges wrote
 
Chun-Ying Lee wrote:

Hi all,
 
  I want to echo output to screen before next step, 
like the following when i type library(pkname),



library(pkname)


a few description about the package





how should I do to get this?

?cat
 
 
 I know the use of cat
 
 but I mean that the description appear automatically
 when I type library(pkname)

See ?.onAttach (or ?.First.lib if you do not use a NAMESPACE).

Uwe Ligges


 
Uwe Ligges


Thanks in advanced!!


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

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


Re: [R] echo output to screen

2006-02-09 Thread Romain Francois
Le 09.02.2006 10:09, Chun-Ying Lee a écrit :

On Thu, 09 Feb 2006 10:02:49 +0100, Uwe Ligges wrote
  

Chun-Ying Lee wrote:


Hi all,
 
  I want to echo output to screen before next step, 
like the following when i type library(pkname),


  

library(pkname)


a few description about the package



  



how should I do to get this?
  

?cat



I know the use of cat

but I mean that the description appear automatically
when I type library(pkname)
  

Hi,

Your question was not too clear about that.
See Writing R extensions.
?.First.lib if you don't have a NAMESPACE
?.onLoad if you do

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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

[R] write.table

2006-02-09 Thread fluss
Hello!
When using the command write.table I want to convert the format: 5e-04
to  .0005. How can I do it?
The only option I found is to use write.matrix but then I cant add rownames.
Thank you
Ronen

[[alternative HTML version deleted]]

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


Re: [R] write.table

2006-02-09 Thread Sundar Dorai-Raj
See the scipen argument in ?options.

write.table(data.frame(x = 0.0005))
options(scipen = 1)
write.table(data.frame(x = 0.0005))

--sundar

fluss wrote:
 Hello!
 When using the command write.table I want to convert the format: 5e-04
 to  .0005. How can I do it?
 The only option I found is to use write.matrix but then I cant add rownames.
 Thank you
 Ronen
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] write.table

2006-02-09 Thread Prof Brian Ripley
 Hello!
 When using the command write.table I want to convert the format: 5e-04
 to  .0005. How can I do it?
 The only option I found is to use write.matrix but then I cant add rownames.
 Thank you
 Ronen

?options, see scipen.

Or, use format() to convert table before writing it.

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

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


Re: [R] adding variable into dataframe by indice

2006-02-09 Thread Petr Pikal
Hi

not sure if I understand correctly but table() can be used

ttt - table(asubs112$fir)
prop - ttt/nrow(asubs112)
asubs112$prop -
prop[match(asubs112$first_drink,as.numeric(names(prop)))]

 asubs112
   IND_ID rs1042364 first_drink  prop
2  11 (1,2)   7 0.333
5  41 (1,2)  11 0.111
6  51 (1,2)   7 0.333
7  61 (1,1)   7 0.333
8  71 (1,1)  12 0.222
10 91 (1,1)   6 0.111
11101 (1,2)   5 0.111
12111 (1,2)  13 0.111
14131 (1,2)  12 0.222
 

HTH
Petr


On 8 Feb 2006 at 9:40, Adrian Katschke wrote:

Date sent:  Wed, 8 Feb 2006 09:40:43 -0800 (PST)
From:   Adrian Katschke [EMAIL PROTECTED]
To: RHelp r-help@stat.math.ethz.ch
Subject:[R] adding variable into dataframe by indice

   R-Helpers,
 
   I am trying to insert a value into a dataframe. This value is a
   proportion calculated by counting the number of those individuals
   with that value and then inserting the proportion at the end of the
   dataframe to only those individuals with the given value. The
   problem I am running into is that the proportions are not being
   attached to only those individuals with the specified value for that
   proportion. 
 
   Below is an example of the code that I am using. The data is made up
   for the dataframe. Should give you an idea, but the original has
   'NA' in many rows. The original data is what is reported in the
   output below.
 
 #Read in Data
   age.int - data.frame(IND_ID = seq(1, 140, 10),   rs1042364 =
   sample( c((1,1),(1,2),(2,2)),14,replace = T), first_drink =
   sample(5:17,14,replace = T))
 
 
 
 asubs112 - subset(age.int, rs1042364 != (2,2))
 
 
 ages112 - sort(unique(na.omit(asubs112$first_drink)))
 
   for ( i in ages112) {
 indce - which(na.omit(asubs112$first_drink == i))
 prop - length(indce)/nrow(asubs112)
 asubs112[indce,4] - prop
 asubs112[indce,]
   }
 
   Below is the output that I get from the script above. Notice the
   proportion for the first NA but not any of the others. Not sure what
   I am doing wrong, any suggestions are a big help.
 
   TIA,
   Adrian
 
asubs112[1:50,]
   IND_ID rs1042364 first_drink age_int  V5
 4   10008007 (1,2)  NA  16 0.003891051
 6   10013012 (1,2)  13  14 0.116731518
 7   10015006 (1,2)  12  17 0.105058366
 8   10015007 (1,1)  12  16 0.105058366
 10  10021009 (1,2)  NA  15  NA
 14  10039036 (1,2)  NA  15  NA
 15  10039037 (1,2)  NA  13  NA
 17  10045005 (1,2)  13  17 0.116731518
 18  10045014 (1,2)  13  14 0.116731518
 21  10055022 (1,2)  NA  15  NA
 
 
 
 
 
 
  [[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

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] logical condition in vector operation

2006-02-09 Thread Federico Calboli
On Thu, 2006-02-09 at 09:22 +0100, Christoph Buser wrote:
 Dear Frederico
 
 From your example it is not clear to me what you like to obtain: 
 Please have a look on the slightly changed example here (I
 changed two values to show a potentially undesired side effect of
 your coding.
 
 
 test - data.frame(rbind(c(3,3,10,21,0), c(2,3,11,12,0), c(3,4,12,23,0),
  c(3,5,13,24,0)))
 names(test) - c(x,y,p,d,su)
 test
 
x y  p  d su
  1 3 3 10 21  0
  2 2 3 11 12  0
  3 3 4 12 23  0
  4 3 5 13 24  0
 
 j - 3
 test[test[,1] == j, 5] - test[test[,1] == j,2] + test[test[,2] == j,1]
 
Warning message:
  longer object length
 is not a multiple of shorter object length in: 
  test[test[, 1] == j, 2] + test[test[, 2] == j, 1] 
 
 Your code example produces now a warning for the adapted
 data frame test, since one tries to add two vectors of length 2
 and 3, respectively. The result is based on recycling of the
 smaller vector. In your example there was no warning since the
 second column had only one entry.
 The result with the adapted data frame is:
 
 test
x y  p  d su
  1 3 3 10 21  6
  2 2 3 11 12  0
  3 3 4 12 23  6
  4 3 5 13 24  8
 
 Is that kind of recycling desired in your application. Otherwise
 you should be careful with the coding example above.

Recycling was and is integral part of my plan.

Cheers,

Federico

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


Re: [R] logical condition in vector operation

2006-02-09 Thread Petr Pikal
Hi

try
ifelse()

but I you probably shall put your problem clearer.

HTH
Petr


On 8 Feb 2006 at 18:12, Federico Calboli wrote:

From:   Federico Calboli [EMAIL PROTECTED]
To: r-help r-help@stat.math.ethz.ch
Organization:   Imperial College London
Date sent:  Wed, 08 Feb 2006 18:12:37 +
Subject:[R] logical condition in vector operation
Send reply to:  [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

 HI All,
 
 I have a data frame such as:
 
  test
  x y  p  d
 [1,] 1 0 10 21 0
 [2,] 2 3 11 12 0
 [3,] 3 4 12 23 0
 [4,] 3 5 13 24 0
 
 
 and I want to perfor some operations on the first two coulums,
 conditional on the uneqaulity values on the 3rd and 4th columns.
 
 For instance:
 
 j = 3
 test[test[,1] == j, 5] = test[test[,1] == j,2] + test[test[,2] == j,1]
 
 gives me the result:
 
 test:
 
  x y  p  d
 [1,] 1 0 10 21 0
 [2,] 2 3 11 12 0
 [3,] 3 4 12 23 6
 [4,] 3 5 13 24 7
 
 
 My probblem is the following: I want to perform the operation
 test[test[,1] == j,2] + test[test[,2] == j,1] only if the value of
 column p and column d are different at the positions where x or y = j.
 In practice, I don't want to perform the first operation because
 test[2,4 is 12 and test[1,3] is 12 as well.
 
 I tried an if statement with little success:
 
 if(test[test[,1] == j,3] != test[test[,2] == j,4]){
 test[test[,1] == j, 5] = test[test[,1] == j,2] + test[test[,2] == j,1]
 } Warning message: the condition has length  1 and only the first
 element will be used in: if (test[test[, 1] == j, 3] != test[test[, 2]
 == j, 4]) {
 
 Could anyone lend some advice?
 
 Cheers,
 
 Federico
 -- 
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St Mary's Campus
 Norfolk Place, London W2 1PG
 
 Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
 
 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.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

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] Plotting a count process

2006-02-09 Thread voodooochild
Now my problem is solved, i thinked a while about it and rearanged my 
plot in the following way for everybody how is interested

x-0:3
y-c(0,5,8,3)
dates-c(,01.01.05,08.01.05,15.01.05)
plot(x,cumsum(y),type=p,axes=FALSE,xlab=Date,ylab=Failure 
Number,pch=20)

axis(side = 1,0:3 ,labels = dates)
axis(side = 2)
box()

i-seq(along=x)
segments(x[i],cumsum(y)[i],x[i+1],cumsum(y)[i])
segments(x[length(x)],cumsum(y)[length(y)],x[length(x)]+1,cumsum(y)[length(y)])


regards
andreas


[EMAIL PROTECTED] wrote:

Thank you for your advice, but this is not the exaxt thing i'm looking for
http://robotics.caltech.edu/~zoran/Research/poisson/img1.png
this picture gives an example what i want to get. instead of t0, t1, 
t2, i want to draw my dates.
In my description i forgot the the horizontal line, which indicates the 
time between two dates each, sorry for that.

regards
andreas


Dieter Menne wrote:

  

voodooochild at gmx.de writes:

 



i want to plot a count process in the following way, but i don't know
how i can do that. i have data for example x-(0,2,6,2,8,4,.) and
dates y which is a vector of weekly dates for example
(01/01/06, 08/01/06, 15/01/06, 22/01/06, ), now i want to plot the
y's an the horizontal axis. On each date the count process jumps upwards
1 unit, so the vertical axis is 0, 1, 2, 3, ..
the distance between the dates is shown in vector x, so for example the
distance between 08/01/06 and 15/01/06 should be 2. maybe i can use some
times series functions for doing this?

   

  

If I understand you correctly, this means plotting equidistant point against 
the cumulative sum. Forgetting about the dates now, this would do it.

x = floor(pmax(rnorm(30,5,2),1))
xcum = cumsum(x)
plot(xcum,1:30)

Dieter

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


 




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


  


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


Re: [R] echo output to screen

2006-02-09 Thread Liaw, Andy
Is something like this what you want?

 load_and_describe - function(pkg) {
+ eval(substitute(library(pkg)))
+ packageDescription(pkg)
+ }
 load_and_describe(e1071)
Package: e1071
Version: 1.5-12
Date: 2006-01-11
Title: Misc Functions of the Department of Statistics (e1071), TU Wien
Depends: class
Imports: graphics, stats
Suggests: cluster, mlbench, nnet, randomForest, rpart, SparseM, xtable
Author: Evgenia Dimitriadou, Kurt Hornik, Friedrich Leisch, David
Meyer, and Andreas Weingessel
Maintainer: Friedrich Leisch [EMAIL PROTECTED]
Description: Functions for latent class analysis, short time Fourier
transform, fuzzy clustering, support vector machines, shortest
path computation, bagged clustering, naive Bayes classifier,
...
License: GPL version 2.  See COPYRIGHT.svm.cpp for the copyright of the
svm C++ code.
SaveImage: no
LazyLoad: yes
Packaged: Wed Jan 11 17:37:06 2006; leisch
Built: R 2.2.1; i386-pc-mingw32; 2006-01-12 09:52:56; windows


Andy


From: Chun-Ying Lee
 
 On Thu, 09 Feb 2006 10:02:49 +0100, Uwe Ligges wrote
  Chun-Ying Lee wrote:
   Hi all,

 I want to echo output to screen before next step, 
   like the following when i type library(pkname),
   
   
  library(pkname)
   
   
   a few description about the package
   
   
   
  
  
   
   how should I do to get this?
  
  ?cat
 
 I know the use of cat
 
 but I mean that the description appear automatically
 when I type library(pkname)
 
  
  Uwe Ligges
  
   Thanks in advanced!!
   
  
 


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


Re: [R] Using R to process spectroscopic data

2006-02-09 Thread Katharine Mullen
In the biophysics group of Vrije Universiteit Amsterdam we are working on
an R package implementing a problem solving environment for multi-way
spectroscopic modeling.  We do not have a public version yet, but one will
be made available in the future.  We plan to describe the package at
useR2006.

If you are interested in the sort of (parametric model-based) analysis we
are doing, you can see some project documentation at
http://www.nat.vu.nl/comp/proj4.html.

To reply to one of your questions, for determination of the optimal number
of spectrally distinct components, you could simply take the SVD of your
measurements and plot the singular values.  The number of values that
stand out may be used as an estimate of the number of components.

Feel free to contact me for more information.  We look forward to
providing a complete and powerful package soon!


Katharine Mullen
Department of Physics and Astronomy
Faculty of Sciences
Vrije Universiteit Amsterdam
de Boelelaan 1081
1081 HV Amsterdam
The Netherlands
room: T.1.06
tel: +31 205987870
fax: +31 205987992
e-mail: [EMAIL PROTECTED]
http://www.nat.vu.nl/~kate/

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


[R] about Cox-Box transformation

2006-02-09 Thread Stefano Sofia
Dear R-users,
I am using R version 1.8.0-1 under Suse 8.2. 
I need to use the boxcox command because I want to apply a Cox-Box
transformation to a vector of rainfall values. 
Within the libraries, the MASS library is present, but I don't know
whether this means that is automatically installed or not.
The command doesn't work. What do I have to do in order to make it
working? Is just a problem of installation or simply of recalling the
right command?

thank you for your help
Stefano

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


Re: [R] about Cox-Box transformation

2006-02-09 Thread Prof Brian Ripley
On Thu, 9 Feb 2006, Stefano Sofia wrote:

 Dear R-users,
 I am using R version 1.8.0-1 under Suse 8.2.

That is *really* old.

 I need to use the boxcox command because I want to apply a Cox-Box
 transformation to a vector of rainfall values.
 Within the libraries, the MASS library is present, but I don't know
 whether this means that is automatically installed or not.
 The command doesn't work. What do I have to do in order to make it
 working? Is just a problem of installation or simply of recalling the
 right command?

library(MASS), I presume.

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

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


Re: [R] about Cox-Box transformation

2006-02-09 Thread Petr Pikal
Hi

1.  upgrade
2.  read Introduction to R shipped with the distribution
3.  read documentation to MASS
4.  packages not libraries
5.  use library(MASS) to make functions from MASS package available
6.  now you can use boxcox() but not on vectors AFAIK

probably not completely correct but this

box.cox - function(x, lambda,inv=F)
{   if (!inv)
{if(missing(lambda))
log(x)
else (x^lambda - 1)/lambda}
else (lambda*x+1)^(1/lambda)
}

you can use to perform Box-Cox transformation on vectors.

HTH
Petr


On 9 Feb 2006 at 11:51, Stefano Sofia wrote:

From:   Stefano Sofia [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Thu, 09 Feb 2006 11:51:02 +
Subject:[R] about Cox-Box transformation

 Dear R-users,
 I am using R version 1.8.0-1 under Suse 8.2. 
 I need to use the boxcox command because I want to apply a Cox-Box
 transformation to a vector of rainfall values. Within the libraries,
 the MASS library is present, but I don't know whether this means that
 is automatically installed or not. The command doesn't work. What do I
 have to do in order to make it working? Is just a problem of
 installation or simply of recalling the right command?
 
 thank you for your help
 Stefano
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] writing a file using both cat() and paste()

2006-02-09 Thread Adaikalavan Ramasamy
With regards to the saving bit, you might want to try dput() or save()
as well.

On Thu, 2006-02-09 at 19:29 -0500, Jim Lemon wrote:
 Taka Matzmoto wrote:
  Hi R users
  
  I like to create a ASCII type file using cat() and paste()
  
  x - round(runif(30),3)
  cat(vector =( , paste(x,sep=),  )\n, file = vector.dat,sep=,)
  
  when I open vector.dat it was a long ugly file
  
  vector =( 
  ,0.463,0.515,0.202,0.232,0.852,0.367,0.432,0.74,0.413,0.022,0.302,0.114,0.583,0.002,0.919,0.066,0.829,0.405,0.363,0.665,0.109,0.38,0.187,0.322,0.582,0.011,0.586,0.112,0.873,0.671,
   
  )
  
  Also there was some problems right after opening parenthesis and before the 
  closing parenthesis. Two comma were there
  
  I like to to have a nice formatted one like below. That is, 5 random values 
  per a line
  
  vector =( 0.463,0.515,0.202,0.232,0.852,
  0.367,0.432,0.74,0.413,0.022,
  0.302,0.114,0.583,0.002,0.919,
  0.066,0.829,0.405,0.363,0.665,
  0.109,0.38,0.187,0.322,0.582,
  0.011,0.586,0.112,0.873,0.671)
  
 First, you might want to avoid using vector, as that is the name of an 
 R function. Say you have a 30 element data vector as above. If you 
 wanted to write a fairly general function to do this, here is a start:
 
 vector2file-function(x,file=,values.per.line=5) {
   if(nchar(file)) sink(file)
   cat(deparse(substitute(x)),-c(\n)
   xlen-length(x)
   for(i in 1:xlen) {
cat(x[i])
if(ixlen) cat(,)
if(i%%values.per.line == 0) cat(\n)
   }
   cat())
   if(i%%values.per.line) cat(\n)
   if(nchar(file))sink()
 }
 
 Jim
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] logLik == -Inf in gls

2006-02-09 Thread nhy303
I am trying to fit a generalised least squares model using gls in the nlme
package.

The model seems to fit very well when I plot the fitted values against the
original values, and the model parameters have quite narrow confidence
intervals (all are significant at p5%).

The problem is that the log likelihood is always given as -Inf.  This
doesn't seem to make sense because the model seems to fit my data so well.
 I have checked that the residuals are stationary using an adf test.  I
can't work out whether
  - the model really doesn't fit at all
  - there is something in my data that stops the implementation of logLik
working correctly (the -Inf value says the calculation hasn't worked)

Possible causes are:
  - There are lots of NAs in my data (model and response variables)
  - There is some autocorrelation in the data that is not accounted for by
the model (most is accounted for).

But, I've tried recreating the problem using a simpler data set, and have
never found the same problem.

The command I use to fit the model is...



result2 - gls(lci4150 ~ propCapInStomachs +
temperature +
as.factor(monthNumber) +
lagLci1 +
lagcap1 +
lagcap2,
  data = monthly,
  subset = subset1985,
  na.action = na.approx,
  weights = varFixed( ~ 1/numob4150)
 )



The output I get is...



Generalized least squares fit by REML
  Model: lci4150 ~ propCapInStomachs + temperature +
as.factor(monthNumber) +  lagLci1 + lagcap1 + lagcap2
  Data: monthly
  Subset: subset1985
  AIC BIC logLik
  Inf Inf   -Inf

Variance function:
 Structure: fixed weights
 Formula: ~1/numob4150

Coefficients:
  Value Std.Error   t-value p-value
(Intercept)  -0.3282412 0.5795665 -0.566356  0.5717
propCapInStomachs 0.0093283 0.0039863  2.340107  0.0202
temperature   0.4342514 0.1526104  2.845490  0.0048
as.factor(monthNumber)2   0.3990717 0.3869991  1.031195  0.3036
as.factor(monthNumber)3   1.3788334 0.3675690  3.751223  0.0002
as.factor(monthNumber)4   1.4037195 0.3857764  3.638686  0.0003
as.factor(monthNumber)5   0.9903316 0.3436177  2.882074  0.0043
as.factor(monthNumber)6   0.3453741 0.3043698  1.134719  0.2577
as.factor(monthNumber)7   0.3948442 0.3035142  1.300909  0.1946
as.factor(monthNumber)8   0.5021812 0.3532413  1.421638  0.1565
as.factor(monthNumber)9  -0.0794319 0.3598981 -0.220707  0.8255
as.factor(monthNumber)10  0.3536805 0.3790538  0.933061  0.3518
as.factor(monthNumber)11  0.7874834 0.3557116  2.213826  0.0278
as.factor(monthNumber)12  0.1854279 0.3178320  0.583415  0.5602
lagLci1   0.5488437 0.0576144  9.526151  0.
lagcap1   0.0110994 0.0043669  2.541714  0.0117
lagcap2  -0.0088080 0.0041099 -2.143127  0.0332



Does anyone have any suggestions of how I can get a meaningful value for
logLik?  Or some other way that I can compare models.

Thankyou,

Lillian.
-- 
Lillian Sandeman
PhD Student
School of Biological Sciences
University of Aberdeen
AB24 2TZ

Tel.: 01224 272648
E-mail: [EMAIL PROTECTED]

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


Re: [R] about Cox-Box transformation

2006-02-09 Thread Prof Brian Ripley
On Thu, 9 Feb 2006, Petr Pikal wrote:

 Hi

 1.upgrade
 2.read Introduction to R shipped with the distribution
 3.read documentation to MASS
 4.packages not libraries
 5.use library(MASS) to make functions from MASS package available
 6.now you can use boxcox() but not on vectors AFAIK

You can by

boxcox(y ~ 1)

but car's box.cox does similar things.  (I did not mention that as adding 
packages to R 1.8.0 is unlikely to be easy.)

 probably not completely correct but this

 box.cox - function(x, lambda,inv=F)
 { if (!inv)
   {if(missing(lambda))
   log(x)
   else (x^lambda - 1)/lambda}
   else (lambda*x+1)^(1/lambda)
 }

 you can use to perform Box-Cox transformation on vectors.

 HTH
 Petr


 On 9 Feb 2006 at 11:51, Stefano Sofia wrote:

 From: Stefano Sofia [EMAIL PROTECTED]
 To:   r-help@stat.math.ethz.ch
 Date sent:Thu, 09 Feb 2006 11:51:02 +
 Subject:  [R] about Cox-Box transformation

 Dear R-users,
 I am using R version 1.8.0-1 under Suse 8.2.
 I need to use the boxcox command because I want to apply a Cox-Box
 transformation to a vector of rainfall values. Within the libraries,
 the MASS library is present, but I don't know whether this means that
 is automatically installed or not. The command doesn't work. What do I
 have to do in order to make it working? Is just a problem of
 installation or simply of recalling the right command?

 thank you for your help
 Stefano

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

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


Re: [R] getting strata/cluster level values with survey package?

2006-02-09 Thread James Reilly

Try the examples here:
?ftable.svystat

On 8/02/2006 12:23 p.m., Jeff D. Hamann wrote:
 First, I appoligise for the rooky question, but...
 
 I'm trying to obtain standard errors, confidence intervals, etc. from a
 sample design and have been trouble getting the results for anything other
 than the basic total or mean for the overall survey from the survey
 package.
 
 For example, using the following dataset,
 
 strata,cluster,vol
 A,1,18.58556192
 A,1,12.55175443
 A,1,21.65882438
 A,1,17.11172946
 A,1,15.41713348
 A,2,13.9344623
 A,2,17.13104821
 A,2,14.6806479
 A,2,14.68357291
 A,2,18.86017714
 A,2,20.67642515
 A,2,15.15295351
 A,2,13.82121102
 A,2,12.9110477
 A,2,14.83153677
 A,2,21.90772687
 A,3,18.69795427
 A,3,18.45636428
 A,3,15.77175793
 A,3,15.54715217
 A,3,20.31948393
 A,3,19.26391445
 A,3,15.54750775
 A,3,19.18724018
 A,4,12.89572151
 A,4,12.92047701
 A,4,12.64958757
 A,4,19.85888418
 A,4,19.64057669
 A,4,19.19188964
 A,4,18.81619298
 A,4,21.73670878
 A,5,15.99430802
 A,5,18.6517
 A,5,21.80441654
 A,5,14.22081904
 A,5,16.01576433
 A,5,14.92497202
 A,5,17.95123218
 A,5,19.82027165
 A,5,19.35698273
 A,5,19.10826519
 B,6,13.40892677
 B,6,14.3956207
 B,6,13.82113391
 B,6,16.37338569
 B,6,19.70159575
 B,7,14.74334178
 B,7,16.55125245
 B,7,12.38329798
 B,7,18.16472408
 B,7,16.32938475
 B,7,16.06465494
 B,7,12.63086062
 B,7,14.46114813
 B,7,21.90134013
 B,7,13.81025827
 B,7,15.85805494
 B,7,20.18195326
 B,8,19.05120792
 B,8,12.83856639
 B,8,12.61360139
 B,8,21.30434314
 B,8,14.19960469
 B,8,17.38397826
 B,8,15.66477339
 B,8,22.07182834
 B,8,12.07487394
 B,8,20.36357359
 B,8,20.2543677
 B,9,14.44499362
 B,9,17.77235228
 B,9,13.01620902
 B,9,18.10976359
 B,10,18.22350661
 B,10,18.41504728
 B,10,17.94735486
 B,10,18.39173938
 B,10,14.21729704
 B,10,16.95753684
 B,10,21.11643087
 B,10,16.09688752
 B,10,19.54707452
 B,10,22.00450065
 B,10,15.15308873
 B,10,14.72488972
 B,10,17.65280737
 B,10,14.61615255
 B,10,12.89525607
 B,11,22.35831089
 B,11,18.0853187
 B,11,22.12815791
 B,11,17.74562214
 B,11,21.45724242
 B,11,20.57933779
 B,11,19.97397415
 B,11,16.34967424
 B,12,22.14385376
 B,12,17.82816113
 B,12,18.37056381
 B,12,16.13152759
 B,12,22.06764318
 B,12,12.80924472
 B,12,18.95522175
 B,13,20.40554286
 B,13,19.72951878
 C,14,15.51581
 C,14,15.4836358
 C,14,13.35882363
 C,14,13.16072916
 C,14,21.69168971
 C,14,19.09686303
 C,14,14.47450457
 C,14,12.04870424
 C,14,13.33096141
 C,14,17.38388981
 C,14,16.29015289
 C,14,16.32707754
 C,14,16.2784054
 C,15,15.0170597
 C,15,14.95767365
 C,15,15.20739614
 C,15,22.10458509
 C,15,12.3362457
 C,15,19.87895753
 C,15,18.8363682
 C,15,16.43738666
 C,15,12.84570744
 C,15,15.99869357
 C,15,14.42551321
 C,15,13.63489872
 C,15,15.67179885
 C,16,14.61700901
 C,16,14.64864676
 C,16,14.13014582
 C,16,21.7637441
 C,16,20.66825543
 C,16,17.05977818
 C,16,17.80118916
 C,16,15.16641698
 
 where this is read into stand.data. When I use the following survey designs,
 
 srv1 - svydesign(ids=~1, strata=~strata, data=stand.data )
 
 or,
 
 srv1 - svydesign(ids=~cluster, strata=~strata, data=stand.data )
 
 with,
 
 print( svytotal( ~vol, srv1 ) )
 
 I only obtain the total,
 
 print( svytotal( ~vol, srv1 ) )
 total SE
 vol  2377 34.464
 
 or worse,
 
 print( svytotal( ~vol + strata, srv1 ) )
  total SE
 vol 2377.0 34.464
 strataA   42.0  0.000
 strataB   64.0  0.000
 strataC   34.0  0.000
 
 which reports the number of observations in each of the strata. I'm sure
 this is a RTFM question, but I just need a start. The size of each plot
 is 0.04 units (hectares) and I want to be able to quickly examine working
 up each sample with and without clusters (this is going to be part of a
 larger simulation study).
 
 I'm trying to not use SAS for this and hate to admit defeat.
 
 Thanks,
 Jeff.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
James Reilly
Department of Statistics, University of Auckland
Private Bag 92019, Auckland, New Zealand

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


Re: [R] logLik == -Inf in gls

2006-02-09 Thread Prof Brian Ripley
Please do not repeatedly post the same thing.  This is the same as

https://stat.ethz.ch/pipermail/r-help/2006-February/086381.html

(except you remembered to sign that one).

You are fitting a weighted not a generalised least squares model: lm() 
will do that.

On Thu, 9 Feb 2006, [EMAIL PROTECTED] wrote:

 I am trying to fit a generalised least squares model using gls in the nlme
 package.

 The model seems to fit very well when I plot the fitted values against the
 original values, and the model parameters have quite narrow confidence
 intervals (all are significant at p5%).

 The problem is that the log likelihood is always given as -Inf.  This
 doesn't seem to make sense because the model seems to fit my data so well.
 I have checked that the residuals are stationary using an adf test.  I
 can't work out whether
  - the model really doesn't fit at all
  - there is something in my data that stops the implementation of logLik
 working correctly (the -Inf value says the calculation hasn't worked)

 Possible causes are:
  - There are lots of NAs in my data (model and response variables)
  - There is some autocorrelation in the data that is not accounted for by
 the model (most is accounted for).

 But, I've tried recreating the problem using a simpler data set, and have
 never found the same problem.

Well, how then do you expect us to be able to recreate it?

As a pure guess, look at your weights.  Are any numob4150 zero?


 The command I use to fit the model is...



 result2 - gls(lci4150 ~ propCapInStomachs +
temperature +
as.factor(monthNumber) +
lagLci1 +
lagcap1 +
lagcap2,
  data = monthly,
  subset = subset1985,
  na.action = na.approx,
  weights = varFixed( ~ 1/numob4150)
 )



 The output I get is...



 Generalized least squares fit by REML
  Model: lci4150 ~ propCapInStomachs + temperature +
 as.factor(monthNumber) +  lagLci1 + lagcap1 + lagcap2
  Data: monthly
  Subset: subset1985
  AIC BIC logLik
  Inf Inf   -Inf

 Variance function:
 Structure: fixed weights
 Formula: ~1/numob4150

 Coefficients:
  Value Std.Error   t-value p-value
 (Intercept)  -0.3282412 0.5795665 -0.566356  0.5717
 propCapInStomachs 0.0093283 0.0039863  2.340107  0.0202
 temperature   0.4342514 0.1526104  2.845490  0.0048
 as.factor(monthNumber)2   0.3990717 0.3869991  1.031195  0.3036
 as.factor(monthNumber)3   1.3788334 0.3675690  3.751223  0.0002
 as.factor(monthNumber)4   1.4037195 0.3857764  3.638686  0.0003
 as.factor(monthNumber)5   0.9903316 0.3436177  2.882074  0.0043
 as.factor(monthNumber)6   0.3453741 0.3043698  1.134719  0.2577
 as.factor(monthNumber)7   0.3948442 0.3035142  1.300909  0.1946
 as.factor(monthNumber)8   0.5021812 0.3532413  1.421638  0.1565
 as.factor(monthNumber)9  -0.0794319 0.3598981 -0.220707  0.8255
 as.factor(monthNumber)10  0.3536805 0.3790538  0.933061  0.3518
 as.factor(monthNumber)11  0.7874834 0.3557116  2.213826  0.0278
 as.factor(monthNumber)12  0.1854279 0.3178320  0.583415  0.5602
 lagLci1   0.5488437 0.0576144  9.526151  0.
 lagcap1   0.0110994 0.0043669  2.541714  0.0117
 lagcap2  -0.0088080 0.0041099 -2.143127  0.0332



 Does anyone have any suggestions of how I can get a meaningful value for
 logLik?  Or some other way that I can compare models.

 Thankyou,

 Lillian.


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

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


Re: [R] lme syntax for PB examples

2006-02-09 Thread Henric Nilsson
Paul Cossens said the following on 2006-02-09 06:21:
 Hi Harold,
 
 
 Thanks for your reply. I had already looked at all the reading material
 you suggested but updated to the latest Matrix 
 as recommneded then spent all day trying to figure out what is
 happening.  
 
 I worked through the problems and give my workings below that others may
 find useful. 
 (My notation is to use lme to show lme commands and lmer to show lmer
 commands. 
 I worked on two sessions in parallel. My comments are preceded by double
 hashes '##' and
 questions '##??'. I haven't included the datasets.)   
 
 I have a couple of comments and outstanding issues:
 
 1. In the Pixel data set and formulas I think the formulas are printed
 incorrectly in the 
 book as some use 'I(day^2)' while others use just 'day^2'. I have used
 'I(day^2)'. I'm not sure why the I() function is used. In the fm4Pixel
 example below the answers don't match up exactly but are close.
 
 The lme example is 
 fm1Pixel-lme(pixel~day+I(day^2),data=Pixel,random = list(Dog=~day
 ,Side=~1))
 fm5Pixel - update(fm1Pixel,pixel ~ day + I(day^2) + Side)
 which I have converted to lmer:
 fm4Pixel - lmer(pixel ~ day + I(day^2) +Side +(day|Dog), data = Pixel)
 
 The t-values for Side are close (sse below) but different enough to
 wonder if I am still doing something wrong? 

It's wrong. Try

fm6Pixel - lmer(pixel ~ day + I(day^2) + Side + (day|Dog) + 
(1|Side:Dog), data = Pixel)

 2. To me the specification description in the R-News article is
 confusing as it seems 
 to suggest that nesting does not need to be completely specified if the
 groupings and nestings are clear in data set. 
 
 Prof Bates article in R news vol 5/1 P 30  states It happens in this
 case that the grouping factors 'id' and 'sch' are not nested but if they
 were nested there would be no change in the model specification
 
 If the lme formula is 
 fm1Oxide-lme(Thickness~1,Oxide)
 
 I have found the formula lmer parlance should be:
 'fm1Oxide-lmer(Thickness~ (1|Lot)+(1|Lot:Wafer),data=Oxide)'
 not 'fm1Oxide-lmer(Thickness~ (1|Lot)+(1|Wafer),data=Oxide)'
 as the article reads to me. 
 
 In other words you always need to explicitly specify nesting levels.
 
 3. I still can't figue out how to replicate the lme formula
 fm2Oxide-update(fm1Oxide,random =~1|Lot)
 i.e 
 formula(fm2Oxide)
 Thickness ~ 1
 
 If I simply drop the Lot:Wafer term as in 'fm2Oxide-lmer(Thickness~
 (1|Lot),data=Oxide)'
 I get the error
 
 'Error in x[[3]] : object is not subsettable'
 
 what's the solution?

fm3Oxide - lmer(Thickness ~ 1 + (1|Lot), data = Oxide)

This seems to be a bug in `lmer', since one doesn't have to specifiy the 
intercept explicitly in e.g.

lmer(Thickness ~ (1|Lot) + (1|Wafer), data = Oxide)


HTH,
Henric



 
 I'd be interested to read you article for further insights.
 
 Thanks
 
 Paul
 
 
 
 #
 #Oxide
 # PB(2000) p167-170
 
 #NLME lme example
 
 lmedata(Oxide)
 lmeformula(Oxide)
 lmeThickness ~ 1 | Lot/Wafer
 lmefm1Oxide-lme(Thickness~1,Oxide)
 lme fm1Oxide
 Linear mixed-effects model fit by REML
   Data: Oxide 
   Log-restricted-likelihood: -227.0110
   Fixed: Thickness ~ 1 
 (Intercept) 
2000.153 
 
 Random effects:
  Formula: ~1 | Lot
 (Intercept)
 StdDev:11.39768
 
  Formula: ~1 | Wafer %in% Lot
 (Intercept) Residual
 StdDev:5.988802 3.545341
 
 Number of Observations: 72
 Number of Groups: 
Lot Wafer %in% Lot 
  8 24 
 
 lme intervals(fm1Oxide, which = var-cov)
 Approximate 95% confidence intervals
 
  Random Effects:
   Level: Lot 
   lower est.upper
 sd((Intercept)) 6.38881 11.39768 20.33355
   Level: Wafer 
lower est.upper
 sd((Intercept)) 4.063919 5.988802 8.825408
 
  Within-group standard error:
lower est.upper 
 2.902491 3.545341 4.330572 
 fm2Oxide-update(fm1Oxide,random =~1|Lot)
 lme fm2Oxide
 Linear mixed-effects model fit by REML
   Data: Oxide 
   Log-restricted-likelihood: -245.5658
   Fixed: Thickness ~ 1 
 (Intercept) 
2000.153 
 
 Random effects:
  Formula: ~1 | Lot
 (Intercept) Residual
 StdDev:11.78447 6.282416
 
 Number of Observations: 72
 Number of Groups: 8
 
 lmeintervals(fm2Oxide, which = var-cov)
 Approximate 95% confidence intervals
 
  Random Effects:
   Level: Lot 
lower est.upper
 sd((Intercept)) 6.864617 11.78447 20.23035
 
  Within-group standard error:
lower est.upper 
 5.283116 6.282416 7.470733 
 
 lme coef(fm1Oxide, level=1)
   (Intercept)
 11996.689
 21988.931
 32001.022
 41995.682
 52013.616
 62019.561
 71991.954
 81993.767
 coef(fm1Oxide, level=1)
   (Intercept)
 11996.689
 21988.931
 32001.022
 41995.682
 52013.616
 62019.561
 71991.954
 81993.767
 coef(fm1Oxide, level=2)
 (Intercept)
 1/12003.235
 1/21984.730
 1/32001.146
 2/11989.590
 

Re: [R] about Cox-Box transformation

2006-02-09 Thread Stefano Sofia
Paulo, 
thank you for the straightforward hint. 
But then, I should use the Box-Cox transformation to a set of data,
whose class at the moment is data.frame. 
The help says only lm and aov objects can be handled. What should I do?


thank you
Stefano


On Thu, 2006-02-09 at 10:56 -0200, Paulo Justiniano Ribeiro Jr wrote:
 first load the package with:
 
 require(MASS)
 
 and then use the boxcox() function
 
 
 On Thu, 9 Feb 2006, Stefano Sofia wrote:
 
  Date: Thu, 09 Feb 2006 11:51:02 +
  From: Stefano Sofia [EMAIL PROTECTED]
  To: r-help@stat.math.ethz.ch
  Subject: [R] about Cox-Box transformation
  
  Dear R-users,
  I am using R version 1.8.0-1 under Suse 8.2.
  I need to use the boxcox command because I want to apply a Cox-Box
  transformation to a vector of rainfall values.
  Within the libraries, the MASS library is present, but I don't know
  whether this means that is automatically installed or not.
  The command doesn't work. What do I have to do in order to make it
  working? Is just a problem of installation or simply of recalling the
  right command?
 
  thank you for your help
  Stefano
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 
 Paulo Justiniano Ribeiro Jr
 LEG (Laboratório de Estatística e Geoinformação)
 Departamento de Estatística
 Universidade Federal do Paraná
 Caixa Postal 19.081
 CEP 81.531-990
 Curitiba, PR  -  Brasil
 Tel: (+55) 41 3361 3573
 Fax: (+55) 41 3361 3141
 e-mail: [EMAIL PROTECTED]
 http://www.est.ufpr.br/~paulojus

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

[R] font size/disappearing labels

2006-02-09 Thread Karin Lagesen

I am sorry if you get this email twice, but it did not show up in the
digest nor on the web archive, so I am taking the chance of resending
it.

I am using vioplot to make nice boxplots, which I am outputting to
postscript. I am using the paper=special and width and height to get
the graphs to look nice. I do however have a problem with the size of
the labels and titles. When I set fontsize as an option to the
postscript call too high, one of the labels disappear, although there
is enough space for it (imo, that is). This I have understood is an
effect of the system trying to avoid overlapping numbers. Is there a
way I can override this function though? Can I force it to show all of
the labels, although they might be too close?


Karin
-- 
Karin Lagesen, PhD student
[EMAIL PROTECTED]
http://www.cmbn.no/rognes/

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


[R] bootstrapping lambda values from projections matrices

2006-02-09 Thread Saskia Sandring
Dear all,

I'm working with a population projections matrix model from demographic
data. The dominant eigenvalue of the matrix is the growth rate of the
population (lambda). I would like to estimate confidence intervals for the
lambda values with bootstrap. 
The function for calculating the eigenvalue I wrote like this: 

mat.fun - function(d,i){
mat-matrix(c(0,
sum(d$klyear1[i]==1d$classyear2[i]==2)/sum(d$classyear1[i]==1),
sum(d$classyear1[i]==1d$classyear2[i]==3)/sum(d$classyear1[i]==1), 0,
sum(d$classyear1[i]==2d$classyear2[i]==2)/sum(d$classyear1[i]==2),
sum(d$classyear1[i]==2d$classyear2[i]==3)/sum(d$classyear1[i]==2),
sum(d$classyear1[i]==0d$classyear2[i]==1)/sum(d$classyear1[i]==3),
sum(d$classyear1[i]==3d$classyear2[i]==2)/sum(d$classyear1[i]==3),
sum(d$classyear1[i]==3d$classyear2[i]==2)/sum(d$classyear1[i]==3),

sum(d$classyear1[i]==3d$classyear2[i]==3)/sum(d$classyear1[i]==3)),ncol=3)
abs(eigen(mat,only.values=T)$values[1])
}

Now, in the pooled matrix from all years I would like to sample in a way
that the number of bootstrap samples taken from each year is equal to the
number of data points from each year. Therefore I'm defining strata=year. 

boot1 - boot(myfile, mat.fun, 5000, strata=myfile$year); boot1

Is this the correct way to do it or did I misunderstand the
strata-argument? I checked in Davison, A.C. and Hinkley, D.V. (1997), but
I'm still not quite sure.

Thanks very much in advance for your help!

Sincerely,
Saskia Sandring

_
Saskia Sandring

Avd. för växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University
Villavägen 14   tel: 018-471 2870 (int +46 18 4712870)
SE-752 36 Uppsala   fax: 018-55 34 19 (int +46 18 553419)
SWEDEN  email: [EMAIL PROTECTED]

http://www.vaxtbio.uu.se/resfold/sandring.htm

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


Re: [R] adding variable into dataframe by indice

2006-02-09 Thread Adrian Katschke
Thank you for your assistance. I find that the by using the list I learn 
something new everytime.
   
  --Adrian 
   
   
  Hi

not sure if I understand correctly but table() can be used

ttt - table(asubs112$fir)
prop - ttt/nrow(asubs112)
asubs112$prop -
prop[match(asubs112$first_drink,as.numeric(names(prop)))]

 asubs112
   IND_ID rs1042364 first_drink  prop
2  11 (1,2)   7 0.333
5  41 (1,2)  11 0.111
6  51 (1,2)   7 0.333
7  61 (1,1)   7 0.333
8  71 (1,1)  12 0.222
10 91 (1,1)   6 0.111
11101 (1,2)   5 0.111
12111 (1,2)  13 0.111
14131 (1,2)  12 0.222
 

HTH
Petr


On 8 Feb 2006 at 9:40, Adrian Katschke wrote:

Date sent:   Wed, 8 Feb 2006 09:40:43 -0800 (PST)
From:Adrian Katschke [EMAIL PROTECTED]
To:  RHelp r-help@stat.math.ethz.ch
Subject: [R] adding variable into dataframe by indice

   R-Helpers,
 
   I am trying to insert a value into a dataframe. This value is a
   proportion calculated by counting the number of those individuals
   with that value and then inserting the proportion at the end of the
   dataframe to only those individuals with the given value. The
   problem I am running into is that the proportions are not being
   attached to only those individuals with the specified value for 
that
   proportion. 
 
   Below is an example of the code that I am using. The data is made 
up
   for the dataframe. Should give you an idea, but the original has
   'NA' in many rows. The original data is what is reported in the
   output below.
 
 #Read in Data
   age.int - data.frame(IND_ID = seq(1, 140, 10),   rs1042364 =
   sample( c((1,1),(1,2),(2,2)),14,replace = T), first_drink =
   sample(5:17,14,replace = T))
 
 
 
 asubs112 - subset(age.int, rs1042364 != (2,2))
 
 
 ages112 - sort(unique(na.omit(asubs112$first_drink)))
 
   for ( i in ages112) {
 indce - which(na.omit(asubs112$first_drink == i))
 prop - length(indce)/nrow(asubs112)
 asubs112[indce,4] - prop
 asubs112[indce,]
   }
 
   Below is the output that I get from the script above. Notice the
   proportion for the first NA but not any of the others. Not sure 
what
   I am doing wrong, any suggestions are a big help.
 
   TIA,
   Adrian
 
asubs112[1:50,]
   IND_ID rs1042364 first_drink age_int  V5
 4   10008007 (1,2)  NA  16 0.003891051
 6   10013012 (1,2)  13  14 0.116731518
 7   10015006 (1,2)  12  17 0.105058366
 8   10015007 (1,1)  12  16 0.105058366
 10  10021009 (1,2)  NA  15  NA
 14  10039036 (1,2)  NA  15  NA
 15  10039037 (1,2)  NA  13  NA
 17  10045005 (1,2)  13  17 0.116731518
 18  10045014 (1,2)  13  14 0.116731518
 21  10055022 (1,2)  NA  15  NA
 
 
 
 
 
 
  [[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

Petr Pikal
[EMAIL PROTECTED]




[[alternative HTML version deleted]]

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


[R] Tranferring R results to word prosessors

2006-02-09 Thread Tom Backer Johnsen
I have just started looking at R, and are getting more and more irritated 
at myself for not having done that before.

However, one of the things I have not found in the documentation is some 
way of preparing output from R for convenient formatting into something 
like MS Word.  An example:  If you use summary(lm()) you get nice 
output.  However, if you try to paste that output into the word processor, 
all the text elements are separated by blanks, and that is not optimal for 
the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would solve 
the problem.

Tom

++
| Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
| Tel : +47-5558-9185Fax : +47-5558-9879 |
| Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
++

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Doran, Harold
Well, I don't know if it can be used with Word or not, but you might
consider Sweave for use with LaTeX. Maybe if you use the sink() command
this might work, but I haven't tried it. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom Backer
Johnsen
Sent: Thursday, February 09, 2006 9:41 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Tranferring R results to word prosessors

I have just started looking at R, and are getting more and more
irritated at myself for not having done that before.

However, one of the things I have not found in the documentation is some
way of preparing output from R for convenient formatting into something
like MS Word.  An example:  If you use summary(lm()) you get nice
output.  However, if you try to paste that output into the word
processor, all the text elements are separated by blanks, and that is
not optimal for the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would
solve the problem.

Tom

++
| Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology | 
| University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
| Tel : +47-5558-9185Fax : +47-5558-9879 |
| Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
++

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

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Gabor Grothendieck
In Word use a fixed font such as Courier rather than a proportional
font and it will look ok.

On 2/9/06, Tom Backer Johnsen [EMAIL PROTECTED] wrote:
 I have just started looking at R, and are getting more and more irritated
 at myself for not having done that before.

 However, one of the things I have not found in the documentation is some
 way of preparing output from R for convenient formatting into something
 like MS Word.  An example:  If you use summary(lm()) you get nice
 output.  However, if you try to paste that output into the word processor,
 all the text elements are separated by blanks, and that is not optimal for
 the creation of a table (in the word processing sense).

 Is there an option to generate tab-separated output in R ? That would solve
 the problem.

 Tom

 ++
 | Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
 | University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
 | Tel : +47-5558-9185Fax : +47-5558-9879 |
 | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
 ++

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


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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Romain Francois
Le 09.02.2006 15:41, Tom Backer Johnsen a écrit :

I have just started looking at R, and are getting more and more irritated 
at myself for not having done that before.

However, one of the things I have not found in the documentation is some 
way of preparing output from R for convenient formatting into something 
like MS Word.  An example:  If you use summary(lm()) you get nice 
output.  However, if you try to paste that output into the word processor, 
all the text elements are separated by blanks, and that is not optimal for 
the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would solve 
the problem.

Tom
  

Hi ,

One way could be to output in html format from R (with the R2HTML 
package) and then read back the html from your word processor

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Sebastian Luque
Tom Backer Johnsen [EMAIL PROTECTED] wrote:

[...]

 However, one of the things I have not found in the documentation is some
 way of preparing output from R for convenient formatting into something 
 like MS Word.

In case you're not talking about table-like output exclusively, reading
?Devices describes all the available kinds of graphical output.  Most of
these can then easily be included in MS Word.

Cheers,

-- 
Sebastian P. Luque

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


Re: [R] lme syntax for PB examples

2006-02-09 Thread Martin Maechler
 HaroldD == Doran, Harold [EMAIL PROTECTED]
 on Wed, 8 Feb 2006 08:01:03 -0500 writes:

HaroldD 

HaroldD A few thoughts, first, use lmer in the Matrix
HaroldD package and not in lme4. 

Well, that's potentially misleading advice:  If both lme4 and
Matrix are (more or less) current, it is actually better to call
library(lme4) if you want to use  lmer() .

A more extensive advice + explanation :

  - lme4 is the package you should use when using lmer().
Using Matrix *instead* works as well *currently*
(and yes, *currently* lmer is in the Matrix namespace).

  - At the moment, lme4 is an almost empty wrapper around using
package Matrix, since the C code for lmer() needs to be
able to call C code inside Matrix and that is not yet
portably possible.
For that reason, everything for lmer() is currently inside
Matrix, but that should change when R will have the
infrastructure for R packages to export their C API such that
other R packages can reliably use that C API.


HaroldD 

HaroldD Last, a colleague and I have a paper in press
HaroldD showing how to fit models using lme which we
HaroldD submitted a year or so ago.

HaroldD Since lme has evolved to lmer, we created an
HaroldD appendix that translates all of our lme models to
HaroldD the lmer syntax so readers can see equivalences. I
HaroldD am happy to send this to you (or others) upon request.

That sounds quite interesting; I'll be glad to receive it as
well.

Martin Maechler, ETH Zurich


HaroldD http://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf

HaroldD Harold

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Rau, Roland
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Romain Francois
 Sent: Thursday, February 09, 2006 3:54 PM
 To: Tom Backer Johnsen
 
 One way could be to output in html format from R (with the R2HTML 
 package) and then read back the html from your word processor
 
 Romain

If you go along the HTML path, the package xtable might be also your
friend:

library(xtable)
mymat - matrix(1:9, ncol=3)
print.xtable(xtable(mymat), type=HTML)


Hope this is useful for you,
Roland

+
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

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


Re: [R] prehistoric versions of R -- 1995!

2006-02-09 Thread François Pinard
[Martin Maechler]

2) The oldest stuff that I have is all from 1995;

Mailing lists seem to go back into 1995 too.  I found a few messages 
from around 1994 on topics to be later found within R, but I'm not sure 
where I got these old messages from.  I did find a message really 
related to R-pre-alpha, which itself quotes a message written in 1994.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

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


[R] Baysian model averaging method

2006-02-09 Thread anil kumar rohilla
  
HI, List 
 I want to know weather any body has used BMA Package for model averaging 
for prediction of future values.What are the paprmeters we have to suplly 
to the model. Any script for the same.

thanks in advance


ANIL KUMAR( METEOROLOGIST)
LRF SECTION 
NATIONAL CLIMATE CENTER 
ADGM(RESEARCH)
INDIA METEOROLOGICAL DEPARTMENT
SHIVIJI NAGAR
PUNE-411005 INDIA
MOBILE +919422023277
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


[R] callling R from C

2006-02-09 Thread Globe Trotter
Can anyone please provide me with a simple example on calling R from C? 

Many thanks and best wishes!
GT

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


[R] (no subject)

2006-02-09 Thread Karim Bakir
Hi,

Can you help me please.

I must developp an  application with the logiciel R.

It 's an application for pricing. So I see  it uses the langage C  and I see   
on the  net  taht  it 's possible  in c++.

Use C++ it 's better than C , we  know it.

However It  says  to use c++ with R ,  we  must :



You need to do two things: 

(a) Write a wrapper to export the symbols you want to call from R as extern 
C. 

(b) Include the C++ libraries in the link to make the DLL. Suppose X.cc 
contains your C++ code, and X_main.cc is the wrapper, as in the example in 
`Writing R Extensions'. Then build the DLL by (gcc) 

 ...\bin\R CMD SHLIB X.cc X_main.cc
or (VC++, which requires extension .cpp) 

 cl /MT /c X.cpp X_main.cpp
 link /dll /out:X.dll /export:X_main X.obj X_main.obj
or (Borland C++, which also requires extension .cpp) 

 bcc32 -u- -WDE X.cpp X_main.cpp
and call the entry point(s) in X_R, such as X_main. Construction of static 
variables will occur when the DLL is loaded, and destruction when the DLL is 
unloaded, usually when R terminates. 

Note that you will not see the messages from this example in the GUI console: 
see the next section. 

This example used to be in package cxx_0.0-x.tar.gz in the src/contrib/Devel 
section on CRAN, and could be compiled as a package in the usual way on 
Windows. 

So it doesn't  run , 

With C it 's ok but  with  c++ no no.

I dont  understand  and  don' t know how write this wraper, because  
Compilateur Visual C++ compile  C too, so I don't  need  wraper?

Too  there is a black box used in Logiciel R  it is writted in  R with  C it 
'ok  but with c++ it doesn't



Can you help me  please.



Thank you very much





[[alternative HTML version deleted]]

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


[R] quote problem

2006-02-09 Thread Tom Van Engeland
  Hi.
  I'm trying to analyse information from a large database using R. I have some 
problems with quotes during the generation of strings.
   
  Setting: I extract data from a lot of sampling location (chemical data on 
water quality) 
  and for each location I have a date of sampling and a value. I want to put 
everything in a list such that for each sampling point (say OS1) I have two 
columns (date, time). I use the function sqlQuery from the RODBC package.
   
  Here is an example that works:
  OxygenMeasurements$OS1 - sqlQuery(channel, SELECT saDateTime, sdValue FROM 
dbo_Sample WHERE (paID = 213) AND (stCode ='OS1');)
   
  To keep the code elegant and, above all, short I try to regenerate the same
  function call with a different query statement for each sampling point by 
using 
  the paste() function.
   
  (1) sqlquery - paste(SELECT saDateTime, sdValue FROM dbo_Sample WHERE (paID 
= 213) AND (stCode =' , paste(stations$stCode, sep=,) , '); , sep=)
  This gives a vector with the sql syntax. The following line generates the 
whole sqlQuery-statement.
   
  (2) queries - paste(OxygenMeasurements$, paste(stations[,1]),  - 
sqlQuery(channel, \, paste(sqlquery) ,  \) , sep=)
   
  This is the result for the first two elements of 'queries':
   
  OxygenMeasurements$OS1 - sqlQuery(channel, \SELECT saDateTime, sdValue 
FROM dbo_Sample WHERE (paID = 213) AND (stCode ='OS1'); \)
  OxygenMeasurements$OS2 - sqlQuery(channel, \SELECT saDateTime, sdValue 
FROM dbo_Sample WHERE (paID = 213) AND (stCode ='OS2'); \)
   
  If these are evaluated ( eval(queries)) it should fill the datastructure 
OxygenMeasurements with the desired data.
   
  The problem:
  The query statement containts a string and is a string in itself. In addition 
elements of 'queries' are strings. R doesn't seem to be able to cope with this, 
since it generates \ on locations where a  has to be put. Is there a way to 
let the paste function generate
  a string with  in it without the \ ?
   
  In a way there are 3 nested strings and R can only cope with 2 levels (by 
using ' and ) in my view.
   
  Does anyone know how to put  IN the string instead of \?
   
  Thanks for the feedback.
   
  Tom


-
Win a BlackBerry device from O2 with Yahoo!. Enter now.
[[alternative HTML version deleted]]

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Adaikalavan Ramasamy
I agree that this is the best way. 

I often use Courier font with font size 10 that gives very good results.


On Thu, 2006-02-09 at 09:47 -0500, Gabor Grothendieck wrote:
 In Word use a fixed font such as Courier rather than a proportional
 font and it will look ok.
 
 On 2/9/06, Tom Backer Johnsen [EMAIL PROTECTED] wrote:
  I have just started looking at R, and are getting more and more irritated
  at myself for not having done that before.
 
  However, one of the things I have not found in the documentation is some
  way of preparing output from R for convenient formatting into something
  like MS Word.  An example:  If you use summary(lm()) you get nice
  output.  However, if you try to paste that output into the word processor,
  all the text elements are separated by blanks, and that is not optimal for
  the creation of a table (in the word processing sense).
 
  Is there an option to generate tab-separated output in R ? That would solve
  the problem.
 
  Tom
 
  ++
  | Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
  | University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
  | Tel : +47-5558-9185Fax : +47-5558-9879 |
  | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
  ++
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Philippe Grosjean
I have added several convenient methods for sending data directly from R 
to Microsoft Word (report() function) in the svViews package (SciViews 
bundle). However, I still have to upload it to CRAN. I do it right now. 
It should be available in a couple of days.
Best,

Philippe Grosjean

Romain Francois wrote:
 Le 09.02.2006 15:41, Tom Backer Johnsen a écrit :
 
 
I have just started looking at R, and are getting more and more irritated 
at myself for not having done that before.

However, one of the things I have not found in the documentation is some 
way of preparing output from R for convenient formatting into something 
like MS Word.  An example:  If you use summary(lm()) you get nice 
output.  However, if you try to paste that output into the word processor, 
all the text elements are separated by blanks, and that is not optimal for 
the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would solve 
the problem.

Tom
 

 
 Hi ,
 
 One way could be to output in html format from R (with the R2HTML 
 package) and then read back the html from your word processor
 
 Romain


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


Re: [R] font size/disappearing labels

2006-02-09 Thread Martin Maechler
 Karin == Karin Lagesen [EMAIL PROTECTED]
 on Thu, 09 Feb 2006 14:32:53 +0100 writes:

Karin I am sorry if you get this email twice, but it did not show up in the
Karin digest nor on the web archive, so I am taking the chance of resending
Karin it.

But it's definitely there in both the digest and the web archive;
here the archive entry:
https://stat.ethz.ch/pipermail/r-help/2006-February/086365.html

I rather think nobody felt compelled to answer you,
because you didn't follow the posting guide (see link at end of
*every* R-help mesage) well (look for reproducible in the guide!).

Regards,
Martin Maechler, ETH Zurich

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Barry Rowlingson
Tom Backer Johnsen wrote:
 I have just started looking at R, and are getting more and more irritated 
 at myself for not having done that before.
 
 However, one of the things I have not found in the documentation is some 
 way of preparing output from R for convenient formatting into something 
 like MS Word.  

  Well whatever you do, don't start looking at LaTeX, because that will 
get you even more irritated at yourself for not having done it before.

  LaTeX is to Word as R is to what? SPSS?

  I've still not seen a pretty piece of mathematics - or even text - in 
Word.

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


[R] Point Size in plot.cox.zph

2006-02-09 Thread Luke Keele

I would like control over the point size (and the type of points) when
plotting a cox.zph object, but it returns the same error as when one
tries to change the y-axis.  I have searched the web for an answer (and
the r-help list) but to no avail.  What I have done is make a blank plot
and use the points command as follows:

plot(time, war.zph$y[,7], type=n)
points(war.zph[7],  ann=F, pch = .)

But this causes you to lose the spline fit and seems rather cumbersome.
  A way to do this using the standard plot.cox.zph framework would be
very helpful.

Thanks

   Luke

-- 
Luke Keele
Assistant Professor
Dept. Of Political Science
Ohio State University

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


[R] Color key in Heat map

2006-02-09 Thread Vasundhara Akkineni
Hi all,

I am trying to produce a heatmap to display clustering of similar rows in
the data given below. For each given row, different colors are used to
represent the corresponding column value. I want to display the values of
the colors in the form of a color key added to the heatmap. Is there anyway
of doing this?

 z[1:10,1:6]
 [,1][,2][,3][,4][,5][,6]
 [1,]   403.0   409.3   611.5   569.2   536.6   580.2
 [2,]   757.3   574.4   826.7   595.3   755.2   956.0
 [3,]   284.4   327.3   421.6   336.6   391.3   412.6
 [4,]  2314.2  1685.3  2264.7  2204.1  2233.1  2458.4
 [5,]  1574.5  1273.0  1484.6  1321.2  1474.7  1774.1
 [6,]  2333.7  1796.8  2464.5  2372.5  2095.9  2735.7
 [7,] 13673.9 11463.9 13624.7 14513.9 12934.1 16293.1
 [8,] 17778.8 15248.8 19977.2 19613.4 18609.1 18988.2
 [9,] 31056.6 24869.9 30773.4 32918.6 34412.1 33954.6
[10,]36.369.892.052.057.364.9

Also, is it possible to get the order in which the rows will be clustered ,
starting with the first rows joined into a group and then followed by other
grps added. I thought i could extract the order by using $rowInd, but looks
like it's the order in which the rows are reordered in the map. Please let
me know how to do this.

Thanks,
Vasu.

[[alternative HTML version deleted]]

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


[R] how to clear the last error?

2006-02-09 Thread Adrian Dragulescu

Hello,

I would like to clear the last error that I get with geterrmessage().  Not
even rm(list=ls()) clears it.  Can I set it to NULL somehow?

Thank you,
Adrian

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


[R] putting text in the corner

2006-02-09 Thread Thomas Steiner
I want to write some text in a corner of my plot.
Is it possible to get the xlim and ylim of an open window?
Or is there anything similar like
legend(x=bottomright, inset=0.01,legend=...)
for
text(x=1,y=2, test)

Thomas

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


[R] How to calculate the generalization error of random forests?

2006-02-09 Thread Martin Lam
Hi,

Perhaps this is not the proper place to ask this
question but I am out of options, therefore I
apologize in advance.

I want to know how the (upper bound?) generalization
error of the random forest is determined using the
out-of-bag estimate. I read in Breiman's paper that s
and p determine the generalization error:
p(1-s^2)/s^2.
Does s stands for the strength of the individual tree
or of the entire ensemble? p stands for the
correlation between the trees.

If I have, let's say, built 3 trees in my forest and I
know for each tree the instances that were left out
during training, how do I calculate s and p, so I can
calculate the error?

Thanks in advance,

Martin

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Marc Schwartz (via MN)
In follow up to Harold's thought of using LaTeX, I have an approach when
the use of nicely formatted tables is required in a document where LaTeX
is not being used for the entire document. In other words, where you
need to use Word, OO.org's Writer or similar application for the
majority of the document body.

This involves outputting R results to LaTeX table code in a text file,
processing the file with 'latex' and 'dvips' and creating an EPS file.
Of course, the LaTeX text file is fully complete with preamble, etc.

One can then import the EPS file to a page in the document processor
file. The most recent versions of the aforementioned applications will
generate a bitmapped preview of the table content to aid in placement
and review.

You can then print the document to a PS printer or file for subsequent
use. OO.org's Writer can also use Ghostscript to print to a PDF file
using a PDF Converter in the printer selection dialog. This,
importantly, is different than the Export to PDF function. The latter
does not properly print embedded EPS images and prints the bitmapped
preview instead.

The advantage of this approach is that you don't have to mess around in
the word processing program doing a 'text to table' conversion and then
go through the formatting of the resultant columns, borders, etc.

HTH,

Marc Schwartz

On Thu, 2006-02-09 at 09:47 -0500, Doran, Harold wrote:
 Well, I don't know if it can be used with Word or not, but you might
 consider Sweave for use with LaTeX. Maybe if you use the sink() command
 this might work, but I haven't tried it. 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Tom Backer
 Johnsen
 Sent: Thursday, February 09, 2006 9:41 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Tranferring R results to word prosessors
 
 I have just started looking at R, and are getting more and more
 irritated at myself for not having done that before.
 
 However, one of the things I have not found in the documentation is some
 way of preparing output from R for convenient formatting into something
 like MS Word.  An example:  If you use summary(lm()) you get nice
 output.  However, if you try to paste that output into the word
 processor, all the text elements are separated by blanks, and that is
 not optimal for the creation of a table (in the word processing sense).
 
 Is there an option to generate tab-separated output in R ? That would
 solve the problem.
 
 Tom

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


Re: [R] prehistoric versions of R -- 1995!

2006-02-09 Thread Martin Maechler
 FrPi == François Pinard [EMAIL PROTECTED]
 on Tue, 7 Feb 2006 08:43:28 -0500 writes:

FrPi [Martin Maechler]
 2) The oldest stuff that I have is all from 1995;

FrPi Mailing lists seem to go back into 1995 too.  I found a few messages 
FrPi from around 1994 on topics to be later found within R, but I'm not 
sure 
FrPi where I got these old messages from.  I did find a message really 
FrPi related to R-pre-alpha, which itself quotes a message written in 1994.

Hmm, I am interested to find these.

I am pretty sure the first R list was the one Ross and Robert
initiated with the following e-mail (the date of which also
points to that 10th anniversary date coming Sunday!):

   From: R Home [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: R Code Alpha Test
   Date: Mon, 12 Feb 1996 16:15:53 +1300
   
   At some point in the past you have provided comments on R which
   indicated that you would make a useful alpha-tester for the version
   we plan to release to statlib.
   
   We have put your name on a mailing list
   
  [EMAIL PROTECTED]
   
   which we will use for discussion of problems and for distributing
   bug-fixes and patches.  We intend that that the list will only
   function for a short testing period.  Assuming that the testing
   isn't too much of a disaster, we will set up a real discussion
   mailing list.
   
   If you don't wish to take part in the testing cycle and would like to
   be taken off the list please send some mail to [EMAIL PROTECTED].
   If you have suggestions for other who could take part in testing let
   us know too.
   
   There are a number of types of input we are interested in.
   
  1) PORTABILITY
  We are interested in seeing R ported to as many Unix
  platforms as possible.  We are interested in hearing about
  portability and any fixes neccessary to get R running on
  platforms other than those we have available  (SunOS,
  Solaris, FreeBSD, Linux, HP, SGI Irix).
   
  2) DIFFERENCES
  We would like feedback on differences between R and S.  We
  have made the decision to make R as compatible with S as
  possible, but have not had the chance to systematically
  look for differences.
   
  3) BUGS
  We want to know about the bugs which are present in R.
   
  4) EXTENSIONS
  What should we do next?
   
   The source code is now available by anonymous ftp from
   
  stat3.stat.auckland.ac.nz
   
   (note that this is not the usual place).
   
  Ross Ihaka + Robert Gentleman
  

BTW, note the many (Unixy) platforms mentioned on which R was
running even then.

Definitely older than the above are private e-mails between
Ross, Robert and various people, but these were private.

An interesting one would be the first announcement of R on the
S-news mailing list which I think *was* in 1994 (as you indicate
above). Unfortunately the archives of S-news currently only go
back to 1998.

Also, further, to what I said previously on this thread,
I have a nice paperback book Data Analysis - An Introduction
base on R written by Alan Lee, Dept. Statistics, Auckland
labeled as Course Notes of University of Auckland Papers 528.218/288
(a kind of lecture notes) which I received as gift from Ross and
Robert at the Heidelberg workshop, March 25, 1995.
The book has a Copyright © 1994.  
That seems high evidence for R to have been in use at U. of
Auckland in 1994.

Now if we heard even more history of R  (with dates!)
from Ross / Robert / Alan Lee ?

Regards, 
Martin Maechler, ETH Zurich

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


[R] effect sizes in lme/ multi-level models

2006-02-09 Thread Leo Gürtler
Dear alltogether,

I am searching for a way to determine effect size in multi-level 
models by using lme().
Coming from Psychology, for ordinary OLS there are measures (for 
meta-analysis, etc.) like

CohensD - (mean_EG - mean_CG) / SD_pooled

or

(p)eta^2 - SS_effect / (SS_effect + SS_error)

I do not intend to lead a discussion of the usefulness of such measures 
as long as the standards of psychological journals (e.g. as defined by 
the APA) order them.
However, I wondered how to determine measures of effect size in lme. 
PinheiroBates (2000) do not touch that topic.
I assume that as long as a grouping structure is present, the formular 
of CohensD (see above) has to be corrected to give respect to the 
grouping structure. Is there any equivalent measure like eta^2, 
partial-eta^2, etc.?

Can anybody help me with formulas, R code or some references?

Thank you very much,

thanks in advance,

leo gürtler

-- 

email: [EMAIL PROTECTED]
www: http://www.anicca-vijja.de/

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


[R] nice log-log plots

2006-02-09 Thread Alexandru Codilean
Dear All,

I am trying to produce log-log plots in R and I was wondering if any of you 
have a 'template' for generating these with 'nice' labels and log-log grids?

I know I can set up axes individually and use the intervals I want, however, I 
will be producing a large number of these plots and would not like to do this 
manually for each of them + I am very new to R and at the moment do not have 
much time that I could spend figuring this out by myself.

Any help would be greatly appreciated!
Thanks
Tibi


Alexandru Tiberiu CODILEAN
PhD Candidate
Departmental IT Committee PG Rep.

Department of Geographical and Earth Sciences 
East Quadrangle, Room 309 
University Avenue 
University of Glasgow 
Glasgow G12 8QQ UK 

Tel: +44 (0) 141 330 4872 ext. 0935 
Fax: +44 (0) 141 330 4894
Email: [EMAIL PROTECTED]

Home: http://web.ges.gla.ac.uk/~tcodilean/
GRASS Mirror: http://pc188.geog.gla.ac.uk/grass/

A gleekzorp without a tornpee is like a quop without a fertsneet (sort of)

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


Re: [R] Fixing AR coefficients in VAR model

2006-02-09 Thread Spencer Graves
  I know of no existing functions in R that support fitting a 
multivariate autoregression while fixing some of the parameters.

  Of course, as Simon Blomberg famously said in April 2005, This is R. 
There is no if. Only how.  [With library(fortunes), try 'fortune(This 
is R)'.]  If I had to do fit a multivariate AR today with some 
parameters fixed, I might write a function to compute the determinant of 
the sample covariance matrix, and give it to optim or nlminb.

  I hope someone else will provide us with an easier way.

  hope this helps,
  spencer graves

Daniel Medina wrote:

 Dear Colleague,
 
 I would like to set a few AR coefficients (not order) to zero in the
 multivariate AR function (mAr.est; mAr library); however, the manual for
 this function does not provide this information. I would appreciate any
 suggestions along this line.
 
 Thankfully yours,
 
 Daniel C Medina
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread roger bos
Yeah, but I don't understand LaTeX at all.  Can you point me to a good
beginners guide?

Thanks,

Roger


On 2/9/06, Barry Rowlingson [EMAIL PROTECTED] wrote:

 Tom Backer Johnsen wrote:
  I have just started looking at R, and are getting more and more
 irritated
  at myself for not having done that before.
 
  However, one of the things I have not found in the documentation is some
  way of preparing output from R for convenient formatting into something
  like MS Word.

 Well whatever you do, don't start looking at LaTeX, because that will
 get you even more irritated at yourself for not having done it before.

 LaTeX is to Word as R is to what? SPSS?

 I've still not seen a pretty piece of mathematics - or even text - in
 Word.

 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


[[alternative HTML version deleted]]

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Francisco J. Zagmutt
Take a look at the facilities to write HTML output in library(R2HTML).  If 
you write an HTML file, you can then easily copy and paste it into your Word 
document, or from MS Word you can use the Insert menu. i.e.

library(R2HTML)
x=ftable(Titanic, row.vars = 1:3)
HTML(x,Titanic.html)

Then from MS Word use Insert- File and select Titanic.html and see the 
results.

I hope this helps

Francisco



From: Tom Backer Johnsen [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] Tranferring R results to word prosessors
Date: Thu, 09 Feb 2006 15:41:09 +0100

I have just started looking at R, and are getting more and more irritated
at myself for not having done that before.

However, one of the things I have not found in the documentation is some
way of preparing output from R for convenient formatting into something
like MS Word.  An example:  If you use summary(lm()) you get nice
output.  However, if you try to paste that output into the word processor,
all the text elements are separated by blanks, and that is not optimal for
the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would solve
the problem.

Tom

++
| Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
| Tel : +47-5558-9185Fax : +47-5558-9879 |
| Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
++

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

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


Re: [R] putting text in the corner

2006-02-09 Thread Marc Schwartz (via MN)
On Thu, 2006-02-09 at 17:18 +0100, Thomas Steiner wrote:
 I want to write some text in a corner of my plot.
 Is it possible to get the xlim and ylim of an open window?
 Or is there anything similar like
 legend(x=bottomright, inset=0.01,legend=...)
 for
 text(x=1,y=2, test)
 
 Thomas


Try this:

 plot(1:10)

 # par(usr) defines the x/y coordinates of the plot region
 usr - par(usr)

 # Upper Left Hand Corner
 text(usr[1], usr[4], test, adj = c(0, 1))

 # Lower Left Hand Corner
 text(usr[1], usr[3], test, adj = c(0, 0))

 # Lower Right Hand Corner
 text(usr[2], usr[3], test, adj = c(1, 0))

 # Upper Right Hand Corner
 text(usr[2], usr[4], test, adj = c(1, 1))



See ?par and ?text for more information including the 'adj' argument to
text().

HTH,

Marc Schwartz

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


[R] make: Target `all' not remade because of errors.

2006-02-09 Thread J Cad

Hi:   I don't know if it is a bug or what?
I followed instructions.  
Jean

R version: R-2.2.1
OS:   Linux RedHat 9




I followed the instructions. tar -xvf, configure, then make.
I get these error messages at the end of make and with make check.  
==
==
In file included from rbitmap.c:45:
/usr/include/png.h:318:18: zlib.h: No such file or directory
In file included from /usr/include/png.h:321,
 from rbitmap.c:45:
/usr/include/pngconf.h:1091: error: parse error before '*' token
/usr/include/pngconf.h:1092: error: parse error before '*' token
/usr/include/pngconf.h:1093: error: parse error before '*' token
In file included from rbitmap.c:45:
/usr/include/png.h:1034: error: parse error before z_stream
/usr/include/png.h:1262: error: parse error before '}' token
/usr/include/png.h:1821: error: parse error before png_zalloc
/usr/include/png.h:1821: error: parse error before png_ptr
/usr/include/png.h:1825: error: parse error before png_ptr
rbitmap.c: In function `my_png_error':
rbitmap.c:72: error: dereferencing pointer to incomplete type
rbitmap.c: In function `R_SaveAsPng':
rbitmap.c:121: error: dereferencing pointer to incomplete type
make[4]: *** [rbitmap.lo] Error 1
make[4]: Target `R_X11.so' not remade because of errors.
make[4]: Leaving directory `/users/cadet/R-2.2.1/src/modules/X11'
make[3]: *** [R] Error 2
make[3]: Leaving directory `/users/cadet/R-2.2.1/src/modules/X11'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/users/cadet/R-2.2.1/src/modules'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/users/cadet/R-2.2.1/src'
make: *** [R] Error 1
make: Target `all' not remade because of errors.
giant {122} make check
make[1]: Entering directory `/users/cadet/R-2.2.1/tests'
make[2]: Entering directory `/users/cadet/R-2.2.1/tests'
make[3]: Entering directory `/users/cadet/R-2.2.1/tests/Examples'
make[4]: Entering directory `/users/cadet/R-2.2.1/tests/Examples'
make[4]: `Makedeps' is up to date.
make[4]: Leaving directory `/users/cadet/R-2.2.1/tests/Examples'
make[4]: Entering directory `/users/cadet/R-2.2.1/tests/Examples'
make[4]: *** No rule to make target `../../src/library/base/all.R', needed 
by `base-Ex.Rout'.  Stop.
make[4]: Leaving directory `/users/cadet/R-2.2.1/tests/Examples'
make[3]: *** [test-Examples-Base] Error 2
make[3]: Leaving directory `/users/cadet/R-2.2.1/tests/Examples'
make[2]: *** [test-Examples] Error 2
make[2]: Leaving directory `/users/cadet/R-2.2.1/tests'
make[1]: *** [test-all-basics] Error 1
make[1]: Leaving directory `/users/cadet/R-2.2.1/tests'
make: *** [check] Error 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


[R] glmm.admb - bug and possible solution??

2006-02-09 Thread Robert Bagchi
Dear Dr Skaug  and R users,

just discovered glmm.admb in R, and it seems a very useful tool. 
However, I ran into a problem when I compare two models:

m1-glmm.admb(survival~light*species*damage, random=~1, group=table, 
data=bm, family=binomial, link=logit)

m1.1-glmm.admb(survival~(light+species+damage)^2, random=~1, 
group=table, data=bm, family=binomial, link=logit)

anova(m1, m1.1)

I get the following output with the warning

Analysis of Variance Table

Model 1: survival ~ light * species * damage
Model 2: survival ~ (light + damage + species)^2
NoPar LogLik Df -2logQ P.value
1 9.000 -103.307
2 9.000 -103.781 0 -0.948
Warning message:
NaNs produced in: pchisq(q, df, lower.tail, log.p)

The warning is generated because the df=0. This appears to be because 
the number of parameters is being incorrectly calculated (they should be 
9 and 8 respectively). I had a look at the function call in R, and the 
problem appears to be because npar is obtained from the file nbmm.par on 
line 140 of the function

out$npar - as.numeric(scan(nbmm.par, what = , quiet = TRUE)[6])

which doesn't appear to change between calculations (the file seems to 
hvae been created the first time I ran glmm.admb, and not to have been 
modified since).

Replacing this line with the following
out$npar-p+m
seemed to work ok. Is this a legitimate solution?

I noticed that this isn't necessary for when I run the example for 
anova.glmm.admb (although this uses a different family). This seems to 
overwrite the nbmm.par file. Couldn't work out where this happens 
though, and take it that this occurs during the call to the ADMB 
program.  Any thoughts?

Many thanks
Robert

Below is the version information for R

platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 2.0
year 2005
month 10
day 06
svn rev 35749
language R


ADMB version
Package: glmmADMB
Version: 0.2
License: GPL
Packaged: Thu Dec 1 07:02:40 2005; andersn
Built: R 2.2.0; ; 2005-12-01 07:13:48; unix

-- 
Robert Bagchi
Animal  Plant Science
Alfred Denny Building
University of Sheffield
Western Bank
Sheffield S10 2TN
UK

t: +44 (0)114 2220062
e: [EMAIL PROTECTED]
   [EMAIL PROTECTED]

http://www.shef.ac.uk/aps/apsrtp/bagchi-r

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


Re: [R] putting text in the corner

2006-02-09 Thread Fernando Mayer
You can get the x and y position of any place of an open graphic device 
with the mouse cursor, using the function locator(), and even assing 
this values to an object, as in:

xy-locator()

You will have a list with x and y positions. Then you can use:

text(xy$x,xy$y,...)

See ?locator.

HTH,
Fernando Mayer.

Thomas Steiner escreveu:

I want to write some text in a corner of my plot.
Is it possible to get the xlim and ylim of an open window?
Or is there anything similar like
legend(x=bottomright, inset=0.01,legend=...)
for
text(x=1,y=2, test)

Thomas

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

  


[[alternative HTML version deleted]]

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Frank E Harrell Jr
Marc Schwartz (via MN) wrote:
 In follow up to Harold's thought of using LaTeX, I have an approach when
 the use of nicely formatted tables is required in a document where LaTeX
 is not being used for the entire document. In other words, where you
 need to use Word, OO.org's Writer or similar application for the
 majority of the document body.
 
 This involves outputting R results to LaTeX table code in a text file,
 processing the file with 'latex' and 'dvips' and creating an EPS file.
 Of course, the LaTeX text file is fully complete with preamble, etc.
 
 One can then import the EPS file to a page in the document processor
 file. The most recent versions of the aforementioned applications will
 generate a bitmapped preview of the table content to aid in placement
 and review.
 
 You can then print the document to a PS printer or file for subsequent
 use. OO.org's Writer can also use Ghostscript to print to a PDF file
 using a PDF Converter in the printer selection dialog. This,
 importantly, is different than the Export to PDF function. The latter
 does not properly print embedded EPS images and prints the bitmapped
 preview instead.
 
 The advantage of this approach is that you don't have to mess around in
 the word processing program doing a 'text to table' conversion and then
 go through the formatting of the resultant columns, borders, etc.
 
 HTH,
 
 Marc Schwartz

In addition to Marc's nice idea, I have had luck with Linux programs 
latex2rtf (.tex to .rtf) and hevea (.tex to .html).  Most often I use 
hevea and let Word users quickly convert from .html to .doc.  Of course 
doing everything in LaTeX is far better, using either Sweave or 
http://biostat.mc.vanderbilt.edu/StatReport .  Personal productivity 
with LaTeX is amazingly greater than with Word.

Frank

 
 On Thu, 2006-02-09 at 09:47 -0500, Doran, Harold wrote:
 
Well, I don't know if it can be used with Word or not, but you might
consider Sweave for use with LaTeX. Maybe if you use the sink() command
this might work, but I haven't tried it. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom Backer
Johnsen
Sent: Thursday, February 09, 2006 9:41 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Tranferring R results to word prosessors

I have just started looking at R, and are getting more and more
irritated at myself for not having done that before.

However, one of the things I have not found in the documentation is some
way of preparing output from R for convenient formatting into something
like MS Word.  An example:  If you use summary(lm()) you get nice
output.  However, if you try to paste that output into the word
processor, all the text elements are separated by blanks, and that is
not optimal for the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would
solve the problem.

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


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

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


[R] main parameter in plot.default vs plot.formula

2006-02-09 Thread Berton Gunter

Folks:

R 2.2.0 on Windows.

I find the following somewhat puzzling:

 a-1; x-0:1; y-x

## following works fine:
 plot(x,y ,main= bquote(n[1] == .(a) ))

## following produces an error:
 plot(y~x ,main= bquote(n[1] == .(a) ))
Error in paste(n[1] == 1,  and , n[2] == 2) : object n not found

***

Note 1: I assume that this is due to the following documented behavior of
plot.formula():

Both the terms in the formula and the ... arguments are evaluated in data
enclosed in parent.frame() if data is a list or a data frame.

Nevertheless, the behavior seems inconsistent to me. Am I missing something
(including the I assume ... comment)?

Note 2: If one uses substitute() instead, it works fine:

plot(y~x ,main= substitute(bquote(n[1] == a),list(a=a)))


Any illumination, public or private, would be appreciated.

Cheers,
Bert

 
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box

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


[R] minimum adequate model using contrasts

2006-02-09 Thread Nair, Murlidharan T
I am trying to model a set of data that I am working on using contrasts.
Since the data set is too large, I am interested in scripting the entire
process to arrive at the minimum adequate model. Has anyone in the group
done this before? If you I would appreciate their comments. 
Cheers ../Murli

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


Re: [R] how to clear the last error?

2006-02-09 Thread Duncan Murdoch
On 2/9/2006 11:11 AM, Adrian Dragulescu wrote:
 Hello,
 
 I would like to clear the last error that I get with geterrmessage().  Not
 even rm(list=ls()) clears it.  Can I set it to NULL somehow?

Not from R, but there is a C-level way to do it in src/main/errors.c. 
It's marked as temporary, but it's been there since R 1.3.x.

The declaration is

void R_SetErrmessage(char *s);

Alternatively, you could just cover up the last error with a new one by 
calling stop, e.g.

  try(stop(),TRUE)
  geterrmessage()
[1] Error in try(stop(\\), TRUE) : \n

Duncan Murdoch

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


Re: [R] putting text in the corner

2006-02-09 Thread Duncan Murdoch
On 2/9/2006 11:18 AM, Thomas Steiner wrote:
 I want to write some text in a corner of my plot.
 Is it possible to get the xlim and ylim of an open window?
 Or is there anything similar like
 legend(x=bottomright, inset=0.01,legend=...)
 for
 text(x=1,y=2, test)

par(usr)

gives you the limits.

Duncan Murdoch

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


Re: [R] putting text in the corner

2006-02-09 Thread Prof Brian Ripley
?par, look at usr  (which is how legend does it)

On Thu, 9 Feb 2006, Thomas Steiner wrote:

 I want to write some text in a corner of my plot.
 Is it possible to get the xlim and ylim of an open window?
 Or is there anything similar like
 legend(x=bottomright, inset=0.01,legend=...)
 for
 text(x=1,y=2, test)

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

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


[R] minimal adequate model

2006-02-09 Thread Nair, Murlidharan T
I am trying to model a set of data that I am working on using contrasts.
Since the data set is too large, I am interested in scripting the entire
process to arrive at the minimum adequate model. Has anyone in the group
done this before? If you I would appreciate their comments. 

Cheers ../Murli

 

 

 


[[alternative HTML version deleted]]

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Marc Schwartz (via MN)
There is some documentation online at:

http://www.latex-project.org/guides/

which would be a good starting place.

If you prefer a good book, The LaTeX Companion (aka TLC) is the place to
begin:

http://www.amazon.com/gp/product/0201362996


There is also a boxed set (expensive) of several books (including TLC)
available:

http://www.amazon.com/gp/product/0321269446


Finally, for dealing with EPS (or PDF) graphics (ie. R plots), the
online document Using Imported Graphics in LaTeX and pdfLaTeX is
excellent:

http://www.ctan.org/tex-archive/info/epslatex.pdf


HTH,

Marc Schwartz

On Thu, 2006-02-09 at 12:33 -0500, roger bos wrote:
 Yeah, but I don't understand LaTeX at all.  Can you point me to a good
 beginners guide?
 
 Thanks,
 
 Roger
 
 
 On 2/9/06, Barry Rowlingson [EMAIL PROTECTED] wrote:
 
  Tom Backer Johnsen wrote:
   I have just started looking at R, and are getting more and more
  irritated
   at myself for not having done that before.
  
   However, one of the things I have not found in the documentation is some
   way of preparing output from R for convenient formatting into something
   like MS Word.
 
  Well whatever you do, don't start looking at LaTeX, because that will
  get you even more irritated at yourself for not having done it before.
 
  LaTeX is to Word as R is to what? SPSS?
 
  I've still not seen a pretty piece of mathematics - or even text - in
  Word.
 
  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


[R] Shapefiles

2006-02-09 Thread Tarmo Remmel
Dear List,

I have examined the sp, maptools, and shapefiles packages (Windows) but
cannot seem to figure out a solution for writing shapefiles for 'curvy
shapes'.  The scenario is that I generate a series of polygons, circles, and
ellipses on a plot and would like to convert them to shapefiles.  Since the
circles and ellipses are do not return a coordinate list during the plotting
sequence (e.g., all I need supply are the lengths of axes and rotation
angle), is there an easy way by which the plot window can be converted to a
shapefile?

Thank you,

Tarmo

__
Tarmo Remmel  Ph.D.
GUESS Lab, Department of Geography
University of Toronto at Mississauga
Mississauga, Ontario, L5L 1C6
Tel: 905-569-4382
Lab: 905-828-3868
Fax: 905-828-5273
Skype: tarmoremmel
http://eratos.erin.utoronto.ca/remmelt

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


[R] New user: Custom probability distribution

2006-02-09 Thread Jan Danielsson
Hello,

   Given a probability function: p(x) = 12 / (25(x+1)) , x=0, 1, 2, 3 we
generate the following values:

  C1  C2
  0   0.48
  1   0.24
  2   0.16
  3   0.12

   Now, I'm supposed to create 50 random values using this table. In
MiniTab, I simply selected Calc - Random Data - Discrete, and selected
the columns, and it created 50 random values in a new column.[1]

How do I do the same thing in R?

   [1] You may be wondering why I'm telling you this. Well, it's because
if I were in your shoes, I'd think Oh, someone wants me to solve his
homework.. I have already solved it using MiniTab, but I want to be
able to use R instead (since I prefer NetBSD).

-- 
Kind Regards,
Jan Danielsson
Te audire non possum. Musa sapientum fixa est in aure.



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

[R] New psi with rlm

2006-02-09 Thread Angelo Secchi

Hi,
How can I define a new psi function in the rlm comand?
In particular  I would like to implement the case for

\rho(u)=0.5*(u^2) and \psi(u)=u

in order to assume normally distributed errors.
Any help?
Thanks




-- 

 Angelo Secchi PGP Key ID:EA280337

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Patrick Burns
One approach is to use LyX (http://www.lyx.org/).
This is a lot like using Word or other word processors
but it creates LaTeX.  You probably won't need to
know anything about TeX for a long time unless you
are doing really weird things.

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)

roger bos wrote:

Yeah, but I don't understand LaTeX at all.  Can you point me to a good
beginners guide?

Thanks,

Roger


On 2/9/06, Barry Rowlingson [EMAIL PROTECTED] wrote:
  

Tom Backer Johnsen wrote:


I have just started looking at R, and are getting more and more
  

irritated


at myself for not having done that before.

However, one of the things I have not found in the documentation is some
way of preparing output from R for convenient formatting into something
like MS Word.
  

Well whatever you do, don't start looking at LaTeX, because that will
get you even more irritated at yourself for not having done it before.

LaTeX is to Word as R is to what? SPSS?

I've still not seen a pretty piece of mathematics - or even text - in
Word.

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




   [[alternative HTML version deleted]]

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



  


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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Peter Flom
 roger bos [EMAIL PROTECTED] 2/9/2006 12:33 pm  wrote

Yeah, but I don't understand LaTeX at all.  Can you point me to a good
beginners guide?


I like Math into LaTeX, by Gratzer.  
For a real beginners guide, there's one called first steps in LaTeX.
You might also want to look at issues of the PracTEX journal, many of which are 
for beginners (It's an online journal)

Peter

Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
http://cduhr.ndri.org
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)

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


Re: [R] iteration history

2006-02-09 Thread justin bem
Hi Bob !

It possible See the first element of controle argument
set it to a positive integer ! 



--- Robert Mcfadden [EMAIL PROTECTED] a écrit :

 Dear R Users
 I would like to use optim function to optimize a
 function. I read help but I
 couldn't find what I need: is it possible to get
 information after each
 iteration, for example as there is in MATLAB:
 
Gradient's 
  Iteration  Func-count   f(x)Step-size  
infinity-norm
  0  24  388.976 
   14
  1  72   385.67  0.0292637  
 16.8  
  2  96   383.54  1  
 4.15  
  3 120  383.412  1  
0.108  
  4 144  383.412  1  
0.002  
  5 168  383.412  1  
  0.00149  
  6 192  383.412  1  
6.23e-005  
  7 216  383.412  1  
1.01e-005  

 
 It is useful when iteration takes long time - I know
 what's happen
 I would appreciate any suggestion
 
 Robert
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


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


[R] R2WinBUGS - formating data for winbugs

2006-02-09 Thread Chris Behr
I am currently running analyses in winbugs with two different formats of
data: matrix and list. The data in the list have different dimensions than
the matrix. Do I need to create a single format for entry into R which R
passes to WinBUGS?

Thanks, Chris

Christopher Behr
Principal Analyst

eDesign Dynamics
www.edesigndynamics.com

4024 Calvert St. NW
Washington DC 20007
(202) 298-6437 (t/f)
(551) 998-4823 (c)

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


Re: [R] problem with simple if() statement

2006-02-09 Thread justin bem
Hi Norman !
 
I observe that R syntax is very close to C/C++ or Java

--- Philippe Grosjean [EMAIL PROTECTED] a
écrit :

 Norman Goodacre wrote:
  the following code apprantely, for some grand old
 reason, induces a syntax error:

if (seq[i] = A) m - trans[1,]

where seq is a vector and trans is a matrix. I
 cannot for the life of me see why this is wrong.
 Syntax error is: 

Error: syntax error in if (seq[i] =

Sincerely,

Norman Goodacre
 
 Please, read An Introduction to R provided with
 any version of R. The 
 correct syntax for an equality condition is ==,
 not =, so:
 
   if (seq[i] == A) 
 
 Best,
 
 Philippe Grosjean
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


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


Re: [R] Fixing AR coefficients in VAR model

2006-02-09 Thread Paul Gilbert
You can do this with dse. See

   require(dse1)
  ?fixConstants

Paul Gilbert

Spencer Graves wrote:

 I know of no existing functions in R that support fitting a 
multivariate autoregression while fixing some of the parameters.

 Of course, as Simon Blomberg famously said in April 2005, This is R. 
There is no if. Only how.  [With library(fortunes), try 'fortune(This 
is R)'.]  If I had to do fit a multivariate AR today with some 
parameters fixed, I might write a function to compute the determinant of 
the sample covariance matrix, and give it to optim or nlminb.

 I hope someone else will provide us with an easier way.

 hope this helps,
 spencer graves

Daniel Medina wrote:

  

Dear Colleague,

I would like to set a few AR coefficients (not order) to zero in the
multivariate AR function (mAr.est; mAr library); however, the manual for
this function does not provide this information. I would appreciate any
suggestions along this line.

Thankfully yours,

Daniel C Medina

  [[alternative HTML version deleted]]

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



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



La version française suit le texte anglais.



This email message from the Bank of Canada is given in good faith, and shall 
not be
binding or construed as constituting any obligation on the part of the Bank.

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


[R] Plotting 27 line plots in one page

2006-02-09 Thread Srinivas Iyyer
Dear group, 
 I am a novice programmer in R.  I have a list that
has a length of 27 elements. Each element is derived
from table function. 

lls - table(drres)

legnth(lls)
27

I want to plot all these elements in 9x3 plot (9 rows
and 3 columns)
par(9,3)
 mypltfunc - function(mydata){
+ for (i in 1:27){
+ plot(unlist(mydata[i]))
+ }
+ }

 mypltfunc(lls)
 

In the graphics window, all 27 figures are drawn in
fraction of sec, one by one and I get to see the last
graph.  It is not drawing into this 9X3 grid. 

Could any one help me please. 

Thanks
sri

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


[R] converting lat-long coordinates to Albers Conical Equal Area coordinates

2006-02-09 Thread jatwood

We have used maptools to construct state, county, township, census-tract, 
and zipcode
level R maps with an Albers Conical Equal Area projection.  We would like 
to be able to
plot the location of weather stations or other point locations on the 
maps.  The data
the point locations are in latitude-longitude units and we must convert the 
coordinates
to the Albers Conical Equal Area coordinates.

However, as of yet, we have not been able to obtain satisfactory results 
using mapproj.
Given the specs below can someone please tell us how to use mapproj (or 
some other R
library) to convert lat-long coordinates into the appropriate Albers 
Conical Equal Area
coordinates?

Thanks in advance
Joe Atwood
Montana State University
[EMAIL PROTECTED]


The material at the bottom of this message is the metadata from
the shapefile we are using (as created in Arc-GIS).


---
Horizontal coordinate system
Projected coordinate system name: NAD_1927_Albers
Geographic coordinate system name: GCS_North_American_1927
Details
Map Projection Name: Albers Conical Equal Area
Standard Parallel: 29.50
Standard Parallel: 45.50
Longitude of Central Meridian: -96.00
Latitude of Projection Origin: 23.00
False Easting: 0.00
False Northing: 0.00


Planar Coordinate Information
Planar Distance Units: meters
Coordinate Encoding Method: coordinate pair
Coordinate Representation
Abscissa Resolution: 0.008192
Ordinate Resolution: 0.008192


Geodetic Model
Horizontal Datum Name: North American Datum of 1927
Ellipsoid Name: Clarke 1866
Semi-major Axis: 6378206.40
Denominator of Flattening Ratio: 294.978698
_

Bounding coordinates
Horizontal
In decimal degrees
West: -127.889829
East: -65.349890
North: 51.606167
South: 22.862978
In projected or local coordinates
Left: -2356341.706499
Right: 2257925.009693
Top: 3172647.320063
Bottom: 268329.067476

###

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


Re: [R] main parameter in plot.default vs plot.formula

2006-02-09 Thread Gabor Grothendieck
I cannot explain it but I must have come across it since
I noticed in various places in some of my code I have
used, in terms of your example, the following:

plot(y ~ x, main = as.expression(bquote(m[1] == .(a

plot(y ~ x, main = list(bquote(m[1] == .(a

both of which work as expected.

On 2/9/06, Berton Gunter [EMAIL PROTECTED] wrote:

 Folks:

 R 2.2.0 on Windows.

 I find the following somewhat puzzling:

  a-1; x-0:1; y-x

 ## following works fine:
  plot(x,y ,main= bquote(n[1] == .(a) ))

 ## following produces an error:
  plot(y~x ,main= bquote(n[1] == .(a) ))
 Error in paste(n[1] == 1,  and , n[2] == 2) : object n not found

 ***

 Note 1: I assume that this is due to the following documented behavior of
 plot.formula():

 Both the terms in the formula and the ... arguments are evaluated in data
 enclosed in parent.frame() if data is a list or a data frame.

 Nevertheless, the behavior seems inconsistent to me. Am I missing something
 (including the I assume ... comment)?

 Note 2: If one uses substitute() instead, it works fine:

 plot(y~x ,main= substitute(bquote(n[1] == a),list(a=a)))


 Any illumination, public or private, would be appreciated.

 Cheers,
 Bert


 -- Bert Gunter
 Genentech Non-Clinical Statistics
 South San Francisco, CA

 The business of the statistician is to catalyze the scientific learning
 process.  - George E. P. Box

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


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


Re: [R] Fixing AR coefficients in VAR model

2006-02-09 Thread Spencer Graves
Hi, Paul:

  Thanks very much.  I'd forgotten that.

  Moreover, you provide very nice vignettes.

Daniel C Medina:  If you are not familiar with vignettes, you may wish 
to review http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67006.html; 
in addition to the vignette help page.

  Best Wishes,
  spencer graves

Paul Gilbert wrote:

 You can do this with dse. See
 
   require(dse1)
  ?fixConstants
 
 Paul Gilbert
 
 Spencer Graves wrote:
 
   I know of no existing functions in R that support fitting a 
 multivariate autoregression while fixing some of the parameters.

   Of course, as Simon Blomberg famously said in April 2005, This 
 is R. There is no if. Only how.  [With library(fortunes), try 
 'fortune(This is R)'.]  If I had to do fit a multivariate AR today 
 with some parameters fixed, I might write a function to compute the 
 determinant of the sample covariance matrix, and give it to optim or 
 nlminb.

   I hope someone else will provide us with an easier way.

   hope this helps,
   spencer graves

 Daniel Medina wrote:

  

 Dear Colleague,

 I would like to set a few AR coefficients (not order) to zero in the
 multivariate AR function (mAr.est; mAr library); however, the manual for
 this function does not provide this information. I would appreciate any
 suggestions along this line.

 Thankfully yours,

 Daniel C Medina

 [[alternative HTML version deleted]]

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


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

 
  
 
 
 La version française suit le texte anglais.
 
 
  
 
 
 This email message from the Bank of Canada is given in good faith, and 
 shall not be
 binding or construed as constituting any obligation on the part of the 
 Bank.
 
 This email may contain privileged and/or confidential information, and 
 the Bank of
 Canada does not waive any related rights. Any distribution, use, or 
 copying of this
 email or the information it contains by other than the intended 
 recipient is
 unauthorized. If you received this email in error please delete it 
 immediately from
 your system and notify the sender promptly by email that you have done so.
 Recipients are advised to apply their own virus checks to this message 
 upon receipt.
 
 
  
 
 
 L'information communiquée dans les courriels en provenance de la Banque 
 du Canada
 est soumise de bonne foi, mais elle ne saurait lier la Banque et ne doit 
 aucunement
 être interprétée comme constituant une obligation de sa part.
 
 Le présent courriel peut contenir de l'information privilégiée ou 
 confidentielle.
 La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute 
 diffusion,
 utilisation ou copie de ce courriel ou des renseignements qu'il contient 
 par une
 personne autre que le ou les destinataires désignés est interdite. Si 
 vous recevez
 ce courriel par erreur, veuillez le supprimer immédiatement et envoyer 
 sans délai à
 l'expéditeur un message électronique pour l'aviser que vous avez éliminé 
 de votre
 ordinateur toute copie du courriel reçu.
 
 Dès la réception du présent message, le ou les destinataires doivent 
 activer leur
 programme de détection de virus pour éviter toute contamination possible.


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


Re: [R] New user: Custom probability distribution

2006-02-09 Thread Duncan Murdoch
On 2/9/2006 2:02 PM, Jan Danielsson wrote:
 Hello,
 
Given a probability function: p(x) = 12 / (25(x+1)) , x=0, 1, 2, 3 we
 generate the following values:
 
   C1  C2
   0   0.48
   1   0.24
   2   0.16
   3   0.12
 
Now, I'm supposed to create 50 random values using this table. In
 MiniTab, I simply selected Calc - Random Data - Discrete, and selected
 the columns, and it created 50 random values in a new column.[1]
 
 How do I do the same thing in R?
 
[1] You may be wondering why I'm telling you this. Well, it's because
 if I were in your shoes, I'd think Oh, someone wants me to solve his
 homework.. I have already solved it using MiniTab, but I want to be
 able to use R instead (since I prefer NetBSD).

You want to use the sample() function.  See ?sample.

Duncan Murdoch

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


Re: [R] New user: Custom probability distribution

2006-02-09 Thread tom wright
rbinom(50,5,c(0.48,0.24,0.16,0.12))


On Thu, 2006-09-02 at 20:02 +0100, Jan Danielsson wrote:
 Hello,
 
Given a probability function: p(x) = 12 / (25(x+1)) , x=0, 1, 2, 3 we
 generate the following values:
 
   C1  C2
   0   0.48
   1   0.24
   2   0.16
   3   0.12
 
Now, I'm supposed to create 50 random values using this table. In
 MiniTab, I simply selected Calc - Random Data - Discrete, and selected
 the columns, and it created 50 random values in a new column.[1]
 
 How do I do the same thing in R?
 
[1] You may be wondering why I'm telling you this. Well, it's because
 if I were in your shoes, I'd think Oh, someone wants me to solve his
 homework.. I have already solved it using MiniTab, but I want to be
 able to use R instead (since I prefer NetBSD).
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] putting text in the corner

2006-02-09 Thread Gregory Snow

par('usr') will give you the coordinates of the corners of the current plot.  

If you want to go a little beyond this (more like your legend example) by 
specifying that you want your text to be some distance from the bottom and left 
of the plot and have the distance not affected by the scale of the data then 
you might want to look at the cnvrt.coords function in the TeachingDemos 
package.

-Original Message-
From: [EMAIL PROTECTED] on behalf of Thomas Steiner
Sent: Thu 2/9/2006 9:18 AM
To: r-help@stat.math.ethz.ch
Subject: [R] putting text in the corner
 
I want to write some text in a corner of my plot.
Is it possible to get the xlim and ylim of an open window?
Or is there anything similar like
legend(x=bottomright, inset=0.01,legend=...)
for
text(x=1,y=2, test)

Thomas

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


[[alternative HTML version deleted]]

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


Re: [R] Shapefiles

2006-02-09 Thread Roger Bivand
On Thu, 9 Feb 2006, Tarmo Remmel wrote:

 Dear List,
 
 I have examined the sp, maptools, and shapefiles packages (Windows) but
 cannot seem to figure out a solution for writing shapefiles for 'curvy
 shapes'.  The scenario is that I generate a series of polygons, circles, and
 ellipses on a plot and would like to convert them to shapefiles.  Since the
 circles and ellipses are do not return a coordinate list during the plotting
 sequence (e.g., all I need supply are the lengths of axes and rotation
 angle), is there an easy way by which the plot window can be converted to a
 shapefile?

No, the plot window is committed to the device, and (re)-capturing the 
objects there as polygon objects will be messy. You'll need to generate an 
object that can be drawn as a sequence of straight line segments, and 
create a polygon object from that, from the x,y coordinates of the centre 
and the radius, or major/minor axes lengths and orientations. There is 
some code on:

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

(see RSiteSearch(circle))

but I don't know if it will suit your purposes. Once constructed, the 
polygons can be built into an object for exporting.

 
 Thank you,
 
 Tarmo
 
 __
 Tarmo Remmel  Ph.D.
 GUESS Lab, Department of Geography
 University of Toronto at Mississauga
 Mississauga, Ontario, L5L 1C6
 Tel: 905-569-4382
 Lab: 905-828-3868
 Fax: 905-828-5273
 Skype: tarmoremmel
 http://eratos.erin.utoronto.ca/remmelt
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


Re: [R] putting text in the corner

2006-02-09 Thread Kjetil Brinchmann Halvorsen
Fernando Mayer wrote:
 You can get the x and y position of any place of an open graphic device 
 with the mouse cursor, using the function locator(), and even assing 
 this values to an object, as in:
 
 xy-locator()
 
 You will have a list with x and y positions. Then you can use:
 
 text(xy$x,xy$y,...)

or even
text(locator(), test, ...)

Kjetil


 
 See ?locator.
 
 HTH,
 Fernando Mayer.
 
 Thomas Steiner escreveu:
 
 I want to write some text in a corner of my plot.
 Is it possible to get the xlim and ylim of an open window?
 Or is there anything similar like
 legend(x=bottomright, inset=0.01,legend=...)
 for
 text(x=1,y=2, test)

 Thomas

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

  

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


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


Re: [R] New user: Custom probability distribution

2006-02-09 Thread Kjetil Brinchmann Halvorsen
Jan Danielsson wrote:
 Hello,
 
Given a probability function: p(x) = 12 / (25(x+1)) , x=0, 1, 2, 3 we
 generate the following values:
 
   C1  C2
   0   0.48
   1   0.24
   2   0.16
   3   0.12
 
Now, I'm supposed to create 50 random values using this table. In
 MiniTab, I simply selected Calc - Random Data - Discrete, and selected
 the columns, and it created 50 random values in a new column.[1]
 
 How do I do the same thing in R?

sample( 0:3, 50, prob=c(0.48, 0.24, 0.26, 0.12))

Kjetil

 
[1] You may be wondering why I'm telling you this. Well, it's because
 if I were in your shoes, I'd think Oh, someone wants me to solve his
 homework.. I have already solved it using MiniTab, but I want to be
 able to use R instead (since I prefer NetBSD).
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] problem to install R on linux

2006-02-09 Thread Frank Samuelson
For the rpm install you may also need to install a package called 
info-x.x.x.x-x.rpm.
For the compilation you'll need to be certain that you've installed
readline-x.x.x.x.x.rpm and and perhaps readline-devel-x.x.x.x.rpm
Those should be in your mandriva distn


André Beló wrote:
 Dear members,
 
 this can sound trivial for some people but I don't have experience on 
 compilation.
 
 I'm trying to install R-2.2.1 on a laptop running Mandriva 2006. I 
 already installed many of the recommended packages/libraries but it 
 seems that something is still missing. The problem is that I cannot 
 identify... Could somebody give me some advise?
 
 I put the output of the command ./configure bellow. When I tryed to 
 install the R-2.0.0-1mdk.i586.rpm I got:
 
 [EMAIL PROTECTED] Download]# rpm -i R-2.0.0-1mdk.i586.rpm
 warning: R-2.0.0-1mdk.i586.rpm: Header V3 DSA signature: NOKEY, key ID 
 6c60ceea
 error: Failed dependencies:
 info is needed by R-2.0.0-1mdk.i586
 [EMAIL PROTECTED] Download]#
 
 
 Thanks in advance,
 AB
 
 
 [EMAIL PROTECTED] R-2.2.1]# ./configure
 checking build system type... i686-pc-linux-gnu
 checking host system type... i686-pc-linux-gnu
 loading site script './config.site'
 loading build specific script './config.site'
 checking for pwd... /bin/pwd
 checking whether builddir is srcdir... yes
 checking for working aclocal... found
 checking for working autoconf... found
 checking for working automake... found
 checking for working autoheader... found
 checking for working makeinfo... found
 checking for gawk... gawk
 checking for egrep... grep -E
 checking whether ln -s works... yes
 checking for ranlib... ranlib
 checking for bison... no
 checking for byacc... no
 checking for ar... ar
 checking for a BSD-compatible install... /usr/bin/install -c
 checking for sed... /bin/sed
 checking for less... /usr/bin/less
 checking for perl... /usr/bin/perl
 checking whether perl version is at least 5.004... yes
 checking for dvips... /usr/bin/dvips
 checking for tex... /usr/bin/tex
 checking for latex... /usr/bin/latex
 checking for makeindex... /usr/bin/makeindex
 checking for pdftex... /usr/bin/pdftex
 checking for pdflatex... /usr/bin/pdflatex
 checking for makeinfo... /usr/bin/makeinfo
 checking for unzip... /usr/bin/unzip
 checking for zip... /usr/bin/zip
 checking for gzip... /bin/gzip
 checking for firefox... no
 checking for mozilla... no
 checking for netscape... no
 checking for galeon... no
 checking for kfmclient... no
 checking for opera... no
 checking for gnome-moz-remote... /usr/bin/gnome-moz-remote
 using default browser ... /usr/bin/gnome-moz-remote
 checking for acroread... /usr/bin/acroread
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ANSI C... none needed
 checking how to run the C preprocessor... gcc -E
 checking whether gcc needs -traditional... no
 checking how to run the C preprocessor... gcc -E
 checking for gfortran... gfortran
 checking whether we are using the GNU Fortran 77 compiler... no
 checking whether gfortran accepts -g... no
 checking for g++... g++
 checking whether we are using the GNU C++ compiler... yes
 checking whether g++ accepts -g... yes
 checking how to run the C++ preprocessor... g++ -E
 checking for a sed that does not truncate output... /bin/sed
 checking for ld used by gcc... /usr/bin/ld
 checking if the linker (/usr/bin/ld) is GNU ld... yes
 checking for /usr/bin/ld option to reload object files... -r
 checking for BSD-compatible nm... /usr/bin/nm -B
 checking how to recognise dependent libraries... pass_all
 checking for ANSI C header files... yes
 checking for sys/types.h... yes
 checking for sys/stat.h... yes
 checking for stdlib.h... yes
 checking for string.h... yes
 checking for memory.h... yes
 checking for strings.h... yes
 checking for inttypes.h... yes
 checking for stdint.h... yes
 checking for unistd.h... yes
 checking dlfcn.h usability... yes
 checking dlfcn.h presence... yes
 checking for dlfcn.h... yes
 checking the maximum length of command line arguments... 32768
 checking command to parse /usr/bin/nm -B output from gcc object... ok
 checking for objdir... .libs
 checking for ranlib... (cached) ranlib
 checking for strip... strip
 checking if gcc static flag  works... yes
 checking if gcc supports -fno-rtti -fno-exceptions... no
 checking for gcc option to produce PIC... -fPIC
 checking if gcc PIC flag -fPIC works... yes
 checking if gcc supports -c -o file.o... yes
 checking whether the gcc linker (/usr/bin/ld) supports shared 
 libraries... yes
 checking whether -lc should be explicitly linked in... no
 checking dynamic linker characteristics... GNU/Linux ld.so
 checking how to hardcode 

Re: [R] New user: Custom probability distribution

2006-02-09 Thread Matthias Kohl
Hi,

you can use our package distr respectively distrEx.
require(distrEx)
D1 - DiscreteDistribution(supp=0:3, prob = 12/(25*(1:4)))
plot(D1)
r(D1)(50)

hth
Matthias

Hello,

   Given a probability function: p(x) = 12 / (25(x+1)) , x=0, 1, 2, 3 we
generate the following values:

  C1  C2
  0   0.48
  1   0.24
  2   0.16
  3   0.12

   Now, I'm supposed to create 50 random values using this table. In
MiniTab, I simply selected Calc - Random Data - Discrete, and selected
the columns, and it created 50 random values in a new column.[1]

How do I do the same thing in R?

   [1] You may be wondering why I'm telling you this. Well, it's because
if I were in your shoes, I'd think Oh, someone wants me to solve his
homework.. I have already solved it using MiniTab, but I want to be
able to use R instead (since I prefer NetBSD).

  



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



-- 
StaMatS - Statistik + Mathematik Service
Dr. rer. nat. Matthias Kohl
Gottlieb-Keim-Straße 60
95448 Bayreuth
Phone: +49 921 50736457
E-Mail: [EMAIL PROTECTED]
Home: www.stamats.de

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


[R] latent class modle for rater agreement

2006-02-09 Thread Lisa Wang
Hello there,

I would like to test the agreement amongst 6 raters for nominal data on
a scale from 1-4, and conduct a latent class analysis in R. How should
the data be formatted and what code should I use?

Thank you very much

Lisa Wang
Princess Margaret Hospital
Biostatistics
tel:416 946 4501

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


[R] Transferring R results to word prosessors

2006-02-09 Thread Tom Backer Johnsen
There has been an incredible number of responses in a short time, with a 
number of different suggestions.  With hindsight, I must admit I have not 
been quite clear, so additional (somewhat lengthy) explanation is needed.

I want to use R in an introductory course on multiple regression (among 
other things) starting in two weeks time for students of psychology at my 
University.  These students are very much used to MS Word, it is in 
principle possible to get them to adopt OpenOffice (which I would like to), 
but I regard Latex to be out of the question.

One of the things they are drilled on is that they have to produce term 
papers etc. based on a template in APA (American Psychological Association) 
format.  Among other things, this means that the document must be all text 
apart from the graphics.  Therefore any kind of solution involving pictures 
of tables rather than the tables / results as text is out.  Same holds for 
all kinds of mixed output, so combinations of text with PDF 
elements.  Besides, the tables in R are not that nice in respect to the 
formatting.  Since the content is the main thing anyhow, that does not 
matter.  In most cases, the tables have to be tweaked as least to some 
extent.  Given my inexperience, it seems that the R2HTML path is so far the 
most promising (but for me untried so far)

One of the nice things about SPSS and Statistica is that it is VERY easy to 
copy and paste output from the program right into the paper / paper.  A 
commmon trick when using SPSS is to first paste the output into a 
spreadsheet (e.g. Excel), and from there into the document.  In any case, 
the outcome is that the output is a table (not a table in the R sense) in 
the document, which may be edited, tweaked, adding borders etc..  So, what 
I am looking for is a process starting with output from R (like what is 
obtained from the summary(lm (...)) command, the output of a correlation 
matrix, or ...) that could end up as a table in MS Word (and probably in 
OpenOffice as well) in the smallest number of steps.

For instance, if there was an option in R which had the effect that the 
spaces separating things (e.g. the columns in the output of a correlation 
matrix or the elements in an ANOVA table) were replaced by tabs, everything 
would be very simple.  Then, you could (a) paste the output into the 
document, and (b) do a simple text-to-table conversion in Word after the 
paste.  A simple affair with a few simple steps.  Ideally, what I want for 
me and my students is this or a similar solution to this problem.  That 
might be a good selling argument for R as well.

Tom

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


Re: [R] Plotting 27 line plots in one page

2006-02-09 Thread Sarah Goslee

 I want to plot all these elements in 9x3 plot (9 rows
 and 3 columns)
 par(9,3)


You need to specify what par you want - see ?par for details.
In this case, either

par(mfrow=c(9,3))
or
par(mfcol=c(9, 3))

will do what you want.

Sarah
--
Sarah Goslee
http://www.stringpage.com

[[alternative HTML version deleted]]

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


Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Peter Flom
 Marc Schwartz (via MN) [EMAIL PROTECTED] 2/9/2006 

If you prefer a good book, The LaTeX Companion (aka TLC) is the place
to begin:

http://www.amazon.com/gp/product/0201362996 

Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
http://cduhr.ndri.org
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)





I respectfully disagree.  TLC is a great book.  Absolutely.  But I
think it is overwhelming for a beginner.  

Peter

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


  1   2   >