[R] simulation

2007-05-01 Thread Thür Brigitte

Hello

I would like to simulate datasets in the following way:

x - rpois(999, 2000)
y - sum(exp(rgamma(x, scale=2, shape=0.5)))

The problem is, that by calling y I just get 1 value back and not 999 values. 
Can anyone help me? Thanks!

Brigitte








[[alternative HTML version deleted]]

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


Re: [R] bivariate normal distribution in likelihood

2007-05-01 Thread Prof Brian Ripley
On Tue, 1 May 2007, Robert A LaBudde wrote:

 At 11:32 PM 4/30/2007, Deepankar wrote:
 Hi all,

 I am trying to do a maximum likelihood estimation. In my likelihood
 function, I have to evaluate a double integral of the bivariate
 normal density over a subset of the points of the plane. For
 instance, if I denote by y the y co-ordinate and by x, the x
 co-ordinate then the area over which I have to integrate is the
 following set of points, A:
 A = {x=0  y  3x+10}

 I have used the following code to calculate this double integral:

 x - rmvnorm(10, mean=me, sigma=sig)
 c - nrow(x)
 x1 - x[ ,1]
 x2 - x[ ,2]
 e1 - as.numeric(x2  3*x1 + 10  x10)
 p1 - sum(e1)/c

 In this code, I provide the mean and covariance while drawing the
 bivariate random normal variables and get p1 as the required
 answer. The problem is that I have to draw at least 100,000
 bivariate random normals to get a reasonable answer; even then it is
 not very accurate.

 Is there some other way to do the same thing more accurately and
 more efficiently? For instance, can this be done using the bivariate
 normal distribution function pmvnorm? Also feel free to point our
 errors if you see one.

 Simple random sampling is a poor way to evaluate an integral
 (expectation). It converges on the order of 1/sqrt(N).

Which is no worse than other general schemes in high dimensions or 
without smoothness assumptions on the integrand.

 Stratified random sampling would be better, as it converges on the
 order of 1/N.

Your reference for this result, please.  (As stated it is untrue, so I 
presume the stratification scheme depends on N and there are smoothness 
assumptions.)  (BTW, the reference for the results I quote is 'Stochastic 
Simulation' (1987).)

We have not been told 'me' and 'sig', and depending on their values it is 
quite possible that importance sampling would do a great deal better than 
sampling from the specified bivariate normal.

 Even better is product Gauss-Hermite quadrature which will give a
 very accurate answer with a few dozen points.

This is a correlated bivariate normal, and product quadrature methods can 
be arbitrarily bad for such integrals (as people find out for mixed linear 
models).

What you can do is transform to a pair of uncorrelated normals, and for a 
set of the form A as given this transforms to a similar form.  And for 
that an iterated integral can be done easily as the inner integral over y 
will just be a call to pnorm.

Specifically, there is another normal z such that x and z are independent 
and y = z + a*x for some a.  Then A = {x  0  z  (3-x)*x + 10} can be 
integrated over z conditional on x and then over x.


 
 Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
 Least Cost Formulations, Ltd.URL: http://lcfltd.com/
 824 Timberlake Drive Tel: 757-467-0954
 Virginia Beach, VA 23464-3239Fax: 757-467-2947

 Vere scire est per causas scire

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


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

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


Re: [R] Perpendicular symbol in plotmath?

2007-05-01 Thread Matthew Neilson
That's fantastic, guys! Thank you very much. Paul's solution will 
definitely suffice until the perpendicular symbol is implemented in 
plotmath.


-Matt



On 1 May 2007, at 00:40, Paul Murrell wrote:

 Hi


 Matthew Neilson wrote:
 Thanks for your response, Gabor.

 That works quite nicely. The documentation states that it is not 
 possible to mix and match Hershey fonts with plotmath symbols. My 
 *ideal* scenario would be to write the
 perpendicular symbol as a subscript (specifically, I would like to 
 have  \epsilon_{\perp}  as an axis label).

 I have searched the help archive, and it turned up the following post 
 from 2002:

 http://tinyurl.com/2m8n9c

 which explains a way of faking subscripts when using the Hershey 
 fonts, though it does have several drawbacks. Have things moved on in 
 the last five years, or is this still the best
 known solution?


 Unfortunately, you still cannot use Hershey fonts with plotmath (just
 lacking implementation).

 Also, the perpendicular symbol is not implemented in plotmath (yet).

 In this case though, there may be a possible workaround.  Try the
 following ...

 plot(1, ann=FALSE)
 title(ylab=expression(epsilon[\136]), family=symbol)

 The plain text character \136 gets drawn using the symbol font and 
 the
 perpendicular symbol is character 94 (Octal 136) in the Adobe Symbol
 Encoding and in the Windows symbol font encoding so this works for PDF,
 on Windows, and on X11 (though I had to switch to a single-byte 
 encoding
 to get my system to pick up the symbol font).  The drawback with this
 solution is that anything that is NOT a special mathematical symbol in
 the expression will come out in Greek letters.

 Paul


 Many thanks for your help,


 -Matt



 On Sat Apr 28 17:35 , 'Gabor Grothendieck' [EMAIL PROTECTED] 
 sent:

 Its available in the Hershey fonts:

 plot(0, 0, type = n)
 text(0, 0, A \\pp B, vfont = c(serif, plain))


 On 4/28/07, Matthew Neilson [EMAIL PROTECTED] wrote:
 Hey,

 Does anyone know of an equivalent to the LaTeX \perp (perpendicular)
 symbol for adding to R plots? Parallel is easy enough (||), but I
 haven't been
 able to find a way of adding perpendicular. The plotmath 
 documentation
 doesn't mention how to do it, so I'm inclined to think that it 
 doesn't
 exist - but surely there must be some way of achieving the desired
 result,
 right?

 Any help will be much appreciated,


 -Matt

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


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

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



--

Matthew Neilson
University of Strathclyde
Department of Mathematics
Livingstone Tower
26 Richmond Street
Glasgow G1 1XH

Tel : + 44(0)141 548 4559
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
and provide commented, minimal, self-contained, reproducible code.


[R] Odp: simulation

2007-05-01 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 01.05.2007 09:03:46:

 
 Hello
 
 I would like to simulate datasets in the following way:
 
 x - rpois(999, 2000)
 y - sum(exp(rgamma(x, scale=2, shape=0.5)))

You computed sum of your 999 values. Regardless of how many values are 
summed the result is always only one number. Did not you want cumsum?

Regards
Petr

 
 The problem is, that by calling y I just get 1 value back and not 999 
 values. Can anyone help me? Thanks!
 
 Brigitte
 
 
 
 
 
 
 
 
[[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] simulation

2007-05-01 Thread Dimitris Rizopoulos
maybe you're looking for something like this:

x - rpois(999, 2000)
y - numeric(length(x))
for (i in seq_along(x))
 y[i] - sum(exp(rgamma(x[i], scale = 2, shape = 0.5)))


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/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
  http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Thür Brigitte [EMAIL PROTECTED]:


 Hello

 I would like to simulate datasets in the following way:

 x - rpois(999, 2000)
 y - sum(exp(rgamma(x, scale=2, shape=0.5)))

 The problem is, that by calling y I just get 1 value back and not   
 999 values. Can anyone help me? Thanks!

 Brigitte








   [[alternative HTML version deleted]]

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





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


Re: [R] thousand separator (was RE: weight)

2007-05-01 Thread Peter Dalgaard
Liaw, Andy wrote:
 Looks very neat, Gabor!  

 I just cannot fathom why anyone who want to write numerics with those
 separators in a flat file.   That's usually not for human consumption,
 and computers don't need those separators!  

 Andy
   

The world is stranger than you think...

(One of my favourite gripes is the used of localized decimal separators 
in .csv files, which used to be a perfectly well-defined data format, 
but is now nonportable across locales. Or even between programs on the 
same machine: AFAIR, SAS reads and writes the US format in all locales, 
and SPSS uses the local format...)

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


Re: [R] bivariate normal distribution in likelihood

2007-05-01 Thread Peter Dalgaard
Robert A LaBudde wrote:
 At 11:32 PM 4/30/2007, Deepankar wrote:
   
 Hi all,

 I am trying to do a maximum likelihood estimation. In my likelihood 
 function, I have to evaluate a double integral of the bivariate 
 normal density over a subset of the points of the plane. For 
 instance, if I denote by y the y co-ordinate and by x, the x 
 co-ordinate then the area over which I have to integrate is the 
 following set of points, A:
 A = {x=0  y  3x+10}

 I have used the following code to calculate this double integral:

 x - rmvnorm(10, mean=me, sigma=sig)
 c - nrow(x)
 x1 - x[ ,1]
 x2 - x[ ,2]
 e1 - as.numeric(x2  3*x1 + 10  x10)
 p1 - sum(e1)/c

 In this code, I provide the mean and covariance while drawing the 
 bivariate random normal variables and get p1 as the required 
 answer. The problem is that I have to draw at least 100,000 
 bivariate random normals to get a reasonable answer; even then it is 
 not very accurate.

 Is there some other way to do the same thing more accurately and 
 more efficiently? For instance, can this be done using the bivariate 
 normal distribution function pmvnorm? Also feel free to point our 
 errors if you see one.
 

 Simple random sampling is a poor way to evaluate an integral 
 (expectation). It converges on the order of 1/sqrt(N).

 Stratified random sampling would be better, as it converges on the 
 order of 1/N.

 Even better is product Gauss-Hermite quadrature which will give a 
 very accurate answer with a few dozen points.
   
Or, use the mvtnorm package. It has pmvnorm, which does the integrals 
over rectangular regions. You'll need a pretransformation to use it for 
the problem at hand, though (from (x,y) to (x,y-3x)).

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


Re: [R] simulation

2007-05-01 Thread Peter Dalgaard
Dimitris Rizopoulos wrote:
 maybe you're looking for something like this:

 x - rpois(999, 2000)
 y - numeric(length(x))
 for (i in seq_along(x))
  y[i] - sum(exp(rgamma(x[i], scale = 2, shape = 0.5)))

   
Or use sapply,
sapply(x, function(x) sum(exp(rgamma(x[i], scale = 2, shape = 0.5)) )

or even

replicate(999, sum(exp(rgamma(rpois(1,2000), scale = 2, shape = 0.5)) )

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


Re: [R] simulation

2007-05-01 Thread Thür Brigitte

Thats exactly what I am looking for! Thanks for your help!


-Ursprüngliche Nachricht-
Von: Peter Dalgaard [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 1. Mai 2007 11:46
An: Dimitris Rizopoulos
Cc: Thür Brigitte; r-help@stat.math.ethz.ch
Betreff: Re: [R] simulation

Dimitris Rizopoulos wrote:
 maybe you're looking for something like this:

 x - rpois(999, 2000)
 y - numeric(length(x))
 for (i in seq_along(x))
  y[i] - sum(exp(rgamma(x[i], scale = 2, shape = 0.5)))

   
Or use sapply,
sapply(x, function(x) sum(exp(rgamma(x[i], scale = 2, shape = 0.5)) )

or even

replicate(999, sum(exp(rgamma(rpois(1,2000), scale = 2, shape = 0.5)) )

*** [EMAIL PROTECTED] scanned this email for malicious content and found it to 
be 
clean ***

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


Re: [R] impossible to open SPSS file

2007-05-01 Thread Frank Thomas
David Barron gave me a good tip that I had not seen:
 Have a look at FAQ 2.16 in the R for Windows FAQ. 


Knut Krueger wrote:
 My workaround for that problem is to build the data sheet in Excel and 
 import it to SPSS and R.
 Or to export the SPSS sheet to CSV (or maybe if it is possible to 
 Excel) and import it to R
 SPSS does not externalize the data format :-(
 Regards Knut

We don't have SPSS so unfortunately this work around is not possible.

Thank you both,
Frank


-- 
..
Dr. Frank Thomas
FTR Internet Research
93110 Rosny-sous-Bois
France

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


[R] Problem with the installation of install R on Sun Solaris

2007-05-01 Thread Vipin Singhal
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by R configure 2.4.1, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure 

## - ##
## Platform. ##
## - ##

hostname = ardsass1d
uname -m = i86pc
uname -r = 5.10
uname -s = SunOS
uname -v = Generic_118855-36

/usr/bin/uname -p = i386
/bin/uname -X = System = SunOS
Node = ardsass1d
Release = 5.10
KernelID = Generic_118855-36
Machine = i86pc
BusType = unknown
Serial = unknown
Users = unknown
OEM# = 0
Origin# = 1
NumCPU = 3

/bin/arch  = i86pc
/usr/bin/arch -k   = i86pc
/usr/convex/getsysinfo = unknown
hostinfo   = unknown
/bin/machine   = unknown
/usr/bin/oslevel   = unknown
/bin/universe  = unknown

PATH: /usr/sbin
PATH: /usr/bin
PATH: /opt/sfw/bin
PATH: /usr/openwin/bin


## --- ##
## Core tests. ##
## --- ##

configure:1805: checking build system type
configure:1823: result: i386-pc-solaris2.10
configure:1831: checking host system type
configure:1845: result: i386-pc-solaris2.10
configure:2397: checking for pwd
configure:2415: found /usr/bin/pwd
configure:2428: result: /usr/bin/pwd
configure:2435: checking whether builddir is srcdir
configure:2443: result: yes
configure:2448: checking for working aclocal
configure:2452: result: found
configure:2461: checking for working autoconf
configure:2465: result: found
configure:2474: checking for working automake
configure:2478: result: found
configure:2487: checking for working autoheader
configure:2491: result: found
configure:2500: checking for working makeinfo
configure:2508: result: missing
configure:2517: checking for gawk
configure:2533: found /opt/sfw/bin/gawk
configure:2543: result: gawk
configure:2553: checking for egrep
configure:2563: result: egrep
configure:2568: checking whether ln -s works
configure:2572: result: yes
configure:2620: checking for ranlib
configure:2647: result: :
configure:2663: checking for bison
configure:2692: result: no
configure:2663: checking for byacc
configure:2692: result: no
configure:2704: checking for ar
configure:2733: result: no
configure:2756: checking for a BSD-compatible install
configure:2811: result: /opt/sfw/bin/install -c
configure:2846: checking for sed
configure:2865: found /usr/xpg4/bin/sed
configure:2877: result: /usr/xpg4/bin/sed
configure:2896: checking for less
configure:2914: found /usr/bin/less
configure:2926: result: /usr/bin/less
configure:2948: checking for perl
configure:2966: found /usr/bin/perl
configure:2978: result: /usr/bin/perl
configure:2989: checking whether perl version is at least 5.004
configure:3000: result: yes
configure:3073: checking for dvips
configure:3106: result: no
configure:3118: checking for tex
configure:3151: result: no
configure:3163: checking for latex
configure:3196: result: no
configure:3210: WARNING: you cannot build DVI versions of the R manuals
configure:3217: checking for makeindex
configure:3250: result: no
configure:3262: checking for pdftex
configure:3295: result: no
configure:3307: checking for pdflatex
configure:3340: result: no
configure:3354: WARNING: you cannot build PDF versions of the R manuals
configure:3361: checking for $(SHELL)
configure:3394: result: no
configure:3361: checking for $(top_srcdir)/tools/missing
configure:3394: result: no
configure:3361: checking for makeinfo
configure:3394: result: no
configure:3361: checking for makeinfo
configure:3394: result: no
configure:3462: checking for unzip
configure:3480: found /usr/bin/unzip
configure:3492: result: /usr/bin/unzip
configure:3507: checking for zip
configure:3525: found /usr/bin/zip
configure:3537: result: /usr/bin/zip
configure:3552: checking for gzip
configure:3570: found /usr/bin/gzip
configure:3582: result: /usr/bin/gzip
configure:3599: checking for firefox
configure:3632: result: no
configure:3599: checking for mozilla
configure:3632: result: no
configure:3599: checking for netscape
configure:3632: result: no
configure:3599: checking for galeon
configure:3632: result: no
configure:3599: checking for kfmclient
configure:3632: result: no
configure:3599: checking for opera
configure:3632: result: no
configure:3599: checking for gnome-moz-remote
configure:3632: result: no
configure:3599: checking for open
configure:3632: result: no
configure:3642: WARNING: I could not determine a browser
configure:3655: checking for acroread
configure:3688: result: no
configure:3655: checking for acroread4
configure:3688: result: no
configure:3655: checking for xpdf
configure:3673: found /opt/sfw/bin/xpdf
configure:3685: result: /opt/sfw/bin/xpdf
configure:3749: checking for gcc
configure:3778: result: no
configure:3829: checking for cc
configure:3858: result: no
configure:3871: checking for cc
configure:3917: result: no
configure:3970: checking for cl
configure:3999: result: no
configure:4013: error: no acceptable C compiler found in $PATH
See `config.log' 

Re: [R] Concepts question: environment, frame, search path

2007-05-01 Thread Duncan Murdoch
On 01/05/2007 12:29 AM, Graham Wideman wrote:
 Folks:
 
 I'd appreciate if someone could straighten me out on a few concepts which 
 are described a bit ambiguously in the docs.
 
 1.  data.frame:
 
 Refan p84: 'A data frame is a list of variables of the same length with 
 unique row names, given class data.frame.'
 
 I probably don't need to point out how opaque that is!

Which manual are you looking at?  The reference index (refman.pdf)? It 
doesn't usually include statements like that; they are usually found in 
the Introduction to R (R-intro.pdf) or the R Language Definition 
(R-lang.pdf).  But since the refman is just a collection of man pages, 
it might be in there somewhere.  And since the manuals do get updated, 
that statement may not be present in the current release.  (I did a 
quick search of the source, and couldn't spot it, but my search might 
have failed because of line breaks, strange formatting, or looking in 
the wrong place.)

By the way, it's generally best to cite the section name where you found 
a quote, because the pagination varies from system to system.  Even 
better would be to give a URL to the online HTML version at 
http://cran.r-project.org/manuals.html.

For future reference, if you are suggesting a change, it's best to cite 
the line number in the source at 
https://svn.r-project.org/R/trunk/doc/manual in the *.texi files or 
https://svn.r-project.org/R/trunk/src/library/*/man/*.Rd for man pages, 
and send such suggestions to the R-devel list.

 Anyhow, key question: Some places in the docs seem pretty firm that a 
 data.frame is basically a 2-D array with:
 a) named rows and
 b) columns whose items within a column be of uniform data type.
 
 Elsewhere, it seems like a data.frame can be a collection of arbitrary 
 variables.

The former interpretation is correct.  Since the variables all have the 
same length, things like df[i, j] make sense:  they choose the i'th 
entry from the j'th variable (according to the refan definition), or 
the i'th row, j'th column (according to the 2-D array interpretation.
 
 2. environment
 ---
 Refman p122:  Environments consist of a frame, or collection of named 
 objects, and a pointer to an enclosing environment.
 
 Is the or here explaining parenthetically that a frame is a collection of 
 named objects, or is separating too alternative structures for an 
 environment?

The former.
 
 If the former, does this imply that a frame can contain arbitrary variables?

Yes, but a frame isn't an R object, it's a concept that appears in 
descriptions, e.g. part of an environment, or the local variables 
created during function evaluation, etc.
 
 And pointer? Is that a type of thing in R?

No, there are no pointers in R.  There are a couple of tricks to fake 
them (e.g. environment objects aren't copied when assigned, you just get 
a new reference to the same environment; this allows you to construct 
something like a pointer by wrapping an object in an environment), but I 
don't recommend using these routinely.

 
 3.  R search path; attach()
 
 The R search path appears to hold the list of collections of data (my 
 term) that can be accessed by a users' commands. Refman p27 tells that 
 search path can hold items that are data.frame, list, environment or R data 
 file (on disk).  Yet R-intro p28 describes attach() as taking a directory 
 name argument.  What is the concept directory in this context?

I haven't read the preceding pages carefully, but that looks like an 
error.  The usual argument to attach is a package name, and what gets 
attached is an environment holding the exports from the package. 
Packages are stored in directories in the file system, so maybe that's 
what the author of that line had in mind.

Duncan Murdoch

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


[R] adding column to a matrix

2007-05-01 Thread raymond chiruka
l have the following dataset and would like to calculate the actual survival 
time by 
  if censoring time  survival time then actual survival time =survival time 
else its= censoring time.
treatmentgrp strata  censoringTimesurvivalTime censoring   
actualsurvivaltim
 [1,] 1  1   1.012159   1137.80922  
  0
   [2,] 2  2  32.971439   247.21786 0
   [3,] 2  1  85.758253   797.04949 0
   [4,] 1  1  16.99917178.92309 
 0
  
  l used matrix to genarate the data
  thanks in advance
  
  
   
-


[[alternative HTML version deleted]]

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


Re: [R] intersect filled.contour and polygon

2007-05-01 Thread Roger Bivand
On Mon, 30 Apr 2007, Pedro Mardones wrote:

 Dear R users;
 
 Is there any way to intersect a filled contour image and a polygon? My
 problem is that I want to create a kriging map and the boundaries of
 my map are given by the coordinates of the polygon.
 
 So far I can superompose the polygon in the filled.contour image but I
 don't know how to get rid of the contour image outside of the polygon
 boundaries.

Two possibilities seem to be present: define your polygon as a hole inside 
the bounding box of the image, with a link between the polygon and the 
bounding box, and fill it; or, perhaps better, only make kriging 
predictions for the polygon. Since you haven't given a code example, it 
isn't obvious how you are making the kriging predictions, but the choice 
of the newdata locations ought to decide - and they do not need to be a 
full grid, or even a regular grid at all.

If you need to follow this up, please consider using the R-sig-geo list.

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

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Jim Lemon
Paulo Barata wrote:
 Dear R-list members,
 
 I would like to draw a smooth arc. I can draw an arc
 parametrically, but this produces an arc too coarse,
 even allowing for different increments in sequence t
 in the example below. Function symbols (graphics) does
 produce a smooth circle, but it cannot produce an arc.
 
 Please see the following example, drawing complete circles:
 
 plot(-5:5,-5:5,type='n')
 ## draws circle with function symbols (package graphics)
 ## - inner circle is very smooth:
 symbols(0,0,circles=2,add=TRUE)
 ## draws circle parametrically - outer circle is too coarse:
 pi - 4*atan(1)
 t - seq(0,2*pi,0.02)
 lines(4*cos(t),4*sin(t))
 
 Package plotrix has a function draw.arc, but arcs produced
 with this function are also either too coarse or too polygonal,
 depending on the number of polygons used to approximate the arc.
 
 Is there a way to harness the characteristics of function
 symbols (graphics) to draw a smooth arc, not just a complete
 circle?
 
Hi Paulo,
I may be misunderstanding you, but have you tried to increase the number 
of segments in the arc using the n argument?

draw.arc(1,1,1,n=100)

Jim

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


[R] Odp: adding column to a matrix

2007-05-01 Thread Petr PIKAL
Hi

see ?ifelse

ifelse(censoringsurvival, survival, censoring)

Regards

Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 01.05.2007 13:25:18:

 l have the following dataset and would like to calculate the actual 
survival time by 
   if censoring time  survival time then actual survival time =survival 
time 
 else its= censoring time.
 treatmentgrp strata  censoringTimesurvivalTime censoring 
 
 actualsurvivaltim
  [1,] 1  1   1.012159   1137.80922 0
[2,] 2  2  32.971439   247.217860
[3,] 2  1  85.758253   797.049490
[4,] 1  1  16.99917178.92309  0
 
   l used matrix to genarate the data
   thanks in advance
 
 
 
 -
 
 
[[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Prof Brian Ripley
On Tue, 1 May 2007, Jim Lemon wrote:

 Paulo Barata wrote:
 Dear R-list members,

 I would like to draw a smooth arc. I can draw an arc
 parametrically, but this produces an arc too coarse,
 even allowing for different increments in sequence t
 in the example below. Function symbols (graphics) does
 produce a smooth circle, but it cannot produce an arc.

 Please see the following example, drawing complete circles:

 plot(-5:5,-5:5,type='n')
 ## draws circle with function symbols (package graphics)
 ## - inner circle is very smooth:
 symbols(0,0,circles=2,add=TRUE)
 ## draws circle parametrically - outer circle is too coarse:
 pi - 4*atan(1)
 t - seq(0,2*pi,0.02)
 lines(4*cos(t),4*sin(t))

 Package plotrix has a function draw.arc, but arcs produced
 with this function are also either too coarse or too polygonal,
 depending on the number of polygons used to approximate the arc.

 Is there a way to harness the characteristics of function
 symbols (graphics) to draw a smooth arc, not just a complete
 circle?

 Hi Paulo,
 I may be misunderstanding you, but have you tried to increase the number
 of segments in the arc using the n argument?

 draw.arc(1,1,1,n=100)

Put it another way, drawing arcs is not a primitive in the R graphics 
system but drawing circles is.  So there is no low-level way to draw an 
arc of a circle except via line segments.  (Quite a few graphics devices 
draw circles via line segments, but not all and vector-graphics systems 
like postscript can often do better.)


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

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


Re: [R] Independent contrasts from lme with interactions

2007-05-01 Thread Kuhn, Max
Ken,

Take a look at the just released contrast package.

Max
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ken Nussear
Sent: Monday, April 30, 2007 6:12 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Independent contrasts from lme with interactions

Hi All,

I've been searching the help archives but haven't found a workable  
solution to this problem.

I'm running an lme model with the following call:

 lme.fnl - lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID)
  anova(lme.fnl)
 numDF denDF   F-value p-value
(Intercept) 1   168 19255.389  .0001
S   1   168 5.912  0.0161
Tr  2   11615.919  .0001
Yr  1   16877.837  .0001
Tr:Yr   2   16847.584  .0001


 summary(lme.fnl)
Linear mixed-effects model fit by REML
Data: NULL
AIC  BIClogLik
   580.6991 613.5399 -281.3496

Random effects:
Formula: ~1 | TID
 (Intercept)  Residual
StdDev:   0.3697006 0.5316062

Fixed effects: Max ~ S + Tr + Yr + Tr:Yr
 Value Std.Error  DF   t-value p-value
(Intercept)  -13.5681  113.2623 168 -0.119793  0.9048
SM 0.21870.0957 168  2.284605  0.0236
TrT97   1375.5897  164.0060 116  8.387434  0.
TrT98   2890.9462  455.3497 116  6.348848  0.
Yr 0.00990.0567 168  0.174005  0.8621
TrT97:Yr  -0.68830.0821 168 -8.384798  0.
TrT98:Yr  -1.44630.2279 168 -6.347310  0.
Correlation:
  (Intr) SM TrT97  TrT98  Yr TT97:Y
SM0.067
TrT97-0.691 -0.049
TrT98-0.248 -0.001  0.171
Yr   -1.000 -0.067  0.691  0.248
TrT97:Yr  0.691  0.048 -1.000 -0.171 -0.691
TrT98:Yr  0.248  0.001 -0.171 -1.000 -0.248  0.171

Standardized Within-Group Residuals:
 Min  Q1 Med  Q3 Max
-2.19017911 -0.58108001 -0.04983642  0.57323031  2.39811353

Number of Observations: 291
Number of Groups: 119



I'm specifically interested in differences of  in the differences  
between my treatment groups (3) and Year (Yr), and importantly in the  
interaction. Normally I'm used to running independent contrast  
analysis to explore these differences, but I'm not sure how to  
extract this information using lme. Can anyone point me in the right  
direction?

Thanks

Ken






[[alternative HTML version deleted]]

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

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


Re: [R] Problem with the installation of install R on Sun Solaris

2007-05-01 Thread Prof Brian Ripley
R has a file INSTALL which asks you to read R-admin.html if you have a 
problem.  That manual explains that you need a C (preferably C99) and a 
Fortran compiler.  This extensive posting merely says that you don't have 
a C compiler in your path.  That's not something we can help you with.
(Lots of other tools are missing as well.)

On Tue, 1 May 2007, Vipin Singhal wrote:

 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.

 It was created by R configure 2.4.1, which was
 generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure

[...]

 configure:4013: error: no acceptable C compiler found in $PATH

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

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


Re: [R] thousand separator (was RE: weight)

2007-05-01 Thread John Kane

--- Liaw, Andy [EMAIL PROTECTED] wrote:

 Looks very neat, Gabor!  
 
 I just cannot fathom why anyone who want to write
 numerics with those
 separators in a flat file.   That's usually not for
 human consumption,
 and computers don't need those separators!  
 
 Andy

It' often a case of taking what you can get.  I've
seem myself taking formatted numbers from report
intended for reading and then cutting and pasting them
into a text editor.  

 From: Gabor Grothendieck
  
  That could be accomplished using a custom class
 like this:
  
  library(methods)
  setClass(num.with.junk)
  setAs(character, num.with.junk,
 function(from) as.numeric(gsub(,, , from)))
  
  
  ### test ###
  
  Input - A B
  1,000 1
  2,000 2
  3,000 3
  
  DF - read.table(textConnection(Input), header =
 TRUE,
 colClasses = c(num.with.junk, numeric))
  str(DF)
  
  
  
  On 4/30/07, Liaw, Andy [EMAIL PROTECTED]
 wrote:
   Still, though, it would be nice to have the data
 read in 
  correctly in
   the first place, instead of having to do this
 kind of 
  post-processing
   afterwards...
  
   Andy
  
   From: Bert Gunter
   
Nothing! My mistake! gsub -- not sub -- is
 what you want to
get 'em all.
   
-- Bert
   
   
Bert Gunter
Genentech Nonclinical Statistics
   
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
 Behalf Of 
  Marc Schwartz
Sent: Monday, April 30, 2007 10:18 AM
To: Bert Gunter
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE:
 weight)
   
Bert,
   
What am I missing?
   
 print(as.numeric(gsub(,, ,
 1,123,456.789)), 10)
[1] 1123456.789
   
   
FWIW, this is using:
   
R version 2.5.0 Patched (2007-04-27 r41355)
   
Marc
   
On Mon, 2007-04-30 at 10:13 -0700, Bert Gunter
 wrote:
 Except this doesn't work for 1,123,456.789
 Marc.

 I hesitate to suggest it, but gregexpr()
 will do it, as it
captures the
 position of **every** match to ,. This
 could be then used
to process the
 vector via some sort of loop/apply
 statement.

 But I think there **must** be a more elegant
 way using
regular expressions
 alone, so I, too, await a clever reply.

 -- Bert


 Bert Gunter
 Genentech Nonclinical Statistics

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On
 Behalf Of 
  Marc Schwartz
 Sent: Monday, April 30, 2007 10:02 AM
 To: Liaw, Andy
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] thousand separator (was RE:
 weight)

 One possibility would be to use something
 like the following
 post-import:

  WTPP
 [1] 1,106.8250 1,336.5138

  str(WTPP)
  Factor w/ 2 levels
 1,106.8250,1,336.5138: 1 2

  as.numeric(gsub(,, , WTPP))
 [1] 1106.825 1336.514


 Essentially strip the ',' characters from
 the factors and
then coerce
 the resultant character vector to numeric.

 HTH,

 Marc Schwartz


 On Mon, 2007-04-30 at 12:26 -0400, Liaw,
 Andy wrote:
  I've run into this occasionally.  My
 current solution is
simply to read
  it into Excel, re-format the offending
 column(s) by 
  unchecking the
  thousand separator box, and write it
 back out.  Not
exactly ideal to
  say the least.  If anyone can provide a
 better solution
in R, I'm all
  ears...
 
  Andy
 
  From: Natalie O'Toole
  
   Hi,
  
   These are the variables in my file. I
 think the
variable i'm having
   problems with is WTPP which is of the
 Factor type. Does
   anyone know how to
   fix this, please?
  
   Thanks,
  
   Nat
  
   data.frame':   290 obs. of  5 variables:
$ PROV  : num  48 48 48 48 48 48 48 48
 48 48 ...
$ REGION: num  4 4 4 4 4 4 4 4 4 4 ...
$ GRADE : num  7 7 7 7 7 7 7 7 7 7 ...
$ Y_Q10A: num  1.1 1.1 1.1 1.1 1.1 1.1
 1.1 1.1 1.1 1.1 ...
$ WTPP  : Factor w/ 1884 levels
   1,106.8250,1,336.5138,..: 1544 67
   1568 40 221 1702 1702 1434 310 310 ...
  
  
   __
  
  
  
   --- Douglas Bates [EMAIL PROTECTED]
 wrote:
  
On 4/28/07, John Kane
 [EMAIL PROTECTED] wrote:
 
=== message truncated ===

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


Re: [R] Problem with the installation of install R on Sun Solaris

2007-05-01 Thread JONATHAN BUTCHAR
Greetings.

It looks like your R config can't find your C compiler.  Do you have /
usr/ccs/bin in your path?  Or, if you installed Studio 11, do you have 
/usr/ccs/bin and /opt/SUNWspro/bin in your path?

Hope this helps,

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


Re: [R] Problem with the installation of install R on Sun Solaris

2007-05-01 Thread Peter Dalgaard
Vipin Singhal wrote:

(nothing, except for an attached file)

configure:3749: checking for gcc
configure:3778: result: no
configure:3829: checking for cc
configure:3858: result: no
configure:3871: checking for cc
configure:3917: result: no
configure:3970: checking for cl
configure:3999: result: no
configure:4013: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

Which part of this is it that you have trouble understanding?

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Ted Harding
This thread prompts me to ask about something I've
been pondering for a while, as to whether there's an
implementation somewhere ticked away in the R resources.

So far, people have been responding to the original query
in terms of increasing the numbers of points, and joining
these by lines.

However, if you're using PostScript output, you can draw
really smooth curves by exploiting PS's curveto operator.
This draws a cubic-curve segment in the following way:

The two points you want to join with a curve will be denoted
by (X0,Y0) and (X3,Y3) in the following (for reasons which
will appear). The PS command is of the form

  x1 y1  x2 y2  X3 Y3  curevto

At (X0,Y0) the tangent to the curve (as it departs from (X0,Y0)
is in the direction of the directed line from (X0,Y0) to (x1,y1),
and at (X3,Y3) (as it arrives) the tangent to the curve is
in the direction of the directed line from (x2,y3) to (X3,Y3).

The location of (X0,Y0) is not part of the command, since
it is implicit in the PS currentpoint which is the starting
point of the curve.

The result is (in theory, and in practice to within the resolution
of the output device) a perfectly smooth curve, provided the
consecutive cubic segments have the same tangent at each of
the points being joined. This can be achieved by appropriate
choice of the intermediate points -- (x1,y2), (x2,y2) above.

So far, when I've done this myself (including when using the
output from R to give the points being joined), I've done the
computation of the intermediate points by hand. This basically
involves deciding, at each of the points being joined, what the
tangent to the smooth curve shouold be.

Of course, there is an element of arbitrariness in this, unless
there is an analytic representation of the curve on which the
points lie (e.g. you're plotting sin(x)/x every pi/8, and
want to join them smoothly), when all you need is the derivatives
at the points.

Crudely, you might evaluate the direction at a point in terms
os a weighted average of the directions to its two immediate
neighbours (the nearer meghbour ges the greater weight); less
crudely, you might fit a quadratic through the point and its
2 neighbours and use the gradient at the middle point; and so on.

Once you've decided on the tangent at each point, it's then
straightforward to compute suitable intermediate points
to serve as (x1,y2) and (x2,y2).

(One application where this sort of approach is needed is in
joining computed points on iso-contours, where the individual
points have been determined by interpolation of spot-measurements
at nearby measuring stations).

Anyway. The Question: is there a general function for the
above kind of smooth curve-drawing?

With thanks,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 01-May-07   Time: 14:50:38
-- XFMail --

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


[R] Polar graph of time and tide

2007-05-01 Thread Alan E. Davis
I have been trying to visualize times of lowest tides, month by month.
 I have tide predictions with times either in unix time or a text
format, and heights in feet or meters.  I had been able to derive the
clock times of each prediction.   I would now like to graph this data
with points showing heights as r and times as theta, from  to
2355.  There is a seasonal component: I am interested in displaying
times of lowest tides in particular.

I am sure this is so simple as to burden those on the list; I however
have spent two evenings trying to figure out how to use polar.plot,
and I'm not sure that's the best way to do this.  May I request some
advice?  The docs with polar.plot are not complete, I fear.

Thank you, begging for your indulgence,

Alan

-- 
Alan Davis, Kagman High School, Saipan  [EMAIL PROTECTED]


Every great advance in natural knowledge has involved the absolute
rejection of authority.  - Thomas H. Huxley

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Greg Snow
There is the grid.xspline function in the grid package that allows for
things like this (the control points, though more general than what you
state).  I don't know if it uses the postscript curveto, or approximates
using line segments.

You can also use the xfig device, then use xfig, winfig, or jfig to
explicitly convert any polylines to xslpines, adjust any parameters of
the spline that you want, then export to other formats.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 [EMAIL PROTECTED]
 Sent: Tuesday, May 01, 2007 7:51 AM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] to draw a smooth arc
 
 This thread prompts me to ask about something I've been 
 pondering for a while, as to whether there's an 
 implementation somewhere ticked away in the R resources.
 
 So far, people have been responding to the original query in 
 terms of increasing the numbers of points, and joining these by lines.
 
 However, if you're using PostScript output, you can draw 
 really smooth curves by exploiting PS's curveto operator.
 This draws a cubic-curve segment in the following way:
 
 The two points you want to join with a curve will be denoted 
 by (X0,Y0) and (X3,Y3) in the following (for reasons which 
 will appear). The PS command is of the form
 
   x1 y1  x2 y2  X3 Y3  curevto
 
 At (X0,Y0) the tangent to the curve (as it departs from 
 (X0,Y0) is in the direction of the directed line from (X0,Y0) 
 to (x1,y1), and at (X3,Y3) (as it arrives) the tangent to the 
 curve is in the direction of the directed line from (x2,y3) 
 to (X3,Y3).
 
 The location of (X0,Y0) is not part of the command, since it 
 is implicit in the PS currentpoint which is the starting 
 point of the curve.
 
 The result is (in theory, and in practice to within the 
 resolution of the output device) a perfectly smooth curve, 
 provided the consecutive cubic segments have the same tangent 
 at each of the points being joined. This can be achieved by 
 appropriate choice of the intermediate points -- (x1,y2), 
 (x2,y2) above.
 
 So far, when I've done this myself (including when using the 
 output from R to give the points being joined), I've done the 
 computation of the intermediate points by hand. This 
 basically involves deciding, at each of the points being 
 joined, what the tangent to the smooth curve shouold be.
 
 Of course, there is an element of arbitrariness in this, 
 unless there is an analytic representation of the curve on 
 which the points lie (e.g. you're plotting sin(x)/x every 
 pi/8, and want to join them smoothly), when all you need is 
 the derivatives at the points.
 
 Crudely, you might evaluate the direction at a point in terms 
 os a weighted average of the directions to its two immediate 
 neighbours (the nearer meghbour ges the greater weight); less 
 crudely, you might fit a quadratic through the point and its
 2 neighbours and use the gradient at the middle point; and so on.
 
 Once you've decided on the tangent at each point, it's then 
 straightforward to compute suitable intermediate points
 to serve as (x1,y2) and (x2,y2).
 
 (One application where this sort of approach is needed is in 
 joining computed points on iso-contours, where the individual 
 points have been determined by interpolation of 
 spot-measurements at nearby measuring stations).
 
 Anyway. The Question: is there a general function for the 
 above kind of smooth curve-drawing?
 
 With thanks,
 Ted.
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 01-May-07   Time: 14:50:38
 -- XFMail --
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] Polar graph of time and tide

2007-05-01 Thread Earl F. Glynn
Alan E. Davis [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I have been trying to visualize times of lowest tides, month by month.
 I have tide predictions with times either in unix time or a text
 format, and heights in feet or meters.  I had been able to derive the
 clock times of each prediction.   I would now like to graph this data
 with points showing heights as r and times as theta, from  to
 2355.  There is a seasonal component: I am interested in displaying
 times of lowest tides in particular.

Does this get you started?


library(plotrix)

theta - seq(0, 23.5, by=0.5)
r - runif(length(theta), 5, 10)

clock24.plot(r, theta, main=Polar Plot)

or

clock24.plot(r, theta, main=Polar Plot, rp.type=p)


efg
Stowers Institute for Medical Research

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


[R] creating eps files

2007-05-01 Thread Tak Wing Chan
Hello,

For a long time, I have been creating eps files from R using the 
following command:

dev.copy2eps(file=my.eps)

This has worked very well. But recently, the compositor of a journal is 
complaining that

The eps files would be useable except that they have not converted the 
type to outlines

Sorry for being vague, but I have no idea what this compositor is 
talking about. Do people have similar experience? And is there an 
option in the dev.copy2eps() that I could use to fix this problem?

Many thanks for any suggestion.

Best, Wing




dept addr: Department of Sociology, University of Oxford, Manor Road, 
Oxford OX1 3UQ, UK
college addr: New College, Holywell Street, Oxford OX1 3BN, UK
dept tel: +44 (1865) 286176; college tel:  +44 (1865) 279593
http://users.ox.ac.uk/~sfos0006

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Greg Snow
Here is an approach that clips the circle you like from symbols down to
an arc (this will work as long as the arc is less than half a circle,
for arcs greater than half a circle, you could draw the whole circle
then use this to draw an arc of the bacground color over the section you
don't want):

library(TeachingDemos)
plot(-5:5, -5:5, type='n')
clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Paulo Barata
 Sent: Monday, April 30, 2007 8:17 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] to draw a smooth arc
 
 
 Dear R-list members,
 
 I would like to draw a smooth arc. I can draw an arc 
 parametrically, but this produces an arc too coarse, even 
 allowing for different increments in sequence t in the 
 example below. Function symbols (graphics) does produce a 
 smooth circle, but it cannot produce an arc.
 
 Please see the following example, drawing complete circles:
 
 plot(-5:5,-5:5,type='n')
 ## draws circle with function symbols (package graphics) ## - 
 inner circle is very smooth:
 symbols(0,0,circles=2,add=TRUE)
 ## draws circle parametrically - outer circle is too coarse:
 pi - 4*atan(1)
 t - seq(0,2*pi,0.02)
 lines(4*cos(t),4*sin(t))
 
 Package plotrix has a function draw.arc, but arcs 
 produced with this function are also either too coarse or too 
 polygonal, depending on the number of polygons used to 
 approximate the arc.
 
 Is there a way to harness the characteristics of function 
 symbols (graphics) to draw a smooth arc, not just a complete circle?
 
 I am using R 2.5.0, running under Windows XP.
 
 Thank you very much.
 
 Paulo Barata
 
 -
 Paulo Barata
 Fundacao Oswaldo Cruz (Oswaldo Cruz Foundation) Rua Leopoldo 
 Bulhoes 1480 - 8A 21041-210  Rio de Janeiro - RJ Brazil
 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
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] creating eps files

2007-05-01 Thread Prof Brian Ripley
On Tue, 1 May 2007, Tak Wing Chan wrote:

 Hello,

 For a long time, I have been creating eps files from R using the
 following command:

 dev.copy2eps(file=my.eps)

 This has worked very well. But recently, the compositor of a journal is
 complaining that

 The eps files would be useable except that they have not converted the
 type to outlines

 Sorry for being vague, but I have no idea what this compositor is
 talking about. Do people have similar experience? And is there an
 option in the dev.copy2eps() that I could use to fix this problem?

I suspect he means that he wants the fonts embedded, which is not what eps 
requires.  See the article in R-News about doing that:

http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf


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

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


Re: [R] Concepts question: environment, frame, search path

2007-05-01 Thread Prof Brian Ripley
On Tue, 1 May 2007, Duncan Murdoch wrote:

 On 01/05/2007 12:29 AM, Graham Wideman wrote:
 Folks:

 I'd appreciate if someone could straighten me out on a few concepts which
 are described a bit ambiguously in the docs.

 1.  data.frame:
 
 Refan p84: 'A data frame is a list of variables of the same length with
 unique row names, given class data.frame.'

 I probably don't need to point out how opaque that is!

 Which manual are you looking at?  The reference index (refman.pdf)? It
 doesn't usually include statements like that; they are usually found in
 the Introduction to R (R-intro.pdf) or the R Language Definition
 (R-lang.pdf).  But since the refman is just a collection of man pages,
 it might be in there somewhere.  And since the manuals do get updated,
 that statement may not be present in the current release.  (I did a
 quick search of the source, and couldn't spot it, but my search might
 have failed because of line breaks, strange formatting, or looking in
 the wrong place.)

 By the way, it's generally best to cite the section name where you found
 a quote, because the pagination varies from system to system.  Even
 better would be to give a URL to the online HTML version at
 http://cran.r-project.org/manuals.html.

 For future reference, if you are suggesting a change, it's best to cite
 the line number in the source at
 https://svn.r-project.org/R/trunk/doc/manual in the *.texi files or
 https://svn.r-project.org/R/trunk/src/library/*/man/*.Rd for man pages,
 and send such suggestions to the R-devel list.

 Anyhow, key question: Some places in the docs seem pretty firm that a
 data.frame is basically a 2-D array with:
 a) named rows and
 b) columns whose items within a column be of uniform data type.

 Elsewhere, it seems like a data.frame can be a collection of arbitrary
 variables.

 The former interpretation is correct.  Since the variables all have the
 same length, things like df[i, j] make sense:  they choose the i'th
 entry from the j'th variable (according to the refan definition), or
 the i'th row, j'th column (according to the 2-D array interpretation.

 2. environment
 ---
 Refman p122:  Environments consist of a frame, or collection of named
 objects, and a pointer to an enclosing environment.

 Is the or here explaining parenthetically that a frame is a collection of
 named objects, or is separating too alternative structures for an
 environment?

 The former.

 If the former, does this imply that a frame can contain arbitrary variables?

 Yes, but a frame isn't an R object, it's a concept that appears in
 descriptions, e.g. part of an environment, or the local variables
 created during function evaluation, etc.

 And pointer? Is that a type of thing in R?

 No, there are no pointers in R.  There are a couple of tricks to fake
 them (e.g. environment objects aren't copied when assigned, you just get
 a new reference to the same environment; this allows you to construct
 something like a pointer by wrapping an object in an environment), but I
 don't recommend using these routinely.

Nevertheless, the statement is true.  R is implemented using pointers.


 3.  R search path; attach()
 
 The R search path appears to hold the list of collections of data (my
 term) that can be accessed by a users' commands. Refman p27 tells that
 search path can hold items that are data.frame, list, environment or R data
 file (on disk).  Yet R-intro p28 describes attach() as taking a directory
 name argument.  What is the concept directory in this context?

 I haven't read the preceding pages carefully, but that looks like an
 error.  The usual argument to attach is a package name, and what gets
 attached is an environment holding the exports from the package.
 Packages are stored in directories in the file system, so maybe that's
 what the author of that line had in mind.

For the record, it is old S terminology: that document was converted from 
notes for S.  What S(-PLUS) now calls 'chapters' it used to call 
directories.

Also for the record, these documents do not have page numbers: their 
layout depends on the version of R, paper size and the tools used to 
prepare them.

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

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


[R] logrank test

2007-05-01 Thread raymond chiruka
how do l programme the logrank test. l am trying to compare 2 survival curves
  
  
   
-


[[alternative HTML version deleted]]

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


Re: [R] logrank test

2007-05-01 Thread Peter Dalgaard
raymond chiruka wrote:
 how do l programme the logrank test. l am trying to compare 2 survival curves
   
   
   
library(survival)
?survdiff

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


Re: [R] logrank test

2007-05-01 Thread Roland Rau
Hi,

On 5/1/07, raymond chiruka [EMAIL PROTECTED] wrote:

 how do l programme the logrank test. l am trying to compare 2 survival
 curves


if you simply want to use the logrank test, have a look at the first example
of the function survdiff in the survival package. If you read the help page
there, it says that the default setting of rho=0 is the log rank test.
library(survival)
survdiff(Surv(futime, fustat) ~ rx,data=ovarian)
survdiff(Surv(futime, fustat) ~ rx,data=ovarian, rho=0)

I hope this helps?

Best,
Roland

[[alternative HTML version deleted]]

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


Re: [R] logrank test

2007-05-01 Thread Marc Schwartz
On Tue, 2007-05-01 at 08:34 -0700, raymond chiruka wrote:
 how do l programme the logrank test. l am trying to compare 2 survival curves


See:

library(survival)
?survdiff

and take note of the 'rho' argument, which when set to 0 is the logrank
test.

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


[R] linout=TRUE in nnet package ?

2007-05-01 Thread sj
Hello,

I am trying to figure out what nnet does when you select nnet =TRUE, I
understand that it provides you with linear outputs, but I don't understand
how it arrives at those linear outputs. I assume that nnet still applies the
logistic function as the activation function for the nodes in the hidden
layer, but I also assume another activation function must be applied at the
output layer in order to return the predictions to the linear scale. I am
not able to figure out what is happening from the documentation, could
anyone provide more details about what nnet does at the output layer?

best,

Spencer

[[alternative HTML version deleted]]

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Prof Brian Ripley
On Tue, 1 May 2007, Greg Snow wrote:

 Here is an approach that clips the circle you like from symbols down to
 an arc (this will work as long as the arc is less than half a circle,
 for arcs greater than half a circle, you could draw the whole circle
 then use this to draw an arc of the bacground color over the section you
 don't want):

 library(TeachingDemos)
 plot(-5:5, -5:5, type='n')
 clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )

I had considered this approach: clipping a circle to a rectangle isn't 
strictly an arc, as will be clear if the line width is large.
Consider

clipplot(symbols(0, 0 ,circles=2, add=TRUE, lwd=5), c(-1,5), c(-1,5))

Note too that what happens with clipping is device-dependent.  If R's 
internal clipping is used, the part-circle is converted to a polygon.


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

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


Re: [R] logrank test

2007-05-01 Thread Roland Rau
And since Peter Dalgaard also just answered (without advertising his book):
if you (or your library) happen to have 'Introductory Statistics with R' by
Peter Dalgaard, have a look at section 12.4.

Best,
Roland

On 5/1/07, raymond chiruka [EMAIL PROTECTED] wrote:

 how do l programme the logrank test. l am trying to compare 2 survival
 curves



 -


 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


[R] Matrix column name

2007-05-01 Thread alex lam \(RI\)
Dear R users,

Having searched the mail archive I think the conclusion was that it is
not possible to have a column name when there is only one column in the
matrix. But I thought I'd check with the more experienced users.

What I tried to do was: in a loop I pick a column, record the column
name and remove the column from the matrix. But when there were 2
columns left, after one column was removed, the last column name
disappeared by default. It means that I always miss out the last column.

I tried this by hand:  

 matrix.a
801   802   803
[1,] -0.0906346 0.0906346 0.0906346
[2,] -0.0804911 0.0804911 0.0804911
[3,] -0.0703796 0.0703796 0.0703796
 matrix.a-as.matrix(matrix.a[,-1])
 matrix.a
   802   803
[1,] 0.0906346 0.0906346
[2,] 0.0804911 0.0804911
[3,] 0.0703796 0.0703796
 matrix.a-as.matrix(matrix.a[,-1])
 matrix.a
  [,1]
[1,] 0.0906346
[2,] 0.0804911
[3,] 0.0703796

Is there a way to force the column name to remain in such a case?

Thanks,
Alex

 sessionInfo()
R version 2.4.1 (2006-12-18) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics  grDevices utils datasets
methods  
[7] base 
 


Alex Lam
PhD student
Department of Genetics and Genomics
Roslin Institute (Edinburgh)
Roslin
Midlothian EH25 9PS
Great Britain

Phone +44 131 5274471
Web   http://www.roslin.ac.uk

Roslin Institute is a company limited by guarantee, registered in
Scotland (registered number SC157100) and a Scottish Charity (registered
number SC023592). Our registered office is at Roslin, Midlothian, EH25
9PS. VAT registration number 847380013.

The information contained in this e-mail (including any attachments) is
confidential and is intended for the use of the addressee only.   The
opinions expressed within this e-mail (including any attachments) are
the opinions of the sender and do not necessarily constitute those of
Roslin Institute (Edinburgh) (the Institute) unless specifically
stated by a sender who is duly authorised to do so on behalf of the
Institute

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


[R] Simulation using parts of density function

2007-05-01 Thread Thür Brigitte

Hi

My simulation with the followin R code works perfectly:
sim - replicate(999, sum(exp(rgamma(rpois(1,2000), scale = 0.5, shape = 12

But now I do not want to have values in object sim exceeding 5'000'000, that 
means that I am just using the beginning of densitiy function gamma x  15.4. 
Is there a possibility to modify my code in an easy way?

Thanks for any help!

Regards, Brigitte







[[alternative HTML version deleted]]

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


Re: [R] Matrix column name

2007-05-01 Thread Marc Schwartz
On Tue, 2007-05-01 at 18:03 +0100, alex lam (RI) wrote:
 Dear R users,
 
 Having searched the mail archive I think the conclusion was that it is
 not possible to have a column name when there is only one column in the
 matrix. But I thought I'd check with the more experienced users.
 
 What I tried to do was: in a loop I pick a column, record the column
 name and remove the column from the matrix. But when there were 2
 columns left, after one column was removed, the last column name
 disappeared by default. It means that I always miss out the last column.

See R FAQ 7.5 Why do my matrices lose dimensions:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-my-matrices-lose-dimensions_003f

which has some examples, along with ?Extract

To wit:

MAT - matrix(1:12, ncol = 3)

colnames(MAT) - LETTERS[1:3]

 MAT
 A B  C
[1,] 1 5  9
[2,] 2 6 10
[3,] 3 7 11
[4,] 4 8 12


 MAT[, 1]
[1] 1 2 3 4


 MAT[, 1, drop = FALSE]
 A
[1,] 1
[2,] 2
[3,] 3
[4,] 4


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


[R] calculating area under the ROC curve

2007-05-01 Thread John Christie
Hi,
I recently did a study where we gathered decisions and confidence  
ratings.  My understanding is that I can convert this to a ROC curve  
by getting hits and false alarms at the various confidence ratings.   
I figured out that part of the problem.  I noticed a few functions  
for calculating AUC.  Are there any preferred ones for this  
particular kind of design?

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Paulo Barata

Dr. Snow and Prof. Ripley,

Dr. Snow's suggestion, using clipplot (package TeachingDemos),
is maybe a partial solution to the problem of drawing an arc of
a circle (as long as the line width of the arc is not that large,
as pointed out by Prof. Ripley). If the arc is symmetrical around
a vertical line, then it is not so difficult to draw it that way.
But an arc that does not have this kind of symmetry would possibly
require some geometrical computations to find the proper rectangle
to be used for clipping.

I would like to suggest that in a future version of R some function
be included in the graphics package to draw smooth arcs with
given center, radius, initial and final angles. I suppose
that the basic ingredients are available in function symbols
(graphics).

Thank you very much.

Paulo Barata
(Rio de Janeiro - Brazil)

---
Prof Brian Ripley wrote:
 On Tue, 1 May 2007, Greg Snow wrote:
 
 Here is an approach that clips the circle you like from symbols down to
 an arc (this will work as long as the arc is less than half a circle,
 for arcs greater than half a circle, you could draw the whole circle
 then use this to draw an arc of the bacground color over the section you
 don't want):

 library(TeachingDemos)
 plot(-5:5, -5:5, type='n')
 clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )
 
 I had considered this approach: clipping a circle to a rectangle isn't 
 strictly an arc, as will be clear if the line width is large.
 Consider
 
 clipplot(symbols(0, 0 ,circles=2, add=TRUE, lwd=5), c(-1,5), c(-1,5))
 
 Note too that what happens with clipping is device-dependent.  If R's 
 internal clipping is used, the part-circle is converted to a polygon.
 


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


[R] sorting in barplot

2007-05-01 Thread Romain . Mayor

Hello,

I'm trying to sort my bargraph.CI plot (function like barplot in the
SCIPLOT package) by the mean of the response variable.

Does somebody have a trick for it.

Thank you.

Romain Mayor, PHD student.

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


Re: [R] sorting in barplot

2007-05-01 Thread Marc Schwartz
On Tue, 2007-05-01 at 19:33 +0200, [EMAIL PROTECTED] wrote:
 Hello,
 
 I'm trying to sort my bargraph.CI plot (function like barplot in the
 SCIPLOT package) by the mean of the response variable.
 
 Does somebody have a trick for it.
 
 Thank you.
 
 Romain Mayor, PHD student.

If it is built on top of barplot(), then by default, the factor levels
of your response variable will determine the order of the bars in the
plot.

See ?reorder.factor for more details relative to defining the order
based upon the mean of the variable. There is an example there of using
the median.

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


Re: [R] Simulation using parts of density function

2007-05-01 Thread Ted Harding
On 01-May-07 17:03:46, Thür Brigitte wrote:
 
 Hi
 
 My simulation with the followin R code works perfectly:
 sim - replicate(999, sum(exp(rgamma(rpois(1,2000),
 scale = 0.5, shape = 12
 
 But now I do not want to have values in object sim exceeding
 5'000'000, that means that I am just using the beginning of
 densitiy function gamma x  15.4. Is there a possibility to
 modify my code in an easy way?
 
 Thanks for any help!
 
 Regards, Brigitte

A somewhat extreme problem!

The easiest way to modify the code is as below -- certiainly easier
than writing a special function to draw random samples from the
truncated gamma distribution.

A bit of experimentation shows that, from your code above, about
10% of the results are = 500. So:

  sim-NULL
  remain - 999
  while(remain0){
sim0-replicate(10*remain,
   sum(exp(rgamma(rpois(1,2000), scale = 0.5, shape = 12)))
   )
sim-c(sim,sim0[sim0=500])
remain-(999 - length(sim))
  }
  sim-sim[1:999]

Results of a run:

  sum(sim500)
  [1] 0

  max(sim)
  [1] 4999696

  length(sim)
  [1] 999

It may be on the slow side (though not hugely -- on a quite slow
machine the above run was completed in 2min 5sec, while the
999-replicate in your original took 15sec. So about 8 times as long.
Most of this, of course, is taken up with the first round.

Hoping this helps,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 01-May-07   Time: 19:18:01
-- XFMail --

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


[R] Free Webinar: Vendor Neutral Intro to Data Mining for Absolute Beginners, May 23, 2007

2007-05-01 Thread Lisa Solomon
ONLINE VENDOR NEUTRAL INTRO TO DATA MINING FOR ABSOLUTE BEGINNERS
(no charge)

A non-technical data mining introduction for absolute beginners
May 23, 2007, 10AM - 11AM PST
Future Sessions (June 14, Sept 7)

To register for the webinar 
--- 
1. Go to https://salford.webex.com/salford/onstage/g.php?d=928318845t=a 
2. Click Enroll. 
3. On the registration form, enter your information and then click Submit.

Once you have registered, you will receive a confirmation email message with 
instructions on how to join the event, as well as audio and system 
requirements.  Please read this confirmation email carefully!

This one-hour webinar is a perfect place to start if you are new to data mining 
and have little-to-no background in statistics or machine learning. 

In one hour, we will discuss:

**Data basics: what kind of data is required for data mining and predictive 
analytics; In what format must the data be; what steps are necessary to prepare 
data appropriately 

**What kinds of questions can we answer with data mining

**How data mining models work: the inputs, the outputs, and the nature of the 
predictive mechanism 

**Evaluation criteria: how predictive models can be assessed and their value 
measured 

**Specific background knowledge to prepare you to begin a data mining project.

Please do not hesitate to contact me if you have any questions.

Sincerely,
Lisa Solomon
[EMAIL PROTECTED]

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Paul Murrell
Hi


Paulo Barata wrote:
 Dr. Snow and Prof. Ripley,
 
 Dr. Snow's suggestion, using clipplot (package TeachingDemos),
 is maybe a partial solution to the problem of drawing an arc of
 a circle (as long as the line width of the arc is not that large,
 as pointed out by Prof. Ripley). If the arc is symmetrical around
 a vertical line, then it is not so difficult to draw it that way.
 But an arc that does not have this kind of symmetry would possibly
 require some geometrical computations to find the proper rectangle
 to be used for clipping.
 
 I would like to suggest that in a future version of R some function
 be included in the graphics package to draw smooth arcs with
 given center, radius, initial and final angles. I suppose
 that the basic ingredients are available in function symbols
 (graphics).


Just to back up a few previous posts ...

There is something like this facility already available via the
grid.xspline() function in the grid package.  This provides very
flexible curve drawing (including curves very close to Bezier curves)
based on the X-Splines implemented in xfig.  The grid.curve() function
provides a convenience layer that allows for at least certain
parameterisations of arcs (you specify the arc end points and the angle).

These functions are built on functionality within the core graphics
engine, so exposing a similar interface (e.g., an xspline() function)
within traditional graphics would be relatively straightforward.

The core functionality draws the curves as line segments (but
automatically figures out how many segments to use so that the curve
looks smooth);  it does NOT call curve-drawing primitives in the
graphics device (like PostScript's curveto).

In summary:  there is some support for smooth curves, but we could still
benefit from a specific arc() function with the standard
centre-radius-angle parameterisation and we could also benefit from
exposing the native strengths of different graphics devices (rather than
the current lowest-common-denominator approach).

Paul


 Thank you very much.
 
 Paulo Barata
 (Rio de Janeiro - Brazil)
 
 ---
 Prof Brian Ripley wrote:
 On Tue, 1 May 2007, Greg Snow wrote:

 Here is an approach that clips the circle you like from symbols down to
 an arc (this will work as long as the arc is less than half a circle,
 for arcs greater than half a circle, you could draw the whole circle
 then use this to draw an arc of the bacground color over the section you
 don't want):

 library(TeachingDemos)
 plot(-5:5, -5:5, type='n')
 clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )
 I had considered this approach: clipping a circle to a rectangle isn't 
 strictly an arc, as will be clear if the line width is large.
 Consider

 clipplot(symbols(0, 0 ,circles=2, add=TRUE, lwd=5), c(-1,5), c(-1,5))

 Note too that what happens with clipping is device-dependent.  If R's 
 internal clipping is used, the part-circle is converted to a polygon.


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

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

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


Re: [R] Matrix column name

2007-05-01 Thread Prof Brian Ripley
You seem to be looking for matrix.a[,-1, drop = TRUE]

On Tue, 1 May 2007, alex lam (RI) wrote:

 Dear R users,

 Having searched the mail archive I think the conclusion was that it is
 not possible to have a column name when there is only one column in the
 matrix. But I thought I'd check with the more experienced users.

 What I tried to do was: in a loop I pick a column, record the column
 name and remove the column from the matrix. But when there were 2
 columns left, after one column was removed, the last column name
 disappeared by default. It means that I always miss out the last column.

And the matrix became a vector.


 I tried this by hand:

 matrix.a
801   802   803
 [1,] -0.0906346 0.0906346 0.0906346
 [2,] -0.0804911 0.0804911 0.0804911
 [3,] -0.0703796 0.0703796 0.0703796
 matrix.a-as.matrix(matrix.a[,-1])
 matrix.a
   802   803
 [1,] 0.0906346 0.0906346
 [2,] 0.0804911 0.0804911
 [3,] 0.0703796 0.0703796
 matrix.a-as.matrix(matrix.a[,-1])
 matrix.a
  [,1]
 [1,] 0.0906346
 [2,] 0.0804911
 [3,] 0.0703796

 Is there a way to force the column name to remain in such a case?

 Thanks,
 Alex

 sessionInfo()
 R version 2.4.1 (2006-12-18)
 i386-pc-mingw32

 locale:
 LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
 Kingdom.1252;LC_MONETARY=English_United
 Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

 attached base packages:
 [1] stats graphics  grDevices utils datasets
 methods
 [7] base


 
 Alex Lam
 PhD student
 Department of Genetics and Genomics
 Roslin Institute (Edinburgh)
 Roslin
 Midlothian EH25 9PS
 Great Britain

 Phone +44 131 5274471
 Web   http://www.roslin.ac.uk


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

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


[R] to calculate sums

2007-05-01 Thread Pedro Sobral

Dear R-users,

I am trying to use R to calculate sums like the ones in the file attached.
Would you please provide some help? At the moment I have no clue about how
to due...

Thank you in advance,

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


[R] dlda{supclust} 's output

2007-05-01 Thread Weiwei Shi
Hi,

I am using dlda algorithm from supclust package and I am wondering if
the output can be a continuous probability instead of discrete class
label (zero or one) since it puts some restriction on convariance
matrix, compared with lda, while the latter can.

thanks,

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

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

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


Re: [R] to draw a smooth arc

2007-05-01 Thread Paulo Barata

Dr. Murrell and all,

One final suggestion: a future function arc() in package graphics,
with centre-radius-angle parameterisation, could also include an
option to draw arrows at either end of the arc, as one can find
in function arrows().

Thank you.

Paulo Barata

---
Paul Murrell wrote:
 Hi
 
 
 Paulo Barata wrote:
 Dr. Snow and Prof. Ripley,

 Dr. Snow's suggestion, using clipplot (package TeachingDemos),
 is maybe a partial solution to the problem of drawing an arc of
 a circle (as long as the line width of the arc is not that large,
 as pointed out by Prof. Ripley). If the arc is symmetrical around
 a vertical line, then it is not so difficult to draw it that way.
 But an arc that does not have this kind of symmetry would possibly
 require some geometrical computations to find the proper rectangle
 to be used for clipping.

 I would like to suggest that in a future version of R some function
 be included in the graphics package to draw smooth arcs with
 given center, radius, initial and final angles. I suppose
 that the basic ingredients are available in function symbols
 (graphics).
 
 
 Just to back up a few previous posts ...
 
 There is something like this facility already available via the
 grid.xspline() function in the grid package.  This provides very
 flexible curve drawing (including curves very close to Bezier curves)
 based on the X-Splines implemented in xfig.  The grid.curve() function
 provides a convenience layer that allows for at least certain
 parameterisations of arcs (you specify the arc end points and the angle).
 
 These functions are built on functionality within the core graphics
 engine, so exposing a similar interface (e.g., an xspline() function)
 within traditional graphics would be relatively straightforward.
 
 The core functionality draws the curves as line segments (but
 automatically figures out how many segments to use so that the curve
 looks smooth);  it does NOT call curve-drawing primitives in the
 graphics device (like PostScript's curveto).
 
 In summary:  there is some support for smooth curves, but we could still
 benefit from a specific arc() function with the standard
 centre-radius-angle parameterisation and we could also benefit from
 exposing the native strengths of different graphics devices (rather than
 the current lowest-common-denominator approach).
 
 Paul
 
 
 Thank you very much.

 Paulo Barata
 (Rio de Janeiro - Brazil)

 ---
 Prof Brian Ripley wrote:
 On Tue, 1 May 2007, Greg Snow wrote:

 Here is an approach that clips the circle you like from symbols down to
 an arc (this will work as long as the arc is less than half a circle,
 for arcs greater than half a circle, you could draw the whole circle
 then use this to draw an arc of the bacground color over the section you
 don't want):

 library(TeachingDemos)
 plot(-5:5, -5:5, type='n')
 clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )
 I had considered this approach: clipping a circle to a rectangle isn't 
 strictly an arc, as will be clear if the line width is large.
 Consider

 clipplot(symbols(0, 0 ,circles=2, add=TRUE, lwd=5), c(-1,5), c(-1,5))

 Note too that what happens with clipping is device-dependent.  If R's 
 internal clipping is used, the part-circle is converted to a polygon.


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


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


Re: [R] to draw a smooth arc

2007-05-01 Thread Paul Murrell
Hi


Paulo Barata wrote:
 Dr. Murrell and all,
 
 One final suggestion: a future function arc() in package graphics,
 with centre-radius-angle parameterisation, could also include an
 option to draw arrows at either end of the arc, as one can find
 in function arrows().


... and in grid.xspline() and grid.curve().

Paul


 Thank you.
 
 Paulo Barata
 
 ---
 Paul Murrell wrote:
 Hi


 Paulo Barata wrote:
 Dr. Snow and Prof. Ripley,

 Dr. Snow's suggestion, using clipplot (package TeachingDemos),
 is maybe a partial solution to the problem of drawing an arc of
 a circle (as long as the line width of the arc is not that large,
 as pointed out by Prof. Ripley). If the arc is symmetrical around
 a vertical line, then it is not so difficult to draw it that way.
 But an arc that does not have this kind of symmetry would possibly
 require some geometrical computations to find the proper rectangle
 to be used for clipping.

 I would like to suggest that in a future version of R some function
 be included in the graphics package to draw smooth arcs with
 given center, radius, initial and final angles. I suppose
 that the basic ingredients are available in function symbols
 (graphics).

 Just to back up a few previous posts ...

 There is something like this facility already available via the
 grid.xspline() function in the grid package.  This provides very
 flexible curve drawing (including curves very close to Bezier curves)
 based on the X-Splines implemented in xfig.  The grid.curve() function
 provides a convenience layer that allows for at least certain
 parameterisations of arcs (you specify the arc end points and the angle).

 These functions are built on functionality within the core graphics
 engine, so exposing a similar interface (e.g., an xspline() function)
 within traditional graphics would be relatively straightforward.

 The core functionality draws the curves as line segments (but
 automatically figures out how many segments to use so that the curve
 looks smooth);  it does NOT call curve-drawing primitives in the
 graphics device (like PostScript's curveto).

 In summary:  there is some support for smooth curves, but we could still
 benefit from a specific arc() function with the standard
 centre-radius-angle parameterisation and we could also benefit from
 exposing the native strengths of different graphics devices (rather than
 the current lowest-common-denominator approach).

 Paul


 Thank you very much.

 Paulo Barata
 (Rio de Janeiro - Brazil)

 ---
 Prof Brian Ripley wrote:
 On Tue, 1 May 2007, Greg Snow wrote:

 Here is an approach that clips the circle you like from symbols down to
 an arc (this will work as long as the arc is less than half a circle,
 for arcs greater than half a circle, you could draw the whole circle
 then use this to draw an arc of the bacground color over the section you
 don't want):

 library(TeachingDemos)
 plot(-5:5, -5:5, type='n')
 clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )
 I had considered this approach: clipping a circle to a rectangle isn't 
 strictly an arc, as will be clear if the line width is large.
 Consider

 clipplot(symbols(0, 0 ,circles=2, add=TRUE, lwd=5), c(-1,5), c(-1,5))

 Note too that what happens with clipping is device-dependent.  If R's 
 internal clipping is used, the part-circle is converted to a polygon.


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

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

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


[R] Percentage area of a distribution

2007-05-01 Thread Alan Gibson
It seems like this should be pretty straight forward, but for some
reason the answer escapes me.

I have a normal distribution S made up of two normal distributions C
and C-bar. I need to find the percentage of the area of S that both C
and C-bar occupy.

Any suggestions?

Thanks in advance,
Alan Gibson

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


Re: [R] Percentage area of a distribution

2007-05-01 Thread Alan Gibson
let me amend my previous message to remove a silly mistake:

I have a (non-normal) distribution S that is a mixture of two normal
distributions C and C-bar. I need to find the percentage of the area
of S that both C and C-bar occupy.

Thanks again,
Alan Gibson

On 5/1/07, Leeds, Mark (IED) [EMAIL PROTECTED] wrote:
 What do you mean by a normal distribution made up of to normal
 distributions ? A mixture of two
 Normals with different variances doesn't result in a normal distribution
 so I'm not sure what you
 Nean but maybe someone else does. No offense intended but, if noone
 replies,
 That means that noone else understood either.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gibson
 Sent: Tuesday, May 01, 2007 8:02 PM
 To: R-help@stat.math.ethz.ch
 Subject: [R] Percentage area of a distribution

 It seems like this should be pretty straight forward, but for some
 reason the answer escapes me.

 I have a normal distribution S made up of two normal distributions C and
 C-bar. I need to find the percentage of the area of S that both C and
 C-bar occupy.

 Any suggestions?

 Thanks in advance,
 Alan Gibson

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

 This is not an offer (or solicitation of an offer) to buy/sell the 
 securities/instruments mentioned or an official confirmation.  Morgan Stanley 
 may deal as principal in or own or act as market maker for 
 securities/instruments mentioned or may advise the issuers.  This is not 
 research and is not from MS Research but it may refer to a research 
 analyst/research report.  Unless indicated, these views are the author's and 
 may differ from those of Morgan Stanley research or others in the Firm.  We 
 do not represent this is accurate or complete and we may not update this.  
 Past performance is not indicative of future returns.  For additional 
 information, research reports and important disclosures, contact me or see 
 https://secure.ms.com/servlet/cls.  You should not use e-mail to request, 
 authorize or effect the purchase or sale of any security or instrument, to 
 send transfer instructions, or to effect any other transactions.  We cannot 
 guarantee that any such requests received vi!
 a e-mail will be processed in a timely manner.  This communication is solely 
for the addressee(s) and may contain confidential information.  We do not waive 
confidentiality by mistransmission.  Contact me if you do not wish to receive 
these communications.  In the UK, this communication is directed in the UK to 
those persons who are market counterparties or intermediate customers (as 
defined in the UK Financial Services Authority's rules).


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


[R] optimising fitted distributions

2007-05-01 Thread Floris Van Ogtrop
Dear R experts,

 

I am relatively new to R and am interested in whether there is a package
which will fit data with a swag of distributions and determine the
optimal fit such as stat::fit from technical software solutions?

As is discussed in the following r-help posting goodfit in vcd seems to
do this for three of the distribution

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/37053.html, have there
been any further developments for extending this to other distributions?

 

Thanks in advanced

 

Floris

 

Floris van Ogtrop

University of Sydney

Dept. Food Agriculture and Natural Resources

Australia


[[alternative HTML version deleted]]

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


[R] ED50 from logistic model with interactions

2007-05-01 Thread Kate Stark

Hi,

I was wondering if someone could please help me. I am doing a logistic
regression to compare size at maturity between 3 seasons. My model is:

fit - glm(Mature ~ Season * Size - 1, family = binomial, data=dat)

where Mature is a binary response, 0 for immature, 1 for mature. There
are 3 Seasons.

The Season * Size interaction is significant. I would like to compare the 
size at 50% maturity between Seasons, which I have calculated as:

Mat50_S1 - -fit$coef[1]/fit$coef[4]
Mat50_S2 - -fit$coef[2]/(fit$coef[4] + fit$coef[5])
Mat50_S3 - -fit$coef[3]/(fit$coef[4] + fit$coef[6])

But I am not sure how to calculate the standard error around each of
these estimates. The p.dose function from the MASS package does this
automatically, but it doesn’t seem to allow interaction terms.

In Faraway(2006) he has an example using the delta method to calculate
the StdErr, but again without any interactions. I can apply this for the
first Season, as there is just one intercept and one slope coefficient,
but for the other 2 Seasons, the slope is a combination of the Size
coefficient and the Size*Season coefficient, and I am not sure how to use 
the covariance matrix in the delta calculation.

I could divide the data and do 3 different logistic regressions, one for
each season, but while the Mat50 (i.e. mean Size at 50% maturity) is the
same as that calculated by the separate lines regression, Im not sure how 
this may change the StdErr?

Regards,

Kate


Kate Stark | PhD Candidate
Institute of Antarctic  Southern Ocean Studies 
Tasmanian Aquaculture  Fisheries Institute
University of Tasmania
Email: kate.stark at utas.edu.au

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


Re: [R] Concepts question: environment, frame, search path

2007-05-01 Thread graham wideman
Duncan:

Thanks for taking a stab at my questions -- in following up I discovered the 
root of my difficulties -- I had not noticed document R-lang.pdf (R Language 
Definition).  This clarifies a great deal.  

FWIW, it seems to me that a number of things I was hung up on (and which you 
discussed) revolved around:

1. Confusion between frame and data.frame. R-lang.pdf has several sections 
that touch on each of these, from which it's more clear (though not explicit) 
that these are not the same things. (Problematic: frame is mentioned first, is 
a more fundamental concept, yet has no entry in the Table of Contents, while 
data.frame does have an entry). (And the converse is true of the index!).

2. Ambiguity in the docs regarding environment, frame (and also regarding 
closely-related concepts closure and enclosure).

Anyhow, I'm now in a much happier state :-).

Regarding your questions:

 1.  data.frame:
 Ref[m]an p84: 'A data frame is a list of variables of the same length with 
 unique row names, given class data.frame.'

Which manual are you looking at?  The reference index (refman.pdf)?
[...] that statement may not be present in the current release

Yes, the doc titled R: A Language and Environment for Statistical Computing 
Reference Index. This is in section I The base package, subsection 
data.frame, which was on page 84 of refman.pdf (which I downloaded yesterday, 
but now don't know where from) or on page 86 of fullrefman.pdf (downloaded 
today -- ie: current release). 

(And point understood on the suggestions about reporting doc issues -- though 
tracking them down to line numbers in the SVN is a bit optimistic, not to 
mention a moving target :-)

---

Anyhow, thanks again for the response.

Graham

---
Graham Wideman
Resources for programmable diagramming at:
http://www.diagramantics.com

Brain-related resources:
http://wideman-one.com

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


[R] the Surv function

2007-05-01 Thread Jennifer Dillon
Hi,

I'm trying to do a simple survival analysis on some data, and I'm having the
following problem (here's my code and the error message):

out - Surv(fup,event=status)
Error in Surv(fup, event = status) : argument time2 is missing, with no
default

From reading the documentation, it seems that I should be able to simply
write:  Surv(time1, event)  if my data is right-censored, which it is.
Help!

Thanks a million,

Jen



-- 
Jennifer Dillon
Doctoral Student
Harvard Biostatistics
Room 414B, Building 1

[[alternative HTML version deleted]]

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


Re: [R] the Surv function

2007-05-01 Thread Christos Hatzis
Try using the following (without naming the arguments) - it should work.

Surv(fup, status)

I think what is happening is that if you use one or two arguments (unnamed),
Surv assumes that you have right-censored data, with the first argument
being time and the second being status.  By specifying 'event' as you did,
Surv assumes that you have 3 arguments of type=counting and it is looking
for the ending time required by the counting data format and this is why you
got the error.

If you are not afraid of R code, type Surv (without the parentheses) to see
the code behind the function.

-Christos

Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Jennifer Dillon
 Sent: Tuesday, May 01, 2007 11:16 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] the Surv function
 
 Hi,
 
 I'm trying to do a simple survival analysis on some data, and 
 I'm having the following problem (here's my code and the 
 error message):
 
 out - Surv(fup,event=status)
 Error in Surv(fup, event = status) : argument time2 is 
 missing, with no default
 
 From reading the documentation, it seems that I should be able to 
 simply
 write:  Surv(time1, event)  if my data is right-censored, which it is.
 Help!
 
 Thanks a million,
 
 Jen
 
 
 
 --
 Jennifer Dillon
 Doctoral Student
 Harvard Biostatistics
 Room 414B, Building 1
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


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


[R] ? R 2.5.0 alpha bug

2007-05-01 Thread Inman, Brant A. M.D.


This email is intended to highlight 2 problems that I encountered
running R 2.5.0 alpha on a Windows XP machine.

#1 - Open script error

If I click the Open folder icon on the toolbar, R opens my script
files perfectly.  However, when I select File  Open Script 
MyFileLocation, I get a fatal error that causes R to close immediately.
This error was reproduced on 3 consecutive occasions but has been
intermittent thereafter. One of these fatal errors resulted in a typical
error reporting box being generated which I sent off.  I was not able to
verify if this error has been reported and corrected in subsequent
versions of 2.5.

#2 - Bug reporting link on CRAN website broken

I tried to report the bug listed above on the CRAN website but when I
clicked on the bug reporting link on the left-hand side panel of the
main site (http://bugs.r-project.org/cgi-bin/R) , I get an error page
with the following message:

The system encountered a fatal error 
cannot open config file /home/sfe/r-bugs/jitterbug/R : No such file or
directory
The last error code was: No such file or directory 
uid/gid=30/8 


This has been submitted to r-devel.

Brant Inman

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


[R] Warnings in package dependencies and /src contains object files.

2007-05-01 Thread Steve Su
Dear All,

 

I recently wrote a package in R and did a check on my package, all is
well except for two warnings:

 

* checking package dependencies ... WARNING

'library' or 'require' calls not declared from:

  MASS

See the information on DESCRIPTION files in the chapter 'Creating R

packages' of the 'Writing R Extensions' manual.

 

 

* checking if this is a source package ... WARNING

Subdirectory 'GLDEX/src' contains object files.

 

In my package I have only used the dataset from MASS by way of examples,
I wonder if it is customary to include all the libraries even if you
only use them as examples? 

The second warning I am not sure about, I wonder if it just means I have
more files other than the source codes in the /src folder? 

 

Thanks in advance for your comments.

 

Steve.


[[alternative HTML version deleted]]

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