Re: [R] Importing IDL Structures

2005-09-15 Thread Peter Dalgaard
Michael Lefsky [EMAIL PROTECTED] writes:

 I am trying to get started with R, but before I do, I need to find a
 way to import my existing datasets, which are currently stored as
 arrays of IDL structures (RSI's IDL, not the other one).
 
 The problem I has is this: the IDL structures contain scalar items, as
 well as n-dimensional arrays. I can export the data in a number of
 ways, including as separate files for scalars and for each of the
 arrays.
 
 Has anyone tackled this problem? If not, can you advise me on the best
 data structure(s) to hold such data in R? Data frames seemed to be the
 most obvious choice, but I prefer the syntax used for lists (it is
 more similar to IDL), if that is possible. And of course (as I said in
 a previous message) there is the question of how to import the data
 into the structure (it looks like I will need to export each array
 separately , import them into R and then assemble the final
 structure).

I don't know IDL, but it seems to do HDF. Would the hdf5 package help,
I wonder?

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

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


Re: [R] Graphical presentation of logistic regression

2005-09-15 Thread Jari Oksanen
On Wed, 2005-09-14 at 06:29 -0500, Frank E Harrell Jr wrote:
 Beale, Colin wrote:
  Hi,
  
  I wonder if anyone has written any code to implement the suggestions of
  Smart et al (2004) in the Bulletin of the Ecological Society of America
  for a new way of graphically presenting the results of logistic
  regression (see
  www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t
  ools1 for the full text)? I couldn't find anything relating to this sort
  of graphical representation of logistic models in the archives, but
  maybe someone has solved it already? In short, Smart et al suggest that
  a logistic regression be presented as a combination of the two
  histograms for successes and failures (with one presented upside down at
  the top of the figure, the other the right way up at the bottom)
  overlaid by the probability function (ie logistic curve). It's somewhat
  hard to describe, but is nicely illustrated in the full text version
  above. I think it is a sensible way of presenting these results and am
  keen to do so - at the moment I can only do this by generating the two
  histograms and the logistic curve separately (using hist() and lines()),
  then copying and pasting the graphs out of R and inverting one in a
  graphics package, before overlying the others. I'm sure this could be
  done within R and would be a handy plotting function to develop. Has
  anyone done so, or can anyone give me any pointers to doing this? I
  really nead to know how to invert a histogram and how to overlay this
  with another histogram the right way up.
  
  Any thoughts would be welcome.
  
  Thanks in advance,
  Colin
 
  From what you describe, that is a poor way to represent the model 
 except for judging discrimination ability (if the model is calibrated 
 well).  Effect plots, odds ratio charts, and nomograms are better.  See 
 the Design package for details.
 

You're correct when you say that this is a poor way to represent the
model. However, you should have some understanding to us ecologists who
are simple creatures working with tangible subjects such as animals and
plants (microbiologists work with less tangible things). Therefore we
want to have a concrete and simple representation. After all, the
example was about occurrence of an animal against a concrete
environmental variable, and a concrete representation was suggested.
Nomograms and things are abstractions that you understand first after
long education and training (I tried the Design package and I didn't
understand the nomogram plot). 

I tried with one concrete example with my own data, and the inverted
histogram method was patently misleading (with Baz Rowlingson's neat and
compact code, sorry for the repetition). The method would be useful with
dense and regular data only, but now the clearest visual cue was the
uneven sampling intensity. With my limited knowledge on R facilities, I
can now remember only two ways two preserve the concreteness of display
in the base R: jitter() to avoid overplotting of observations, and
sunflowerplot() to show the amount of overplotting.

I think Ecological Society of America would be happy to receive papers
to suggest better ways to represent binary response data, if some of the
knowledgeable persons in this groups would decided to educate them (I'm
not an ESA member, so I wouldn't be educated: therefore 'them' instead
of 'us'). The ESA bulletin will be influential in manuscript submitted
to the Society journals in the future, and the time for action is now.

cheers, jari oksanen
-- 
Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland
Ph. +358 8 5531526, cell +358 40 5136529, fax +358 8 5531061
email [EMAIL PROTECTED], homepage http://cc.oulu.fi/~jarioksa/

__
R-help@stat.math.ethz.ch 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] Long lines with Sweave

2005-09-15 Thread Martin Maechler
 Jan == Jan T Kim [EMAIL PROTECTED]
 on Wed, 14 Sep 2005 14:46:20 +0100 writes:

Jan On Wed, Sep 14, 2005 at 02:49:56PM +0200, Henrik Andersson wrote:
 Jan T. Kim wrote:
  On Wed, Sep 14, 2005 at 10:14:59AM +0200, Henrik Andersson wrote:
  
 I have used Sweave a lot the latest year, but never really used any 
long 
 function calls.
 
 
 If I have code which look like this
 
 -
 gof - benthic.flux(ID=Gulf of Finland,
  meas.conc=conc,
  bw.conc=bw.conc,
  time=times,
  substance=expression(DIC~(mmol~m^{-3}))
  )
 -
 
 I get the output by Sweave in my pdf file, like this:
 
 ---
   gof - benthic.flux(ID = Gulf of Finland, meas.conc = conc,
 + bw.conc = bw.conc, time = times, substance = expression(DIC ~
 + (mmol ~ m^{
 + -3
 + })))
 
 
 I can understand that it will not look exactly as entered but why is 
the 
 '-3' on a line of it's own?
 
 Can anyone suggest a idea to how I can make this more readable.
  
  
  It seems you've been thinking LaTeX rather than R ;-)  :
  The exponent -3 in the expression should be enclosed by parentheses
  rather than by curly braces.
  
  The code formatting done by the print method inserts the newline after
  { and before }.
  
  Best regards, Jan
 
 If you look at demo(plotmath), I get the impression that m^(-3) does not 
 give me the desired behavior.
 
 I want to have -3 in superscript without visible parentheses.
 
 Tricky!

Jan Ok, I see.

Jan It seems to me that you could omit the curly braces in the example, I
Jan don't see any differences between the title in the plots produced by

Jan plot(1:10, main = expression(DIC~(mmol~m^-3)))

Jan and

Jan plot(1:10, main = expression(DIC~(mmol~m^{-3})))

Jan For more complex exponents, you could try plain() to prevent them from
Jan being wrongly grouped by operator precedence, as in

Jan plot(1:10, main = expression(DIC~(mmol~m^plain(-3 + t

neat idea, but

Jan Not exactly ideal for readability, however...

indeed.  And really only a workaround:

You shouldn't have to uglify your R code in order to work around
Sweave pecularities.

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] Scan and Lists

2005-09-15 Thread Martin Maechler
 Michael == Michael Lefsky [EMAIL PROTECTED]
 on Wed, 14 Sep 2005 15:06:17 -0600 writes:

Michael This may be a newbie question - although I did
Michael search for this error message in the archives and
Michael via google and didn't see this error:

I know how useful google can be - - still, sometimes one would
better spend the time differently ... You know the old IBM
motto? If not, google for IBM motto  ;-)

Michael The help page for scan indicates that among the types of data
Michael capable of being read are:

 The supported types are 'logical', 'integer', 'numeric',
 'complex', 'character', 'raw' and 'list': 'list' values
 should have elements which are one of the first six types
 listed or 'NULL'.

Michael I have tried to use a list within a what list : 

which was wrong:

Michael f - scan(file=c:/test/testout.csv,
Michael   what=list(hi=0.0,bye=,wave=list(1:1000)),
Michael   sep=,,skip=1)
Michael and the following error is returned: 

Michael c:/test/testout.csv, what = list(hi = 0, bye = ,  : 
Michael unimplemented type 'list' in 'extractItem'

Michael So, is my syntax confusing R, or is the documentation wrong, or is 
it
Michael some other, third, option?

3rd: You didn't read the documentation carefully enough
(though I agree that the current wording leaves a non-small
 possibility for confusion):

In your above citation from the help page, you've left off
crucial context. Here is a bit more

  what: the type of 'what' gives the type of data to be read. If
 'what' is a list, it is assumed that the lines of the data
 file are records each containing 'length(what)' items
 (fields). The supported types are 'logical', 'integer',
 'numeric', 'complex', 'character', 'raw' and 'list': 'list'
 values should have elements which are one of the first six
 types listed or 'NULL'.

So 'what' has a *type* and that type can be logical, , and list.
where list should have elements from the first six types ---
which do *NOT* include list.

In short: It does exclude using a *list* inside the list.

Is your data
 double character int int  int
with 1000 integers, i.e. you have 1002 columns?

If yes, you'd probably get what you want by

whatCols - c(list(hi=0.0, bye=), as.list(1:1000))
f - scan(file = c:/test/testout.csv,
  what = whatCols, sep= ,, skip=1)

{The point here is that c(l1, l2) is used to concatenate two
 lists l1 and l2;
 and yes: Please do use spaces {and indentation} to make your
  more readable !
}

Michael Thanks

You're welcome,
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] if() command

2005-09-15 Thread Petr Pikal

__
R-help@stat.math.ethz.ch 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] R: deleting rows

2005-09-15 Thread Clark Allan
hi all

hopefully some one can help.


assume that i imported the following data into R (say the data frame is
called a)

x1  x2  x3
1   NA  3
1   2   NA
1   2   3
3   NA  6
4   5   9
7   5   6
7   8   9
NA  7   9


How can i construct a new data frame that only contains those rows that
does not contain the NA's? is these a quick way?

ie

x1  x2  x3
1   2   3
4   5   9
7   5   6
7   8   9


in this example we can simple use a[c(-1,-2,-4,-8),] but happens if we
have a larger dataframe?

we need to construct some kind of row indicator telling R which rows
contains NA'S.

is there an easier method?

/
allan__
R-help@stat.math.ethz.ch 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: deleting rows

2005-09-15 Thread Dimitris Rizopoulos
look at function ?complete.cases(), e.g.,

a[complete.cases(a), ]

will do the work in your case.


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: Clark Allan [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Cc: Birgit Erni [EMAIL PROTECTED]
Sent: Thursday, September 15, 2005 10:22 AM
Subject: [R] R: deleting rows


 hi all

 hopefully some one can help.


 assume that i imported the following data into R (say the data frame 
 is
 called a)

 x1 x2 x3
 1 NA 3
 1 2 NA
 1 2 3
 3 NA 6
 4 5 9
 7 5 6
 7 8 9
 NA 7 9


 How can i construct a new data frame that only contains those rows 
 that
 does not contain the NA's? is these a quick way?

 ie

 x1 x2 x3
 1 2 3
 4 5 9
 7 5 6
 7 8 9


 in this example we can simple use a[c(-1,-2,-4,-8),] but happens if 
 we
 have a larger dataframe?

 we need to construct some kind of row indicator telling R which rows
 contains NA'S.

 is there an easier method?

 /
 allan





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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.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] R: deleting rows

2005-09-15 Thread Uwe Ligges
Clark Allan wrote:

 hi all
 
 hopefully some one can help.
 
 
 assume that i imported the following data into R (say the data frame is
 called a)
 
 x1x2  x3
 1 NA  3
 1 2   NA
 1 2   3
 3 NA  6
 4 5   9
 7 5   6
 7 8   9
 NA7   9
 
 
 How can i construct a new data frame that only contains those rows that
 does not contain the NA's? is these a quick way?
 
 ie
 
 x1x2  x3
 1 2   3
 4 5   9
 7 5   6
 7 8   9
 
 
 in this example we can simple use a[c(-1,-2,-4,-8),] but happens if we
 have a larger dataframe?
 
 we need to construct some kind of row indicator telling R which rows
 contains NA'S.
 
 is there an easier method?


na.omit(a)

Uwe Ligges


 /
 allan
 
 
 
 
 __
 R-help@stat.math.ethz.ch 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] Long lines with Sweave

2005-09-15 Thread Friedrich . Leisch
 On Thu, 15 Sep 2005 09:35:25 +0200,
 Martin Maechler (MM) wrote:

 Jan == Jan T Kim [EMAIL PROTECTED]
 on Wed, 14 Sep 2005 14:46:20 +0100 writes:

  Jan On Wed, Sep 14, 2005 at 02:49:56PM +0200, Henrik Andersson wrote:
   Jan T. Kim wrote:
On Wed, Sep 14, 2005 at 10:14:59AM +0200, Henrik Andersson wrote:

   I have used Sweave a lot the latest year, but never really used any 
long 
   function calls.
   
   
   If I have code which look like this
   
   -
   gof - benthic.flux(ID=Gulf of Finland,
meas.conc=conc,
bw.conc=bw.conc,
time=times,
substance=expression(DIC~(mmol~m^{-3}))
)
   -
   
   I get the output by Sweave in my pdf file, like this:
   
   ---
 gof - benthic.flux(ID = Gulf of Finland, meas.conc = conc,
   + bw.conc = bw.conc, time = times, substance = expression(DIC ~
   + (mmol ~ m^{
   + -3
   + })))
   
   
   I can understand that it will not look exactly as entered but why is 
the 
   '-3' on a line of it's own?
   
   Can anyone suggest a idea to how I can make this more readable.


It seems you've been thinking LaTeX rather than R ;-)  :
The exponent -3 in the expression should be enclosed by parentheses
rather than by curly braces.

The code formatting done by the print method inserts the newline after
{ and before }.

Best regards, Jan
   
   If you look at demo(plotmath), I get the impression that m^(-3) does not 
   give me the desired behavior.
   
   I want to have -3 in superscript without visible parentheses.
   
   Tricky!

  Jan Ok, I see.

  Jan It seems to me that you could omit the curly braces in the example, I
  Jan don't see any differences between the title in the plots produced by

  Jan plot(1:10, main = expression(DIC~(mmol~m^-3)))

  Jan and

  Jan plot(1:10, main = expression(DIC~(mmol~m^{-3})))

  Jan For more complex exponents, you could try plain() to prevent them from
  Jan being wrongly grouped by operator precedence, as in

  Jan plot(1:10, main = expression(DIC~(mmol~m^plain(-3 + t

   neat idea, but

  Jan Not exactly ideal for readability, however...

   indeed.  And really only a workaround:

   You shouldn't have to uglify your R code in order to work around
   Sweave pecularities.


Hmm, it's not really an Sweave peculiarity, but one of the R
parser. After saving Henrik's code in file test.R I get

R x  = parse(test.R)
R x
expression(gof - benthic.flux(ID = Gulf of Finland, meas.conc = conc, 
bw.conc = bw.conc, time = times, substance = expression(DIC ~ 
(mmol ~ m^{
-3
}
R deparse(x)
[1] expression(gof - benthic.flux(ID = \Gulf of Finland\, meas.conc = conc, 

[2] bw.conc = bw.conc, time = times, substance = expression(DIC ~ 
 
[3] (mmol ~ m^{   
 
[4] -3
 
[5] }

and the latter is used by Sweave. The code chunks need to be parsed,
because otherwise there is no way how to know where to insert
output. A source(..., echo=TRUE) will suffer from the same problem.

Best,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch 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] Long lines with Sweave

2005-09-15 Thread Martin Maechler
 Fritz == Friedrich Leisch [EMAIL PROTECTED]
 on Thu, 15 Sep 2005 10:36:43 +0200 writes:

 On Thu, 15 Sep 2005 09:35:25 +0200,
 Martin Maechler (MM) wrote:

 Jan == Jan T Kim [EMAIL PROTECTED]
 on Wed, 14 Sep 2005 14:46:20 +0100 writes:

Jan On Wed, Sep 14, 2005 at 02:49:56PM +0200, Henrik Andersson wrote:
 Jan T. Kim wrote:
  On Wed, Sep 14, 2005 at 10:14:59AM +0200, Henrik Andersson wrote:
  
 I have used Sweave a lot the latest year, but never really used any 
long 
 function calls.
 
 
 If I have code which look like this
 
 -
 gof - benthic.flux(ID=Gulf of Finland,
  meas.conc=conc,
  bw.conc=bw.conc,
  time=times,
  substance=expression(DIC~(mmol~m^{-3}))
  )
 -
 
 I get the output by Sweave in my pdf file, like this:
 
 ---
   gof - benthic.flux(ID = Gulf of Finland, meas.conc = conc,
 + bw.conc = bw.conc, time = times, substance = expression(DIC ~
 + (mmol ~ m^{
 + -3
 + })))
 
 
 I can understand that it will not look exactly as entered but why is 
the 
 '-3' on a line of it's own?
 
 Can anyone suggest a idea to how I can make this more readable.
  
  
  It seems you've been thinking LaTeX rather than R ;-)  :
  The exponent -3 in the expression should be enclosed by parentheses
  rather than by curly braces.
  
  The code formatting done by the print method inserts the newline 
after
  { and before }.
  
  Best regards, Jan
 
 If you look at demo(plotmath), I get the impression that m^(-3) does 
not 
 give me the desired behavior.
 
 I want to have -3 in superscript without visible parentheses.
 
 Tricky!

Jan Ok, I see.

Jan It seems to me that you could omit the curly braces in the example, I
Jan don't see any differences between the title in the plots produced by

Jan plot(1:10, main = expression(DIC~(mmol~m^-3)))

Jan and

Jan plot(1:10, main = expression(DIC~(mmol~m^{-3})))

Jan For more complex exponents, you could try plain() to prevent them from
Jan being wrongly grouped by operator precedence, as in

Jan plot(1:10, main = expression(DIC~(mmol~m^plain(-3 + t

 neat idea, but

Jan Not exactly ideal for readability, however...

 indeed.  And really only a workaround:

 You shouldn't have to uglify your R code in order to work around
 Sweave pecularities.


Fritz Hmm, it's not really an Sweave peculiarity, but one of the R
Fritz parser. 

Indeed, of course -- it's R's  internal deparse(.) :

Here's a smaller example:

 (cc - expression(x ^ {-3})[[1]])
 str(as.list(cc))
List of 3
 $ : symbol ^
 $ : symbol x
 $ : language {  -3 }
 

Please apologize for any bad light that I might have shed on
Sweave.  I do love its concept!

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


[R] How to sort data sets?

2005-09-15 Thread Martin Lam
Hi,

I was wondering if someone know how to sort a data set
by column.
I've tried sort() but without luck. I would think
there should be a function for it somewhere. An
example with the iris data set would be appreciated.

Thanks,

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] How to sort data sets?

2005-09-15 Thread vincent
see : order, sort.list, sort and rank
hih

__
R-help@stat.math.ethz.ch 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 sort data sets?

2005-09-15 Thread Uwe Ligges
Martin Lam wrote:

 Hi,
 
 I was wondering if someone know how to sort a data set
 by column.
 I've tried sort() but without luck. I would think
 there should be a function for it somewhere. An
 example with the iris data set would be appreciated.


See ?order.

Uwe Ligges

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

__
R-help@stat.math.ethz.ch 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] Rcommander and simple chisquare

2005-09-15 Thread Christian Jost
In this years biostat teaching I will include Rcommander (it indeed 
simplifies syntax problems that makes students frequently miss the 
core statistical problems). But I could not find how to make a simple 
chisquare comparison between observed frequencies and expected 
frequencies (eg in genetics where you expect phenotypic frequencies 
corresponding to 3:1 in standard dominant/recessif alleles). Any idea 
where this feature might be hidden? Or could it be added to 
Rcommander?

Thanks, Christian.

ps: in case I am not making myself clear, can Rcommander be made to perform
  chisq.test(c(61,39),p=c(0.75,0.25))

__
R-help@stat.math.ethz.ch 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] means comparison in R (post-hoc test)

2005-09-15 Thread Felipe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

I have been using SAS for some time, and now I have discovered R. I am
very happy with it, but I have not found out how to perform some of the
multiple comparisons I was used to do in SAS.

With the SAS/STAT, I generally used the MEANS (for comparison of
arithmetic means) and the LSMEANS (for adjusted means) statements of the
GLM procedure (I think it is equivalent to lm in R). They provided a lot
of tests: LSD, Duncan, Tukey-Kramer, Bonferroni, Scheffé, SNK, etc.
However, in R I have only discovered Tukey-HSD.

I have searched for information about this, but I was not successful. I
wonder if anybody knows where I could learn about this. I would like to
use these tests in R, and also obtain the adjusted means like these
produced by the LSMEANS statement.

Thank you.

Felipe
- --oOo--
Felipe Martínez-Pastor (BSc, PhD)
Animal Reproduction and Obstetrics
Veterinary Clinic Hospital
24071-León (Spain)
Phone: 987 291 430 / 987 291 000 + 5203
Fax: 987 295 203
e-mail: [EMAIL PROTECTED]

- ---
This message has been electronically signed using GPG, a free system to
sign and encrypt documents. If you want to learn more, visit
http://www.gnupg.org
-BEGIN PGP SIGNATURE-

iEYEARECAAYFAkMpUVYACgkQWtdQtNzjBl4rywCePiSxJw8/N6HzdZ7C+YMHf2K6
YSYAniw5GSo0ihrt4+OabHJ4c2PKNHkp
=aF38
-END PGP 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


Re: [R] if() command

2005-09-15 Thread Petr Pikal
Hi 

Sorry, I am not sure why sometimes is a text from my answeres 
stripped off.


On 14 Sep 2005 at 14:09, Carlos Mauricio Cardeal Mende wrote: 

 Ok Petr, I run your suggestion and I got this message: 
  
   age-sample(seq(10,50,10), 20, replace=T) 
   
   if (age =10) {group - 1} else if (age  10  age = 20)  
{group - 
   
 2} else {group - 3} 
 Warning message: 
 the condition has length  1 and only the first element will be  
used 
 in: if (age = 10) { 
  
 What does it means ? 

Others has already answered it but I told you that if command is  
not vhat you probably want and suggested to use cut e.g.

cutvector - c(0,10,20,100) 
group - as.numeric(cut(age,cutvector)) 

You can change your cutvector according to your wish anytime  
before calling the second function 

HTH 
Petr 



  
 And when I look to the database I have no new classification ! 
  
 Could you help please ? 
  
 Mauricio 
  
 Petr Pikal escreveu: 
  
  Hallo 
  
  
  On 13 Sep 2005 at 10:29, Carlos Maurício Cardeal Mende  
wrote: 
  
  Hi everyone ! 
  
  Could you please help me with this problem ? 
  
  I´ve trying to write a code that assign to a variable the  
content 
  from another, but all I´ve got is a message error. For  
example: 
  
  if (age =10) {group == 1} 
  else if (age  10  age = 20) {group == 2} 
  else {group == 3} 
  
  if you put your statement on one line it works (at least it does  
not 
  give you syntax error) but the result is hardly what you really 
  expect 
  
  age-sample(seq(10,50,10), 20, replace=T) 
  
  if (age =10) {group - 1} else if (age  10  age = 20)  
{group - 
  2} else {group - 3} if (age =10) {group == 1} else if (age   
10  
  age = 20) {group == 2} else {group == 3} 
  
  Maybe you want something like 
  
  group-as.numeric(cut(age,c(0,10,20,100))) 
  
  but it is only guess 
  
  HTH 
  Petr 
  
  
  Syntax error 
  
  Or 
  
  if (age =10) {group == 1} 
  else (age  10  age = 20) {group == 2} 
  else {group == 3} 
  
  Syntax error 
  
  I know that is possible to find the solution by ifelse command  
or 
  even recode command, but I´d like to use this way, because I  
can 
  add another variable as a new condition and I believe to  
expand the 
  possibilites. 
  
  Thanks, 
  Mauricio 
  
  __ 
  R-help@stat.math.ethz.ch 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] stripped postings when not following the posting guide

2005-09-15 Thread Martin Maechler
 Petr == Petr Pikal [EMAIL PROTECTED]
 on Thu, 15 Sep 2005 13:27:43 +0200 writes:

Petr Hi 
Petr Sorry, I am not sure why sometimes is a text from my answeres 
Petr stripped off.

Hi Petr,
it's when you don't follow the posting guide _and_ simultaneously
happen to fool the filters so that something is posted at all:

The one you mention from this morning was full of HTML crap,
(wc on the body gave 302  1491 17036), but wasn't correctly
recognized as HTML by one part of the filters but by the others
(that strip HTML).

  [ If the filters worked as intended currently, such a message
would be completely swallowed by the filters! ]

Regards, 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] Rcommander and simple chisquare

2005-09-15 Thread Philippe Grosjean
Hello,

Just look at Statistics - Contingency tables. There is an option for 
making the chi square test there.
Best,

Philippe Grosjean,

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

Christian Jost wrote:
 In this years biostat teaching I will include Rcommander (it indeed 
 simplifies syntax problems that makes students frequently miss the 
 core statistical problems). But I could not find how to make a simple 
 chisquare comparison between observed frequencies and expected 
 frequencies (eg in genetics where you expect phenotypic frequencies 
 corresponding to 3:1 in standard dominant/recessif alleles). Any idea 
 where this feature might be hidden? Or could it be added to 
 Rcommander?
 
 Thanks, Christian.
 
 ps: in case I am not making myself clear, can Rcommander be made to perform
 
 chisq.test(c(61,39),p=c(0.75,0.25))
 
 
 __
 R-help@stat.math.ethz.ch 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] Graphical presentation of logistic regression

2005-09-15 Thread Charles Annis, P.E.
If a graphical presentation provides improved insight then that is
sufficient justification.  The existence of better more precise methods,
does not change that.

I, too, sometimes use jitter() to avoid overplotting of observations, but I
think the dot-plots in de la Cruz's code are even better.  It is the
histogram that is misleading (due to paucity of data), not the effort to
elucidate the joint behavior of zeros and ones. 
http://www.esapubs.org/bulletin/backissues/086-1/bulletinjan2005.htm#et

Please try a variation that his code provides:

plot.logi.hist(independ = altitude, depend = tree, logi.mod = 1, type =
dit, boxp = TRUE, rug = TRUE, las.h = 1)

which does not use the histograms but instead uses dit plots to provide a
helpful, visceral feel for the behavior of the observations.

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jari Oksanen
Sent: Thursday, September 15, 2005 3:17 AM
To: Frank E Harrell Jr
Cc: r-help@stat.math.ethz.ch; Beale, Colin
Subject: Re: [R] Graphical presentation of logistic regression

On Wed, 2005-09-14 at 06:29 -0500, Frank E Harrell Jr wrote:
 Beale, Colin wrote:
  Hi,
  
  I wonder if anyone has written any code to implement the suggestions of
  Smart et al (2004) in the Bulletin of the Ecological Society of America
  for a new way of graphically presenting the results of logistic
  regression (see
  www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t
  ools1 for the full text)? I couldn't find anything relating to this sort
  of graphical representation of logistic models in the archives, but
  maybe someone has solved it already? In short, Smart et al suggest that
  a logistic regression be presented as a combination of the two
  histograms for successes and failures (with one presented upside down at
  the top of the figure, the other the right way up at the bottom)
  overlaid by the probability function (ie logistic curve). It's somewhat
  hard to describe, but is nicely illustrated in the full text version
  above. I think it is a sensible way of presenting these results and am
  keen to do so - at the moment I can only do this by generating the two
  histograms and the logistic curve separately (using hist() and lines()),
  then copying and pasting the graphs out of R and inverting one in a
  graphics package, before overlying the others. I'm sure this could be
  done within R and would be a handy plotting function to develop. Has
  anyone done so, or can anyone give me any pointers to doing this? I
  really nead to know how to invert a histogram and how to overlay this
  with another histogram the right way up.
  
  Any thoughts would be welcome.
  
  Thanks in advance,
  Colin
 
  From what you describe, that is a poor way to represent the model 
 except for judging discrimination ability (if the model is calibrated 
 well).  Effect plots, odds ratio charts, and nomograms are better.  See 
 the Design package for details.
 

You're correct when you say that this is a poor way to represent the
model. However, you should have some understanding to us ecologists who
are simple creatures working with tangible subjects such as animals and
plants (microbiologists work with less tangible things). Therefore we
want to have a concrete and simple representation. After all, the
example was about occurrence of an animal against a concrete
environmental variable, and a concrete representation was suggested.
Nomograms and things are abstractions that you understand first after
long education and training (I tried the Design package and I didn't
understand the nomogram plot). 

I tried with one concrete example with my own data, and the inverted
histogram method was patently misleading (with Baz Rowlingson's neat and
compact code, sorry for the repetition). The method would be useful with
dense and regular data only, but now the clearest visual cue was the
uneven sampling intensity. With my limited knowledge on R facilities, I
can now remember only two ways two preserve the concreteness of display
in the base R: jitter() to avoid overplotting of observations, and
sunflowerplot() to show the amount of overplotting.

I think Ecological Society of America would be happy to receive papers
to suggest better ways to represent binary response data, if some of the
knowledgeable persons in this groups would decided to educate them (I'm
not an ESA member, so I wouldn't be educated: therefore 'them' instead
of 'us'). The ESA bulletin will be influential in manuscript submitted
to the Society journals in the future, and the time for action is now.

cheers, jari oksanen
-- 
Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland
Ph. +358 8 5531526, cell +358 40 5136529, fax +358 8 5531061
email [EMAIL PROTECTED], homepage http://cc.oulu.fi/~jarioksa/

__

[R] how to do sthg like mat[!=(ind),]

2005-09-15 Thread Florence Combes
Hi 

I want to do something which seems straightforward, but I couldn't find the 
way to do this. 
I have a matrix called m for example, and a vector of values (let's call ind 
this vector) which are indices of lines I don't want to keep. 

for example I have:

 m
v1 v2 v3
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
[4,] 10 11 12

 ind
[1] 2 4


I would like to obtain this:

 m2
v1 v2 v3
[1,] 1 4 7
[3,] 3 6 9

by saying something like 

m2-m[!=(ind),] 

but this line does not work. 

Any idea or suggestion highly welcome !

Florence.

[[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] stripped postings when not following the posting guide

2005-09-15 Thread Petr Pikal
Hi Martin

It sometimes happens when I respond to somebodys question. 
When I post my own I try to follow the posting guide closely and 
do not use HTML crap at all. 

I just do not know how to recognize that my response has this 
unwanted residues and how to get rid of them before I actually 
find that the message is stripped off.

I am using Pegassus Mail 4.21c.

Thanks
Petr






On 15 Sep 2005 at 14:30, Martin Maechler wrote:

  Petr == Petr Pikal [EMAIL PROTECTED]
  on Thu, 15 Sep 2005 13:27:43 +0200 writes:
 
 Petr Hi 
 Petr Sorry, I am not sure why sometimes is a text from my
 answeres Petr stripped off.
 
 Hi Petr,
 it's when you don't follow the posting guide _and_ simultaneously
 happen to fool the filters so that something is posted at all:
 
 The one you mention from this morning was full of HTML crap,
 (wc on the body gave 302  1491 17036), but wasn't correctly
 recognized as HTML by one part of the filters but by the others
 (that strip HTML).
 
   [ If the filters worked as intended currently, such a message
 would be completely swallowed by the filters! ]
 
 Regards, 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

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] how to do sthg like mat[!=(ind),]

2005-09-15 Thread Uwe Ligges
Florence Combes wrote:

 Hi 
 
 I want to do something which seems straightforward, but I couldn't find the 
 way to do this. 
 I have a matrix called m for example, and a vector of values (let's call ind 
 this vector) which are indices of lines I don't want to keep. 
 
 for example I have:
 
 
m
 
 v1 v2 v3
 [1,] 1 4 7
 [2,] 2 5 8
 [3,] 3 6 9
 [4,] 10 11 12
 
 
ind
 
 [1] 2 4
 
 
 I would like to obtain this:
 
 
m2
 
 v1 v2 v3
 [1,] 1 4 7
 [3,] 3 6 9
 
 by saying something like 
 
 m2-m[!=(ind),] 



See help([) and learn about negative indices:

m2 - m[-ind,]

Uwe Ligges


 but this line does not work. 
 
 Any idea or suggestion highly welcome !
 
 Florence.
 
   [[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] means comparison in R (post-hoc test)

2005-09-15 Thread Dieter Menne
Felipe felipe at unileon.es writes:

 With the SAS/STAT, I generally used the MEANS (for comparison of
 arithmetic means) and the LSMEANS (for adjusted means) statements of the
 GLM procedure (I think it is equivalent to lm in R). They provided a lot
 of tests: LSD, Duncan, Tukey-Kramer, Bonferroni, Scheffé, SNK, etc.
 However, in R I have only discovered Tukey-HSD.

Package multcomp with the workhorse-function simint comes close to what you 
want.


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] Splitting the string at the last sub-string

2005-09-15 Thread Tuszynski, Jaroslaw W.

Hi,

I need to split a string into 2 strings, with the split point defined by the
last occurrence of some substring. I come up with some convoluted code to do
so:

str = Chance favors the prepared mind
sub = e
y = unlist(strsplit(str,sub))
z = cbind(paste(y[-length(y)], sub,  sep=, collapse = ), y[length(y)]);

y
z
z[1]
z[2]

Is there a simpler way to do so? I think ~8 function calls to do such a
simple operation is an overkill.

Jarek 
\ 
 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  \__,|  
 (703) 676-4192 \ 
 [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] Graphical presentation of logistic regression

2005-09-15 Thread Frank E Harrell Jr
Jari Oksanen wrote:
 On Wed, 2005-09-14 at 06:29 -0500, Frank E Harrell Jr wrote:
 
Beale, Colin wrote:

Hi,

I wonder if anyone has written any code to implement the suggestions of
Smart et al (2004) in the Bulletin of the Ecological Society of America
for a new way of graphically presenting the results of logistic
regression (see
www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t
ools1 for the full text)? I couldn't find anything relating to this sort
of graphical representation of logistic models in the archives, but
maybe someone has solved it already? In short, Smart et al suggest that
a logistic regression be presented as a combination of the two
histograms for successes and failures (with one presented upside down at
the top of the figure, the other the right way up at the bottom)
overlaid by the probability function (ie logistic curve). It's somewhat
hard to describe, but is nicely illustrated in the full text version
above. I think it is a sensible way of presenting these results and am
keen to do so - at the moment I can only do this by generating the two
histograms and the logistic curve separately (using hist() and lines()),
then copying and pasting the graphs out of R and inverting one in a
graphics package, before overlying the others. I'm sure this could be
done within R and would be a handy plotting function to develop. Has
anyone done so, or can anyone give me any pointers to doing this? I
really nead to know how to invert a histogram and how to overlay this
with another histogram the right way up.

Any thoughts would be welcome.

Thanks in advance,
Colin

 From what you describe, that is a poor way to represent the model 
except for judging discrimination ability (if the model is calibrated 
well).  Effect plots, odds ratio charts, and nomograms are better.  See 
the Design package for details.

 
 
 You're correct when you say that this is a poor way to represent the
 model. However, you should have some understanding to us ecologists who
 are simple creatures working with tangible subjects such as animals and
 plants (microbiologists work with less tangible things). Therefore we
 want to have a concrete and simple representation. After all, the
 example was about occurrence of an animal against a concrete
 environmental variable, and a concrete representation was suggested.
 Nomograms and things are abstractions that you understand first after
 long education and training (I tried the Design package and I didn't
 understand the nomogram plot). 

I don't understand why you think the histograms are representing the 
model.  That approach even seems to be interchanging the roles of the 
independent and dependent variables.

 
 I tried with one concrete example with my own data, and the inverted
 histogram method was patently misleading (with Baz Rowlingson's neat and
 compact code, sorry for the repetition). The method would be useful with
 dense and regular data only, but now the clearest visual cue was the
 uneven sampling intensity. With my limited knowledge on R facilities, I
 can now remember only two ways two preserve the concreteness of display
 in the base R: jitter() to avoid overplotting of observations, and
 sunflowerplot() to show the amount of overplotting.
 
 I think Ecological Society of America would be happy to receive papers
 to suggest better ways to represent binary response data, if some of the
 knowledgeable persons in this groups would decided to educate them (I'm
 not an ESA member, so I wouldn't be educated: therefore 'them' instead
 of 'us'). The ESA bulletin will be influential in manuscript submitted
 to the Society journals in the future, and the time for action is now.

See

@Article{gui00ord,
   author =  {Guisan, Antoine and Harrell, Frank E.},
   title =   {Ordinal response regression models in
ecology},
   journal = {Journal of Vegetation Science},
   year =2000,
   volume = 11,
   pages = {617-626},
   annote =  {teaching;ordinal logistic model}
}

This is more complex than needed (ordinal instead of binary) but binary 
is a special case of ordinal.

Cheers,

Frank

 
 cheers, jari oksanen


-- 
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] make check FAILS - Error code 1...comparing d-p-q-r-tests.Rout

2005-09-15 Thread Courtney Thomas
Under FreeBSD 5.3, attempting to properly install R-2.1.1, I get the
following response when I.

% make  ;all finishes without error, then...

% make check ret
.
.
--
comparing d-p-q-r-tests.Rout
to
  d-p-q-r-tests.Rout.save

1004c1004

 [1] mean relative difference 1.2848649e-08
  [1] TRUE
.Error code 1

stop in ~R/R-2.1.1/tests
---

I assume a computed value is out of bounds regarding a predetermined
range of accuracy. Not being a statistician nor programmer, how might I
fix this, please ?

Appreciatively,

Courtney

__
R-help@stat.math.ethz.ch 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] Splitting the string at the last sub-string

2005-09-15 Thread Barry Rowlingson
Prof Brian Ripley wrote:

substring(str, c(1, 26), c(25,length(str)))

  nchar(str) surely?

  regexps can be rather slow though. Here's two functions:

byRipley =
function(str,sub){
   lp=attr(regexpr(paste(.*,sub,sep=),str),'match.length')
   return(substring(str, c(1, lp+1), c(lp,nchar(str
}

byJarek =
function(str,sub){
   y = unlist(strsplit(str,sub))
   return(cbind(paste(y[-length(y)], sub,  sep=, collapse = ), 
y[length(y)]))
}

  and a quick test:

  system.time(for(i in 1:10){byJarek(str,sub)})
[1] 15.55  0.10 16.06  0.00  0.00

  system.time(for(i in 1:10){byRipley(str,sub)})
[1] 30.28  0.07 31.86  0.00  0.00

Baz

__
R-help@stat.math.ethz.ch 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] Remove vector elements from another vector

2005-09-15 Thread Karsten Luder
Hello,

I have two vectors of different lengths. Fx a - 1:9; b - c(4, 5).
What is the best way to remove the elements in vector b from vector a so 
that the result would be a vector with elements c(1,2,3,6,7,8,9)?

Best regards,
Kalle

_
Find masser af gode tilbud på MSN Shopping http://shopping.msn.dk/

__
R-help@stat.math.ethz.ch 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] Remove vector elements from another vector

2005-09-15 Thread Uwe Ligges
Karsten Luder wrote:

 Hello,
 
 I have two vectors of different lengths. Fx a - 1:9; b - c(4, 5).
 What is the best way to remove the elements in vector b from vector a so 
 that the result would be a vector with elements c(1,2,3,6,7,8,9)?


setdiff(a, b)

Uwe Ligges


 Best regards,
 Kalle
 
 _
 Find masser af gode tilbud på MSN Shopping http://shopping.msn.dk/
 
 __
 R-help@stat.math.ethz.ch 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] Remove vector elements from another vector

2005-09-15 Thread Dimitris Rizopoulos
look at function ?setdiff(), e.g.,

setdiff(a, b)


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: Karsten Luder [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Tuesday, September 13, 2005 2:35 PM
Subject: [SPAM?] [R] Remove vector elements from another vector


Hello,

I have two vectors of different lengths. Fx a - 1:9; b - c(4, 5).
What is the best way to remove the elements in vector b from vector a 
so
that the result would be a vector with elements c(1,2,3,6,7,8,9)?

Best regards,
Kalle

_
Find masser af gode tilbud på MSN Shopping http://shopping.msn.dk/

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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.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] Remove vector elements from another vector

2005-09-15 Thread Peter Dalgaard
Karsten Luder [EMAIL PROTECTED] writes:

 Hello,
 
 I have two vectors of different lengths. Fx a - 1:9; b - c(4, 5).
 What is the best way to remove the elements in vector b from vector a so 
 that the result would be a vector with elements c(1,2,3,6,7,8,9)?

I think we had this on the list no more than a week ago...

setdiff(a,b) 

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

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


Re: [R] Remove vector elements from another vector

2005-09-15 Thread Petr Pikal
Hi

On 13 Sep 2005 at 14:35, Karsten Luder wrote:

 Hello,
 
 I have two vectors of different lengths. Fx a - 1:9; b - c(4, 5).
 What is the best way to remove the elements in vector b from vector a
 so that the result would be a vector with elements c(1,2,3,6,7,8,9)?

 which(!a%in%b)
[1] 1 2 3 6 7 8 9
 a[which(!a%in%b)]
[1] 1 2 3 6 7 8 9
 a[(!a%in%b)]
[1] 1 2 3 6 7 8 9



HTH
Petr

 
 Best regards,
 Kalle
 
 _ Find
 masser af gode tilbud pĺ MSN Shopping http://shopping.msn.dk/
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


[R] newbie question

2005-09-15 Thread tom wright
Can someone tell me how I create a vector of numbers where the step
isn't 1? 
i.e. x-(0.0,0.5,1.0,1.5)

Thanks
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] Splitting the string at the last sub-string

2005-09-15 Thread Prof Brian Ripley
On Thu, 15 Sep 2005, Barry Rowlingson wrote:

 Prof Brian Ripley wrote:

 substring(str, c(1, 26), c(25,length(str)))

  nchar(str) surely?

Yes, or anything larger:  I actually tested 1.

  regexps can be rather slow though. Here's two functions:

But that's not the way to do this repeatedly for the same pattern. (It is 
normally compiling regexps that is slow, and regexpr is vectorized.) Not 
that I would call 300us `slow'.

 byRipley =
 function(str,sub){
   lp=attr(regexpr(paste(.*,sub,sep=),str),'match.length')
   return(substring(str, c(1, lp+1), c(lp,nchar(str
 }

 byJarek =
 function(str,sub){
   y = unlist(strsplit(str,sub))
   return(cbind(paste(y[-length(y)], sub,  sep=, collapse = ),
 y[length(y)]))
 }

  and a quick test:

  system.time(for(i in 1:10){byJarek(str,sub)})
 [1] 15.55  0.10 16.06  0.00  0.00

  system.time(for(i in 1:10){byRipley(str,sub)})
 [1] 30.28  0.07 31.86  0.00  0.00

 Baz

 __
 R-help@stat.math.ethz.ch 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


[R] Graphics 'snapshots' in Linux?

2005-09-15 Thread Tyler Smith
Hi,

I'm working on a MEPIS (Debian-based Linux) computer, using the 
emacs/ESS package to do my R work. I've got some plots that I label 
interactively using the locate function. With the Windows GUI there is 
an option to take a snapshot of the graphics output, saving it as an 
image file. Is there a way to do this with emacs/ESS?

Thanks,

Tyler

__
R-help@stat.math.ethz.ch 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] make check FAILS - Error code 1...comparing d-p-q-r-tests.Rout

2005-09-15 Thread Prof Brian Ripley
The problem is a known one and solved in R 2.1.1-patched.  On your OS the 
result is not as accurate as most, but the tolerance set was too tight so 
the test failure is not something to worry about.

Please install R-patched instead, as it has many bug fixes in place.

On Thu, 15 Sep 2005, Courtney Thomas wrote:

 Under FreeBSD 5.3, attempting to properly install R-2.1.1, I get the
 following response when I.

 % make;all finishes without error, then...

 % make check ret
 .
 .
 --
 comparing d-p-q-r-tests.Rout
   to
 d-p-q-r-tests.Rout.save

 1004c1004

  [1] mean relative difference 1.2848649e-08
  [1] TRUE
 .Error code 1

 stop in ~R/R-2.1.1/tests
 ---

 I assume a computed value is out of bounds regarding a predetermined
 range of accuracy. Not being a statistician nor programmer, how might I
 fix this, please ?

 Appreciatively,

 Courtney

 __
 R-help@stat.math.ethz.ch 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


[R] Combine vector of different length

2005-09-15 Thread Kel Lam
Hi group,  

Is there a quick way to cbind vector of different
length?  I should have checked out the previous
postings but somehow I can't access the list from CRAN
website.  Thanks for your help.

Regards,
Kelvin

__
R-help@stat.math.ethz.ch 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] newbie question

2005-09-15 Thread vincent
tom wright a écrit :
 Can someone tell me how I create a vector of numbers 
  where the step isn't 1?
 i.e. x-(0.0,0.5,1.0,1.5)

seq(a, b, 0.5)
?seq
hih

__
R-help@stat.math.ethz.ch 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] sequences; was: newbie question

2005-09-15 Thread Uwe Ligges
tom wright wrote:

 Can someone tell me how I create a vector of numbers where the step
 isn't 1? 
 i.e. x-(0.0,0.5,1.0,1.5)


Folks,

please read the posting guide and basic documentation!
Please use a sensible subject.

Don't know how many of therelike questions I have read today...

See ?seq

Uwe Ligges


 Thanks
 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

__
R-help@stat.math.ethz.ch 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] Graphics 'snapshots' in Linux?

2005-09-15 Thread jfontain
Quoting Tyler Smith [EMAIL PROTECTED]:

 Hi,

 I'm working on a MEPIS (Debian-based Linux) computer, using the
 emacs/ESS package to do my R work. I've got some plots that I label
 interactively using the locate function. With the Windows GUI there is
 an option to take a snapshot of the graphics output, saving it as an
 image file. Is there a way to do this with emacs/ESS?

In the graphics menu, you could use ksnapshot.

--
Jean-Luc

__
R-help@stat.math.ethz.ch 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] Splitting the string at the last sub-string

2005-09-15 Thread Tuszynski, Jaroslaw W.
Thanks for suggestions. I suspect the regexpr version will be better than
my version, since I use it to find an string towards the end of a large (up
to ~30Mb) test/XML file.

Thanks again.

Jarek
\ 
 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  \__,|  
 (703) 676-4192 \ 
 [EMAIL PROTECTED] `   \ 

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley
Sent: Thursday, September 15, 2005 10:43 AM
To: Barry Rowlingson
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Splitting the string at the last sub-string

On Thu, 15 Sep 2005, Barry Rowlingson wrote:

 Prof Brian Ripley wrote:

 substring(str, c(1, 26), c(25,length(str)))

  nchar(str) surely?

Yes, or anything larger:  I actually tested 1.

  regexps can be rather slow though. Here's two functions:

But that's not the way to do this repeatedly for the same pattern. (It is
normally compiling regexps that is slow, and regexpr is vectorized.) Not
that I would call 300us `slow'.

 byRipley =
 function(str,sub){
   lp=attr(regexpr(paste(.*,sub,sep=),str),'match.length')
   return(substring(str, c(1, lp+1), c(lp,nchar(str }

 byJarek =
 function(str,sub){
   y = unlist(strsplit(str,sub))
   return(cbind(paste(y[-length(y)], sub,  sep=, collapse = ),
 y[length(y)]))
 }

  and a quick test:

  system.time(for(i in 1:10){byJarek(str,sub)})
 [1] 15.55  0.10 16.06  0.00  0.00

  system.time(for(i in 1:10){byRipley(str,sub)})
 [1] 30.28  0.07 31.86  0.00  0.00

 Baz

 __
 R-help@stat.math.ethz.ch 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

__
R-help@stat.math.ethz.ch 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 cutree

2005-09-15 Thread Baoqiang Cao
Hi Everyone,

I'm trying to use cutree to get the clusters after hclust. What I used is: 
mycluster-cutree(cnclust,h=0.5)
Now, my problem is, how can I get the actual clusters? Thanks!

Best,
 Baoqiang Cao

__
R-help@stat.math.ethz.ch 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] Rcommander and simple chisquare

2005-09-15 Thread John Fox
Dear Christian,

From the Rcmdr menus, select Statistics - Summaries - Frequency
distributions, and check the Chisquare goodness of fit test box in the
resulting dialog. This will bring up a dialog box where you can enter
hypothesized probabilities from which expected frequencies will be
calculated.

Regards,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Christian Jost
 Sent: Thursday, September 15, 2005 5:40 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Rcommander and simple chisquare
 
 In this years biostat teaching I will include Rcommander (it 
 indeed simplifies syntax problems that makes students 
 frequently miss the core statistical problems). But I could 
 not find how to make a simple chisquare comparison between 
 observed frequencies and expected frequencies (eg in genetics 
 where you expect phenotypic frequencies corresponding to 3:1 
 in standard dominant/recessif alleles). Any idea where this 
 feature might be hidden? Or could it be added to Rcommander?
 
 Thanks, Christian.
 
 ps: in case I am not making myself clear, can Rcommander be 
 made to perform
   chisq.test(c(61,39),p=c(0.75,0.25))
 
 __
 R-help@stat.math.ethz.ch 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] Rcommander and simple chisquare

2005-09-15 Thread John Fox
Dear Christian,

From the Rcmdr menus, select Statistics - Summaries - Frequency
distributions, and check the Chisquare goodness of fit test box in the
resulting dialog. This will bring up a dialog box where you can enter
hypothesized probabilities from which expected frequencies will be
calculated.

Regards,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Christian Jost
 Sent: Thursday, September 15, 2005 5:40 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Rcommander and simple chisquare
 
 In this years biostat teaching I will include Rcommander (it 
 indeed simplifies syntax problems that makes students 
 frequently miss the core statistical problems). But I could 
 not find how to make a simple chisquare comparison between 
 observed frequencies and expected frequencies (eg in genetics 
 where you expect phenotypic frequencies corresponding to 3:1 
 in standard dominant/recessif alleles). Any idea where this 
 feature might be hidden? Or could it be added to Rcommander?
 
 Thanks, Christian.
 
 ps: in case I am not making myself clear, can Rcommander be 
 made to perform
   chisq.test(c(61,39),p=c(0.75,0.25))
 
 __
 R-help@stat.math.ethz.ch 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] Log scale in histograms

2005-09-15 Thread Jonathan Dushoff


 Can't find any information about this, but others must want to do it.

 In the example below, the second plot has the desired log scale,
 but the first does not.

 Any help appreciated.

Well, I had to solve this problem myself.  I hope that doesn't prove I
should have posted it.  I did spend a lot of time on it, both before and
after posting.

Here is a reasonable-looking histogram based on logged data:

hist(log10(area_Mh), 12, xlab=Area (Mh), main=, axes=FALSE)
axis(1, labels=formatC(10^(axTicks(1)), digits=3))
axis(2)

JD

__
R-help@stat.math.ethz.ch 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] Graphics 'snapshots' in Linux?

2005-09-15 Thread Marc Schwartz (via MN)
On Thu, 2005-09-15 at 10:43 -0400, Tyler Smith wrote:
 Hi,
 
 I'm working on a MEPIS (Debian-based Linux) computer, using the 
 emacs/ESS package to do my R work. I've got some plots that I label 
 interactively using the locate function. With the Windows GUI there is 
 an option to take a snapshot of the graphics output, saving it as an 
 image file. Is there a way to do this with emacs/ESS?
 
 Thanks,
 
 Tyler

Tyler,

Take a look at ?dev.copy2eps and on the same page dev.copy(), which
enable you to copy the current X11 plot supported output devices.

You could do something like the following for an EPS file:

plot(1:5)
text(locator(1), Place Text Here)
dev.copy2eps(file = MyPlot.eps)


or the following for a PNG file:

par(bg = white)
plot(1:5)
text(locator(1), Place Text Here)
dev.copy(device = png, file = MyPlot.png)
dev.off()


Note that in the first example, dev.off() is not required, as the EPS
output device is closed after the call.

Also, note in the second example, you will need to set the background to
white (unless already specified for whatever color you may be using), as
the default output file will have a transparent background, even though
the png() function shows the default as white. If my memory is correct
this is because the X11 device itself has a transparent background by
default and this is what is copied.

HTH,

Marc Schwartz

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


Re: [R] means comparison in R (post-hoc test)

2005-09-15 Thread Felipe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thank you, I think multcomp is very near to what I was looking for.
However, I am still looking for a mean to obtain least-squares
(adjusted) means and std. errors of these means, and performing
comparisons among these means, as the LSMEANS do in SAS. I have read
other messages and have looked at car, effects and Design manuals, but I
am not sure if this is what I am looking for. Any clue?

Felipe

Dieter Menne wrote:
| Felipe felipe at unileon.es writes:
|
|
|With the SAS/STAT, I generally used the MEANS (for comparison of
|arithmetic means) and the LSMEANS (for adjusted means) statements of the
|GLM procedure (I think it is equivalent to lm in R). They provided a lot
|of tests: LSD, Duncan, Tukey-Kramer, Bonferroni, Scheffé, SNK, etc.
|However, in R I have only discovered Tukey-HSD.
|
|
| Package multcomp with the workhorse-function simint comes close to
what you
| want.
|
|
| Dieter
|
| __
-BEGIN PGP SIGNATURE-

iEYEARECAAYFAkMpo6UACgkQWtdQtNzjBl72rwCcCuw5qxD1BWsensDI71RzhNgL
MUcAnA0Iq4tfoKSr/ymIV1nEZHZijvLW
=pavA
-END PGP 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] what's the best way to save global variables?

2005-09-15 Thread johan Faux
I am writing a kind of long program in R and I have some variables which I want 
to be globals. Where should I save them?  I was thinking to create a function 
wich initialize all the global variables and then whenever I need them, I call 
this function. 
What if I create a file glob.R with 
var1-val1
var2-val2
.
etc. 
 
How do I include this file in my other files/function . Is there in R some kind 
of   include(glob.R) or something?
thank you,
Johan


-

 Click here to donate to the Hurricane Katrina relief effort. 
[[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] Rcommander and simple chisquare

2005-09-15 Thread Christian Jost
Dear John and Philippe,

thanks for your replys, I finally  found this 
menu, but I am somewhat at a loss how I should 
enter the observed frequencies. To take my 
example below, If I enter a one-column data.frame 
with the numbers 61 and 39, John's indicated menu 
is not highlighted. If I add a second column 
containing some factor, the menu is highlighted 
by I cannot select the first column. However, if 
I edit the data and declare the first column to 
be of type 'character' I can select it in the 
menu dialog and declare the expected frequencies, 
but the chisquare output doesn't make any sense. 
For the moment I cannot make any sense of that 
:-( Any help most appreciated, or a link to the 
tutorial/faq that explains such kind of problems.

Thanks, Christian.

At 11:31 -0400 15/09/05, John Fox wrote:
Dear Philippe,

This does a chi-square test of independence in a contingency table, not a
chi-square goodness-of-fit test (which is done in the Rcmdr via Statistics
- Summaries - Frequency distribution).

Regards,
  John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox


  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of
  Philippe Grosjean
  Sent: Thursday, September 15, 2005 7:32 AM
  To: Christian Jost
  Cc: r-help@stat.math.ethz.ch
  Subject: Re: [R] Rcommander and simple chisquare

  Hello,

  Just look at Statistics - Contingency tables. There is an
  option for making the chi square test there.
  Best,

  Philippe Grosjean,

  ..°}))
) ) ) ) )
   ( ( ( ( (Prof. Philippe Grosjean
   ..

  Christian Jost wrote:
   In this years biostat teaching I will include Rcommander (it indeed
   simplifies syntax problems that makes students frequently miss the
   core statistical problems). But I could not find how to
  make a simple
   chisquare comparison between observed frequencies and expected
   frequencies (eg in genetics where you expect phenotypic frequencies
   corresponding to 3:1 in standard dominant/recessif
  alleles). Any idea
   where this feature might be hidden? Or could it be added to
   Rcommander?
  
   Thanks, Christian.
  
   ps: in case I am not making myself clear, can Rcommander be made to
   perform
  
   chisq.test(c(61,39),p=c(0.75,0.25))
  
  
__

__
R-help@stat.math.ethz.ch 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] means comparison in R (post-hoc test)

2005-09-15 Thread Liaw, Andy
Do RSiteSearch(lsmeans) and go from there.

Andy

 From: Felipe
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Thank you, I think multcomp is very near to what I was looking for.
 However, I am still looking for a mean to obtain least-squares
 (adjusted) means and std. errors of these means, and performing
 comparisons among these means, as the LSMEANS do in SAS. I have read
 other messages and have looked at car, effects and Design 
 manuals, but I
 am not sure if this is what I am looking for. Any clue?
 
 Felipe
 
 Dieter Menne wrote:
 | Felipe felipe at unileon.es writes:
 |
 |
 |With the SAS/STAT, I generally used the MEANS (for comparison of
 |arithmetic means) and the LSMEANS (for adjusted means) 
 statements of the
 |GLM procedure (I think it is equivalent to lm in R). They 
 provided a lot
 |of tests: LSD, Duncan, Tukey-Kramer, Bonferroni, Scheffé, SNK, etc.
 |However, in R I have only discovered Tukey-HSD.
 |
 |
 | Package multcomp with the workhorse-function simint comes close to
 what you
 | want.
 |
 |
 | Dieter
 |
 | __
 -BEGIN PGP SIGNATURE-
 
 iEYEARECAAYFAkMpo6UACgkQWtdQtNzjBl72rwCcCuw5qxD1BWsensDI71RzhNgL
 MUcAnA0Iq4tfoKSr/ymIV1nEZHZijvLW
 =pavA
 -END PGP 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-help@stat.math.ethz.ch 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] Rcommander and simple chisquare

2005-09-15 Thread John Fox
Dear Christian,

The Rcmdr assumes that you have a data frame with the original data, in
which the variable in question is a factor. The frequency distribution is
constructed for the factor. Thus, in your example, you'd have 100
observations classified on a two-category factor. What you enter directly
are the hypothesized probabilities.

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: Christian Jost [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 15, 2005 11:38 AM
 To: John Fox; 'Philippe Grosjean'
 Cc: r-help@stat.math.ethz.ch
 Subject: RE: [R] Rcommander and simple chisquare
 
 Dear John and Philippe,
 
 thanks for your replys, I finally  found this menu, but I am 
 somewhat at a loss how I should enter the observed 
 frequencies. To take my example below, If I enter a 
 one-column data.frame with the numbers 61 and 39, John's 
 indicated menu is not highlighted. If I add a second column 
 containing some factor, the menu is highlighted by I cannot 
 select the first column. However, if I edit the data and 
 declare the first column to be of type 'character' I can 
 select it in the menu dialog and declare the expected 
 frequencies, but the chisquare output doesn't make any sense. 
 For the moment I cannot make any sense of that :-( Any help 
 most appreciated, or a link to the tutorial/faq that explains 
 such kind of problems.
 
 Thanks, Christian.
 
 At 11:31 -0400 15/09/05, John Fox wrote:
 Dear Philippe,
 
 This does a chi-square test of independence in a contingency 
 table, not 
 a chi-square goodness-of-fit test (which is done in the Rcmdr via 
 Statistics
 - Summaries - Frequency distribution).
 
 Regards,
   John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox
 
 
   -Original Message-
   From: [EMAIL PROTECTED]  
  [mailto:[EMAIL PROTECTED] On Behalf Of  Philippe 
  Grosjean
   Sent: Thursday, September 15, 2005 7:32 AM
   To: Christian Jost
   Cc: r-help@stat.math.ethz.ch
   Subject: Re: [R] Rcommander and simple chisquare
 
   Hello,
 
   Just look at Statistics - Contingency tables. There is 
 an  option 
  for making the chi square test there.
   Best,
 
   Philippe Grosjean,
 
   ..°}))
 ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
..
 
   Christian Jost wrote:
In this years biostat teaching I will include Rcommander (it 
  indeed   simplifies syntax problems that makes students 
 frequently 
  miss the   core statistical problems). But I could not 
 find how to  
  make a simple   chisquare comparison between observed frequencies 
  and expected   frequencies (eg in genetics where you expect 
  phenotypic frequencies   corresponding to 3:1 in standard 
  dominant/recessif  alleles). Any idea   where this 
 feature might be 
  hidden? Or could it be added to   Rcommander?
   
Thanks, Christian.
   
ps: in case I am not making myself clear, can 
 Rcommander be made 
  to   perform chisq.test(c(61,39),p=c(0.75,0.25))
   
   
 __


__
R-help@stat.math.ethz.ch 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 label a plot of a tree dendrogram with text

2005-09-15 Thread Alvarez Pedro
Dear R list,

I have generated a object of class rpart in R 2.1.1
(using the wrapper function mvpart of the
mvpart-package version 1.0-1). In order to label the
plot of the tree dendrogram with text I used
text.rpart. In this function it is possible to set
the argument label to determine which values will
label the nodes. In the case of my tree-object I have
the following possibilities to chose the
label-argument:

 prunedtree2$frame[1:1,]
  varn   wt   dev yval complexity ncompete
nsurrogate   yval2.1   yval2.2   yval2.3   yval2.4
1 EST 4258 4258 377874512 113.6452  0.23990824
 1 230.56740 118.06599  78.31141  27.63598

In order to produce labels with variable n I
entered:

 plot(prunedtree2)
 text.rpart(prunedtree2,label=n)

Although I set label=n, it always produces labels
with variable dev. I tried also to set label=yval,
label=yval2.1, ... without any success, everytime it
produces labels with dev. What am I doing wrong?

Thanks, Pedro.

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


[R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Tom Colson
I have what R seems to consider a very large dataset, a 12MB text file of
lat,long,and height values, 130,000 rows to be exact. 

Here's what I get:


Thomas Colson
North Carolina State University
Department of Forestry and Environmental Resources
(919) 673 8023
[EMAIL PROTECTED]

Calendar:
www4.ncsu.edu/~tpcolson

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


[R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Tom Colson
I have what R seems to consider a very large dataset, a 12MB text file of
lat,long,and height values, 130,000 rows to be exact. 

Here's what I get:
 data1 - data.frame(read.table(BE3720078500WC20020828.txt,sep=,,
header=T))
 raw.data - as.geodata(data1)
 variog.1.b - variog(raw.data)
variog: computing omnidirectional variogram
Error in vector(double, length) : vector size specified is too large
 round(memory.limit()/1048576.0, 2)
[1] 4000



The Vector size specified is too large seems to be a common error, but I
haven't seen any workarounds posted...and the help.archive web site seems to
be down. I can plot the dataset, do some elementary stats on it...no
variogram though. 


Any ideas on how to compute variograms on datasets with 100 to 300k points? 
Thanks 

Thomas Colson
North Carolina State University
Department of Forestry and Environmental Resources
(919) 673 8023
[EMAIL PROTECTED]

Calendar:
www4.ncsu.edu/~tpcolson

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


Re: [R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Tom Colson
 
At 4 GB, I'm at the 32bit windows limit.

Thomas Colson
North Carolina State University
Department of Forestry and Environmental Resources
(919) 673 8023
[EMAIL PROTECTED]

Calendar:
www4.ncsu.edu/~tpcolson
 

-Original Message-
From: Berton Gunter [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 2:34 PM
To: 'Tom Colson'
Subject: RE: [R] Error in vector(double,length) : vector size specified is
too largeVLDs

 
 Any ideas on how to compute variograms on datasets with 100 to 300k 
 points?
 Thanks

Get more memory? ... it's cheap! :-)

-- Bert Gunter
Genentech

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


Re: [R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Tom Colson
 
 rm(data1)
 variog.1.b - variog(raw.data)
variog: computing omnidirectional variogram
Error in vector(double, length) : vector size specified is too large

Turns out I was wrong re: # of rows...it's 304,000


Same problem. Version is 2.1.1, hardware is Dual Xeon 3.6 4 GB RAM, XP Pro
64 Bit. Can reproduce the problem with 64Bit R 2.1.1 running on Fedora 4,
same hardware. 



Thomas Colson
North Carolina State University
Department of Forestry and Environmental Resources
(919) 673 8023
[EMAIL PROTECTED]

Calendar:
www4.ncsu.edu/~tpcolson
 

-Original Message-
From: Douglas Grove [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 2:23 PM
To: Tom Colson
Subject: Re: [R] Error in vector(double, length) : vector size specified
is too largeVLDs

Well you could start by removing large objects that you aren't using (e.g.
'data1') and seeing if that helps. 

There may be other suggestions but you haven't told us what platform you're
working on, as the posting guide requests:

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

Doug


On Thu, 15 Sep 2005, Tom Colson wrote:

 I have what R seems to consider a very large dataset, a 12MB text file 
 of lat,long,and height values, 130,000 rows to be exact.
 
 Here's what I get:
  data1 - data.frame(read.table(BE3720078500WC20020828.txt,sep=,,
 header=T))
  raw.data - as.geodata(data1)
  variog.1.b - variog(raw.data)
 variog: computing omnidirectional variogram Error in vector(double, 
 length) : vector size specified is too large
  round(memory.limit()/1048576.0, 2)
 [1] 4000
 
 
 
 The Vector size specified is too large seems to be a common error, 
 but I haven't seen any workarounds posted...and the help.archive web 
 site seems to be down. I can plot the dataset, do some elementary 
 stats on it...no variogram though.
 
 
 Any ideas on how to compute variograms on datasets with 100 to 300k
points? 
 Thanks
 
 Thomas Colson
 North Carolina State University
 Department of Forestry and Environmental Resources
 (919) 673 8023
 [EMAIL PROTECTED]
 
 Calendar:
 www4.ncsu.edu/~tpcolson
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


Re: [R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Peter Dalgaard
Tom Colson [EMAIL PROTECTED] writes:

  
  rm(data1)
  variog.1.b - variog(raw.data)
 variog: computing omnidirectional variogram
 Error in vector(double, length) : vector size specified is too large
 
 Turns out I was wrong re: # of rows...it's 304,000
 
 
 Same problem. Version is 2.1.1, hardware is Dual Xeon 3.6 4 GB RAM, XP Pro
 64 Bit. Can reproduce the problem with 64Bit R 2.1.1 running on Fedora 4,
 same hardware. 
 

Variograms involve the differences between all pairs of points which
can become a rather large number of values. 304000*303999/2 in your
case, about 344GB by my reckoning. And the distances between them
makes for a similar quantity.

Now, some algorithms may be smarter than to keep all values in memory,
but you haven't even told us where you got the variog() from. It
doesn't seem to be in the standard packages, although we do have
variogram() and Variogram() in spatial and nlme.

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

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


[R] Copying from graphics window in OS X

2005-09-15 Thread Chris Wiita
I'm running R from an Xterm window is OSX-Tiger.  Graphical windows 
appear as they should, but I'm having trouble copying from them--using 
cmd+c or the Copy option in the Edit menu won't place the graph in the 
clipboard (when I paste into a running OS X app, I get whatever was the 
last copied thing from a non-x11 window).  Any ideas on how to copy from 
a xterm-launched graphical window?  I can copy/paste into and out of the 
xterm command line, but I can't get anything from a graphical window.

Thanks!

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


Re: [R] Copying from graphics window in OS X

2005-09-15 Thread Sean Davis

On 9/15/05 3:14 PM, Chris Wiita [EMAIL PROTECTED] wrote:

 I'm running R from an Xterm window is OSX-Tiger.  Graphical windows
 appear as they should, but I'm having trouble copying from them--using
 cmd+c or the Copy option in the Edit menu won't place the graph in the
 clipboard (when I paste into a running OS X app, I get whatever was the
 last copied thing from a non-x11 window).  Any ideas on how to copy from
 a xterm-launched graphical window?  I can copy/paste into and out of the
 xterm command line, but I can't get anything from a graphical window.

I don't think it is possible, but I would love to be corrected.  You can
simple make a png, pdf, etc. if you want to save the graphic.

Sean

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


Re: [R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Roger Bivand
On 15 Sep 2005, Peter Dalgaard wrote:

 Tom Colson [EMAIL PROTECTED] writes:
 
   
   rm(data1)
   variog.1.b - variog(raw.data)
  variog: computing omnidirectional variogram
  Error in vector(double, length) : vector size specified is too large
  
  Turns out I was wrong re: # of rows...it's 304,000
  
  
  Same problem. Version is 2.1.1, hardware is Dual Xeon 3.6 4 GB RAM, XP Pro
  64 Bit. Can reproduce the problem with 64Bit R 2.1.1 running on Fedora 4,
  same hardware. 
  
 
 Variograms involve the differences between all pairs of points which
 can become a rather large number of values. 304000*303999/2 in your
 case, about 344GB by my reckoning. And the distances between them
 makes for a similar quantity.
 
 Now, some algorithms may be smarter than to keep all values in memory,
 but you haven't even told us where you got the variog() from. It
 doesn't seem to be in the standard packages, although we do have
 variogram() and Variogram() in spatial and nlme.

Right, this is from geoR, which uses full matrices. I think both fields 
and gstat can work with larger data sets. Whether model-based 
geostatistics is what you need for interpolating a digital elevation model 
is another question.

 
 

-- 
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] Copying from graphics window in OS X

2005-09-15 Thread Chris Wiita
I hope there is a way...at the moment an os X screen grab is the only 
way to get a quick copy. When I ran Cygwin on a PC, copying from graphic 
windows was as easy as ctrl+c--so it doesn't sound like an X11 
limitation.  I'd like to know what Cygwin was doing in the background...

Sean Davis wrote:

On 9/15/05 3:14 PM, Chris Wiita [EMAIL PROTECTED] wrote:

  

I'm running R from an Xterm window is OSX-Tiger.  Graphical windows
appear as they should, but I'm having trouble copying from them--using
cmd+c or the Copy option in the Edit menu won't place the graph in the
clipboard (when I paste into a running OS X app, I get whatever was the
last copied thing from a non-x11 window).  Any ideas on how to copy from
a xterm-launched graphical window?  I can copy/paste into and out of the
xterm command line, but I can't get anything from a graphical window.



I don't think it is possible, but I would love to be corrected.  You can
simple make a png, pdf, etc. if you want to save the graphic.

Sean


  


__
R-help@stat.math.ethz.ch 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] Coefficients from LM

2005-09-15 Thread Pablo Gonzalez
Hi everyone,

Can anyone tell me if its possibility to extract the coefficients from the
lm() command?
For instance, imagine that we have the following data set (the number of
observations for each company is actually larger than the one showed...):

Company Y   X1  X2
1   y_1 x1_1x2_1
1   y_2 x1_2x2_2
1   y_3 x1_3x2_3
(...)
2   y_4 x1_4x2_4
2   y_5 x1_5x2_5
2   y_6 x1_6x2_6
(...)
n   y_n x1_nx2_n
n   y_n1x1_n1   x2_n1
n   y_n2x1_n2   x2_n2
(...)

I need to run a regression of Y=b0+b1*X1+b2*X2 for EACH company in the
dataset and then retrieve the coefficients for each regression obtained (and
t-stats and R^2) for each company and put it in another dataset/table. The
procedure can be done easily done with a loop statement, but i need to
retrieve each individual coefficient, t-stat, R^2, etc... I know that, using
the $coefficients command will return the vector of coeffcients but I'm
having trouble to assignt it to the correct row in the final dataset.
Furthermore, I can't find any way of retrieving the R^2 and t-stats...

Thanks for any help,

Pablo.

__
R-help@stat.math.ethz.ch 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] Copying from graphics window in OS X

2005-09-15 Thread Felipe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm using R for Mac OS X Aqua GUI. It allows me to copy graphs directly,
simply with command-c.
It's pretty nice, you can give it a try.
Greetings.
Felipe

Chris Wiita wrote:
| I'm running R from an Xterm window is OSX-Tiger.  Graphical windows
| appear as they should, but I'm having trouble copying from them--using
| cmd+c or the Copy option in the Edit menu won't place the graph in the
| clipboard (when I paste into a running OS X app, I get whatever was the
| last copied thing from a non-x11 window).  Any ideas on how to copy from
| a xterm-launched graphical window?  I can copy/paste into and out of the
| xterm command line, but I can't get anything from a graphical window.
|
| Thanks!
|
| __
| R-help@stat.math.ethz.ch mailing list
| https://stat.ethz.ch/mailman/listinfo/r-help
| PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
|
|
-BEGIN PGP SIGNATURE-

iEYEARECAAYFAkMp1eYACgkQWtdQtNzjBl59JgCfV7JR8kbsbYvMQG6OVt/plNTd
1S8AnRTHe6cRrwr0mxbJJGXmdkRibDvV
=Pc3t
-END PGP 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


Re: [R] Copying from graphics window in OS X

2005-09-15 Thread Jamieson Cobleigh
You can try FreeSnap, a screen capture program for OS X:
http://www.efritz.net/software.html

Also, why are you running R from an XTerm?  There is an OS X native
version of R that might be better integrated with OS X for doing
screen captures:
   http://cran.stat.ucla.edu/bin/macosx/

Jamie

On 9/15/05, Chris Wiita [EMAIL PROTECTED] wrote:
 I'm running R from an Xterm window is OSX-Tiger.  Graphical windows
 appear as they should, but I'm having trouble copying from them--using
 cmd+c or the Copy option in the Edit menu won't place the graph in the
 clipboard (when I paste into a running OS X app, I get whatever was the
 last copied thing from a non-x11 window).  Any ideas on how to copy from
 a xterm-launched graphical window?  I can copy/paste into and out of the
 xterm command line, but I can't get anything from a graphical window.
 
 Thanks!
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Error in vector(double, length) : vector size specified is too large....VLDs

2005-09-15 Thread Tom Colson
Yes, using geoR. 

I can interpolate the DEM quite easily in Grass (v.surf.rst, kriging) and
block kriging in ArcInfo. What we need, though, is to be able to estimate
or even nail down the variogram for these data sets. Where am I going with
this? I'm guessing that variables such as slope, ruggedness, etc.. are going
to produce different sill, range, and nugget values, which I can then use to
fine tune the interpolation process, rather than using the same spline or
kriging parameters on say, a whole state boundary worth of Lidar data.  And
yes, I can estimate the variogram in ArcInfo (limited to 1 points) and
can also import the DEM from grass into R using spgrassbut the point is
to analyze the point data BEFORE I make the DEM. 

So I'm guessing the geoR isn't ever going to handle this size data, and I
need to be using gstat? (As I write this, gstat(variogram) is plugging away
for last 10 minute with no errors.)

Thanks for quick replies


Thomas Colson
North Carolina State University
Department of Forestry and Environmental Resources
(919) 673 8023
[EMAIL PROTECTED]

Calendar:
www4.ncsu.edu/~tpcolson
 

-Original Message-
From: Roger Bivand [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 3:28 PM
To: Peter Dalgaard
Cc: Tom Colson; r-help@stat.math.ethz.ch
Subject: Re: [R] Error in vector(double, length) : vector size specified
is too largeVLDs

On 15 Sep 2005, Peter Dalgaard wrote:

 Tom Colson [EMAIL PROTECTED] writes:
 
   
   rm(data1)
   variog.1.b - variog(raw.data)
  variog: computing omnidirectional variogram Error in 
  vector(double, length) : vector size specified is too large
  
  Turns out I was wrong re: # of rows...it's 304,000
  
  
  Same problem. Version is 2.1.1, hardware is Dual Xeon 3.6 4 GB RAM, 
  XP Pro
  64 Bit. Can reproduce the problem with 64Bit R 2.1.1 running on 
  Fedora 4, same hardware.
  
 
 Variograms involve the differences between all pairs of points which 
 can become a rather large number of values. 304000*303999/2 in your 
 case, about 344GB by my reckoning. And the distances between them 
 makes for a similar quantity.
 
 Now, some algorithms may be smarter than to keep all values in memory, 
 but you haven't even told us where you got the variog() from. It 
 doesn't seem to be in the standard packages, although we do have
 variogram() and Variogram() in spatial and nlme.

Right, this is from geoR, which uses full matrices. I think both fields and
gstat can work with larger data sets. Whether model-based geostatistics is
what you need for interpolating a digital elevation model is another
question.

 
 

-- 
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] Copying from graphics window in OS X

2005-09-15 Thread Jamieson Cobleigh
I just tried using Ctrl-C to do a copy a plot from a graphic window
using the Cocoa version of OS X that you can download from the link
below and I was able to paste the plot into a document.

Jamie

On 9/15/05, Jamieson Cobleigh [EMAIL PROTECTED] wrote:

 Also, why are you running R from an XTerm?  There is an OS X native
 version of R that might be better integrated with OS X for doing
 screen captures:
http://cran.stat.ucla.edu/bin/macosx/

__
R-help@stat.math.ethz.ch 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] Copying from graphics window in OS X

2005-09-15 Thread Chris Wiita
I'm connecting over SSH to a linux server to do calculations, so I need 
to be able to run the remote linux console on the Mac.

Jamieson Cobleigh wrote:

You can try FreeSnap, a screen capture program for OS X:
http://www.efritz.net/software.html

Also, why are you running R from an XTerm?  There is an OS X native
version of R that might be better integrated with OS X for doing
screen captures:
   http://cran.stat.ucla.edu/bin/macosx/

Jamie

On 9/15/05, Chris Wiita [EMAIL PROTECTED] wrote:
  

I'm running R from an Xterm window is OSX-Tiger.  Graphical windows
appear as they should, but I'm having trouble copying from them--using
cmd+c or the Copy option in the Edit menu won't place the graph in the
clipboard (when I paste into a running OS X app, I get whatever was the
last copied thing from a non-x11 window).  Any ideas on how to copy from
a xterm-launched graphical window?  I can copy/paste into and out of the
xterm command line, but I can't get anything from a graphical window.

Thanks!

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




  


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


Re: [R] Converting coordinates to actual distances

2005-09-15 Thread Jim Lemon
Paul Brewin wrote:
 Hello,
 
 I've been searching for a method of converting Lat/Lon decimal
 coordinates into actual distances between points, and taking into
 account the curvature of the earth.  Is there such a package in R?  I've
 looked at the GeoR package, but this does not seem to contain what I am
 looking for.  Ideally the output would be a triangular matrix of
 distances.  

Hi Paul,

Below is an implementation of the Haversine formula that I once had to 
use for calculating distances between telephone exchanges. It's in C, 
but could be translated to R fairly easily. I've included a degrees to 
radians conversion as well.

Jim

#define APOSTROPHE 39
#define EARTH_RADIUS 6367

typedef struct {
  char *basename;
  char *number[2];
  double lat[2];
  double lon[2];
  char delimiter[4];
  char *data02;
  char *data03;
  char *data07;
  char *data08;
  FILE *input;
  FILE *output;
} PSTS_INFO;

/* DegreesToRadians
Converts a string of the form nnndnn'nn[NSEW] to a value in radians.
East (E) and South (S) are arbitrarily negative.  Note that this routine
will generate garbage if not passed a string of the correct form, 
although it is unlikely to do too much damage.
 Return valuevalue of the string in radians
 -10 input not correct format
*/

double DegreesToRadians(char *dms) {
  int index = 0;
  double degrees;
  double minutes = 0;
  double seconds = 0;
  int mult;

  degrees = atof(dms);
  while(isdigit(dms[index])) index++;
  if(dms[index++] == 'd') {
   minutes = atof(dms[index]);
   minutes /= 60;
   while(isdigit(dms[index])) index++;
   if(dms[index++] == APOSTROPHE) {
seconds = atof(dms[index]);
seconds /= 360;
while(isdigit(dms[index])  dms[index]) index++;
if(dms[index++] == QUOTES) {
 mult = (dms[index] == 'S' || dms[index] == 'E') ? -1 : 1;
 degrees += minutes + seconds;
 return(mult * degrees * M_PI/180);
}
   }
  }
  return(-10);
}

/* GreatCircleDistance
(Formula and recommendations for calculation taken from:
http://www.census.gov/cgi-bin/geo/gisfaq?Q5.1
by Bob Chamberlain - [EMAIL PROTECTED])
Calculates 'great circle' distances using the Haversine formula,
based upon a spherical earth of EARTH_RADIUS radius.
This version extracts the two latitude/longitude pairs (as radians)
from the PSTS_INFO structure.
*/

double GreatCircleDist(PSTS_INFO *psts_info) {
  double a,d,dlon,dlat;

  dlon = psts_info-lon[1] - psts_info-lon[0];
  dlat = psts_info-lat[1] - psts_info-lat[0];
  a = pow(sin(dlat / 2),2) + cos(psts_info-lat[0]) *
   cos(psts_info-lat[1]) * pow(sin(dlon / 2),2);
  /* The penultimate result may be calculated either way - the first
  is bulletproof, the second is a bit faster */
  d = 2 * atan2(sqrt(a),sqrt(1 - a));
/* d = 2 * asin(sqrt(a));*/
  return(d * EARTH_RADIUS);
}

__
R-help@stat.math.ethz.ch 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] Coefficients from LM

2005-09-15 Thread Charles Annis, P.E.
Tsk, tsk.  You don't seem to be looking very hard.

Here's an example with a glm; lm() works the same way but has fewer internal
objects.

mod3 - glm(tree ~ altitude, family = binomial)

You can use names() to find out what's inside:

 names(mod3)
 [1] coefficients  residuals fitted.values effects
R
 [6] rank  qrfamily
linear.predictors deviance 
[11] aic   null.deviance iter  weights
prior.weights
[16] df.residual   df.null   y converged
boundary 
[21] model call  formula   terms
data 
[26] offsetcontrol   methodcontrasts
xlevels  

There are lots of ways to retrieve the parameter estimates:

 coefficients(mod3)
(Intercept)altitude 
13.43360163 -0.01220884
 
 mod3$coeff
(Intercept)altitude 
13.43360163 -0.01220884
 
 mod3$coef[2]
   altitude 
-0.01220884 

 as.numeric(mod3$coef[2])
[1] -0.01220884



Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pablo Gonzalez
Sent: Thursday, September 15, 2005 4:09 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Coefficients from LM

Hi everyone,

Can anyone tell me if its possibility to extract the coefficients from the
lm() command?
For instance, imagine that we have the following data set (the number of
observations for each company is actually larger than the one showed...):

Company Y   X1  X2
1   y_1 x1_1x2_1
1   y_2 x1_2x2_2
1   y_3 x1_3x2_3
(...)
2   y_4 x1_4x2_4
2   y_5 x1_5x2_5
2   y_6 x1_6x2_6
(...)
n   y_n x1_nx2_n
n   y_n1x1_n1   x2_n1
n   y_n2x1_n2   x2_n2
(...)

I need to run a regression of Y=b0+b1*X1+b2*X2 for EACH company in the
dataset and then retrieve the coefficients for each regression obtained (and
t-stats and R^2) for each company and put it in another dataset/table. The
procedure can be done easily done with a loop statement, but i need to
retrieve each individual coefficient, t-stat, R^2, etc... I know that, using
the $coefficients command will return the vector of coeffcients but I'm
having trouble to assignt it to the correct row in the final dataset.
Furthermore, I can't find any way of retrieving the R^2 and t-stats...

Thanks for any help,

Pablo.

__
R-help@stat.math.ethz.ch 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] Nolinear mixed-effects models (nlme)

2005-09-15 Thread Mario Fernando Cerón Muñoz
Do you send information about lactation curve analyse with no linear mixed
model, with fixed effects (herd, year season, parity) and random effects
(cow)?.
Than you very much
Mario Fernando 
 

[[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] about cutree

2005-09-15 Thread Stephen D. Weigand
On Sep 15, 2005, at 10:26 AM, Baoqiang Cao wrote:

 Hi Everyone,

 I'm trying to use cutree to get the clusters after hclust. What I used 
 is: mycluster-cutree(cnclust,h=0.5)
 Now, my problem is, how can I get the actual clusters? Thanks!

 Best,
  Baoqiang Cao

Doesn't print(mycluster) give you the clusters? You could
use something like:

R split(names(mycluster), mycluster)

You may need to better define get the actual clusters to get
a better answer.

Stephen

__
R-help@stat.math.ethz.ch 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] what's the best way to save global variables?

2005-09-15 Thread Stephen D. Weigand
Johan,

On Sep 15, 2005, at 11:39 AM, johan Faux wrote:

 I am writing a kind of long program in R and I have some variables 
 which I want to be globals. Where should I save them?  I was thinking 
 to create a function wich initialize all the global variables and then 
 whenever I need them, I call this function.

In most cases, you would write a function that would
return an object of class list, the components of
which would be the values you want to use later.
For example

myfun - function([stuff]){

  [stuff]

  return(list = (var1 = val1, var2 = val2)
}

and your call would be

glob - myfun([stuff])

and you would access val1 with

glob$var1


 What if I create a file glob.R with
 var1-val1
 var2-val2
 .
 etc.

 How do I include this file in my other files/function . Is there in R 
 some kind of   include(glob.R) or something?
 thank you,
 Johan


Use

source(glob.R)

Check out An introduction to R 
(http://cran.r-project.org/doc/manuals/R-intro.html).

Stephen

__
R-help@stat.math.ethz.ch 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] Searchable archives

2005-09-15 Thread Fiona.Evans

I cannot access the searchable archives at
www.tolstoy.newcastle.au/~rking/R.
Does anyone else have this problem?

--
Fiona H. Evans
http://www.cmis.csiro.au/Fiona.Evans


[[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] Searchable archives

2005-09-15 Thread Murray Pung
Yes, I've had the same trouble. 

Robert may be able to sort this out.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, 16 September 2005 3:34 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Searchable archives



I cannot access the searchable archives at
www.tolstoy.newcastle.au/~rking/R.
Does anyone else have this problem?

--
Fiona H. Evans
http://www.cmis.csiro.au/Fiona.Evans


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