Re: [R] Can't get sample function from "An Introduction to R" to work

2005-07-15 Thread David Groos
Thank you-all very much for your help, your responses and help has been 
very encouraging.  The following doesn't close the case but it tables 
it...

First I copied Ken's code into my R Console and...it worked great!  
That was baffling as it looked identical to mine.

I did not explicitly say earlier that the code I sent out I had copied 
from the console, pasted into MS Word, changed font size, then pasted 
it into the e-mail--in other words, that was a copy of one of the codes 
that didn't work.

Anyway,  I then copied the non-working, pasted it into Console, 
expecting that it would say "Error: syntax error" upon pressing the 
return key at the end of this line:
>> + tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
but it didn't!  and the code worked this time, also!
I then went about doing what I could to replicate the error from before 
and was as unsuccessful in doing that as I was in making it work, 
earlier.

>>
On Jul 15, 2005, at 4:43 PM, Peter Dalgaard wrote:

> "Bret Collier" <[EMAIL PROTECTED]> writes:
>
>> David,
>> If below is exactly what you typed, check your code again, I think you
>> are missing a '}' after the last 2 parentheses.
>
> That's not supposed to cause a syntax error, just another '+'.
(right! that's what I thought...)
> I can copy and paste the code as written and not get an error:
>
>> twosam<-function(y1, y2) {
> + n1<-length(y1);n2 <-length(y2)
> + yb1<-mean(y1); yb2<-mean(y2)
> + s1<-var(y1);s2<-var(y2)
> + s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> + tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
> + }
>>
>
> Perhaps this was the 1st time David got his typing right? The error is
> of the sort you'd get if you had
>
>  s<-((n1-1)*s1 + (n2-1)*s2/(n1+n2-2)
Interestingly enough, I did try this line when first I was trying to 
make the code work and with just 1 ")" at the end I didn't get the 
error message, but then again I wasn't able to make the whole program 
work, either.

In conclusion, I can't explain why it didn't first work time nor why I 
couldn't replicate the error.  I think I ought to e-mail the Mac R 
folks about this.

Again, Thanks,

-David

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


Re: [R] question from environmental statistics

2005-07-15 Thread Charles Annis, P.E.
?qqplot


Charles Annis, P.E.

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

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, July 15, 2005 9:03 PM
To: r-help@stat.math.ethz.ch
Subject: [R] question from environmental statistics

thanks Fran. that was useful but Im still in a fix. its a real life data
which
looks like this:
0.9
10.9
24.0
6.7
0.6
1.0
2.4
12.4
7.9
15.8
1.4
7.9
11000.0

(benzene conc. taken after WTC attacks)..its just a small chunk of data i
pasted
for you to look at.
its neither normal nor lognormal. someone told me that qq plot does help in
determining the distribution. im not sure how to get it.

can someone help me in this.

thanks



Take a look at this document by Vito Ricci:
http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf

Did you try RSiteSearch("Fit distribution") or a Google search?  That will
lead you to fit.dist{gnlm} and fitdistr{MASS}

Cheers

Francisco


>From: [EMAIL PROTECTED]
>To: r-help@stat.math.ethz.ch
>Subject: [R] question from environmental statistics
>Date: Thu, 14 Jul 2005 14:06:45 -0700
>
>
>
>Dear R users
>I want to knw if there is a way in which a raw dataset can be modelled by
>some
>distribution. besides the gof test is there any test involving gamma or
>lognormal that would fit the data.
>
>thank you
>
>-dev

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

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


[R] question from environmental statistics

2005-07-15 Thread pantd
thanks Fran. that was useful but Im still in a fix. its a real life data which
looks like this:
0.9
10.9
24.0
6.7
0.6
1.0
2.4
12.4
7.9
15.8
1.4
7.9
11000.0

(benzene conc. taken after WTC attacks)..its just a small chunk of data i pasted
for you to look at.
its neither normal nor lognormal. someone told me that qq plot does help in
determining the distribution. im not sure how to get it.

can someone help me in this.

thanks



Take a look at this document by Vito Ricci:
http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf

Did you try RSiteSearch("Fit distribution") or a Google search?  That will
lead you to fit.dist{gnlm} and fitdistr{MASS}

Cheers

Francisco


>From: [EMAIL PROTECTED]
>To: r-help@stat.math.ethz.ch
>Subject: [R] question from environmental statistics
>Date: Thu, 14 Jul 2005 14:06:45 -0700
>
>
>
>Dear R users
>I want to knw if there is a way in which a raw dataset can be modelled by
>some
>distribution. besides the gof test is there any test involving gamma or
>lognormal that would fit the data.
>
>thank you
>
>-dev

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


Re: [R] 3d scatter plot

2005-07-15 Thread Eric Hu
Hey Sundar

I guess it works indeed. I had made a stupid mistake. Thanks.

Eric
On Jul 15, 2005, at 11:24 AM, Sundar Dorai-Raj wrote:

> Hi, Eric,
>
> I plotted a surface using the first two columns as x and y and the 
> third column for z:
>
> library(lattice)
> v <- read.table("clipboard")
> names(v) <- c("x", "y", "z")
> wireframe(z ~ x * y, data = v)
>
> The result is attached. Am I missing something?
>
> Thanks,
>
> --sundar
>
> Eric Hu wrote:
>> Ok, I don't think x and y lay on a rectangle which explains why 
>> wireframe does not work. BTW, I am really new to R and maybe you can 
>> plot those data to prove that I am wrong. Thanks.
>> Eric
>> On Jul 15, 2005, at 10:56 AM, Sundar Dorai-Raj wrote:
>>>
>>>
>>> Eric Hu wrote:
>>>
 Hi, I ran into a dilemma trying to plot the following data in a 3d 
 scatter fashion. My data are not always increasing as persp() 
 expects. For now I use scatterplot3d to get points in a 3d scatter 
 plot. I wonder if I have any way to plot the surfaces. Thanks!
 Eric
 sample data
 -0.50 0.40 1.281
 -0.50 0.45 1.795
 -0.50 0.50 1.766
 -0.40 0.35 1.595
 -0.40 0.40 1.388
 -0.40 0.45 2.344
 -0.40 0.50 2.179
 -0.30 0.35 1.792
 -0.30 0.40 2.349
 -0.30 0.45 1.682
 -0.30 0.50 1.493
 -0.20 0.35 1.836
 -0.20 0.40 2.186
 -0.20 0.45 1.863
 -0.20 0.50 1.775
 -0.10 0.25 2.991
 -0.10 0.30 2.426
 -0.10 0.35 1.954
 -0.10 0.40 1.136
 -0.10 0.45 1.438
 -0.10 0.50 1.429
 -0.05 0.30 2.163
 -0.05 0.35 1.953
 -0.05 0.40 1.672
 -0.05 0.45 1.688
 -0.05 0.50 1.963
>>>
>>>
>>>
>>> ?wireframe in the lattice package may help.
>>>
>>> --sundar
>>>
>>>
>>>
> 

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


[R] R on HP-UX

2005-07-15 Thread Cruz, Alfredo
Have any successfully compiled R on HP-UX 11iv2?  I was able to compile R
2.0.1 successfully but kept getting memory fault error when I ran the gmake
check:
gmake check
gmake[1]: Entering directory `/opt/R-2.0.1/tests'
gmake[2]: Entering directory `/opt/R-2.0.1/tests'
gmake[3]: Entering directory `/opt/R-2.0.1/tests/Examples'
gmake[4]: Entering directory `/opt/R-2.0.1/tests/Examples'
gmake[4]: `Makedeps' is up to date.
gmake[4]: Leaving directory `/opt/R-2.0.1/tests/Examples'
gmake[4]: Entering directory `/opt/R-2.0.1/tests/Examples'
running code in 'base-Ex.R' .../bin/sh: 17586 Memory fault(coredump)
gmake[4]: *** [base-Ex.Rout] Error 1
gmake[4]: Leaving directory `/opt/R-2.0.1/tests/Examples'
gmake[3]: *** [test-Examples-Base] Error 2
gmake[3]: Leaving directory `/opt/R-2.0.1/tests/Examples'
gmake[2]: *** [test-Examples] Error 2
gmake[2]: Leaving directory `/opt/R-2.0.1/tests'
gmake[1]: *** [test-all-basics] Error 1
gmake[1]: Leaving directory `/opt/R-2.0.1/tests'
gmake: *** [check] Error 2
 
I tried compiling newer versions of R but kept getting linking errors.  Any
suggestions is appreciated.
 
Thanks,
 
Alfredo
 


This e-mail message (and any attachments) may contain confidential and/or
privileged information for the sole use of the intended recipient. Any
review or distribution by anyone other than the person for whom it was
originally intended is strictly prohibited. If you have received this e-mail
in error, please contact the sender and delete all copies. Opinions,
conclusions or other information contained in this e-mail may not be that of
the organization. 



[[alternative HTML version deleted]]

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


Re: [R] Can't get sample function from "An Introduction to R" to work

2005-07-15 Thread Peter Dalgaard
"Bret Collier" <[EMAIL PROTECTED]> writes:

> David,
> If below is exactly what you typed, check your code again, I think you
> are missing a '}' after the last 2 parentheses.

That's not supposed to cause a syntax error, just another '+'.
I can copy and paste the code as written and not get an error:

> twosam<-function(y1, y2) {
+ n1<-length(y1);n2 <-length(y2)
+ yb1<-mean(y1); yb2<-mean(y2)
+ s1<-var(y1);s2<-var(y2)
+ s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
+ tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
+ }
>

Perhaps this was the 1st time David got his typing right? The error is
of the sort you'd get if you had 

 s<-((n1-1)*s1 + (n2-1)*s2/(n1+n2-2)

or

 tst<-(yb1-yb2)/sqrt(s*1/n1+1/n2))

 
> HTH,
> Bret
> 
> >>> David Groos <[EMAIL PROTECTED]> 7/15/2005 3:40:01 PM >>>
> I'm trying to figure out R, a piece at a time, hours at a time...  I 
> was trying to copy the sample function in, "An Introduction to R"  (for
> 
> version 2.1.0) by W. N. Venables, D. M. Smith, page 42.  Section 10.1 
> "Simple examples" provides a sample function which I tried to duplicate
> 
> (I'm using Mac OS X 10.3.9, and "R for Mac OS X Aqua GUI v1.11).  The 
> following is what I typed and the last line is R's response when I hit
> 
> the return key after the penultimate line.  I've re-checked and 
> re-typed the code many times to no avail.  I wasn't able to find this 
> issue using search options, either.  Any help is GREATLY appreciated!
> 
>  > twosam<-function(y1, y2) {
> + n1<-length(y1);n2 <-length(y2)
> + yb1<-mean(y1); yb2<-mean(y2)
> + s1<-var(y1);s2<-var(y2)
> + s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> + tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
> Error: syntax error
> 


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

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


[R] rmpi in windows

2005-07-15 Thread Uzuner, Tolga
Hi Folks,
Has anyone been able to get rmpi to work under windows ?
Thanks,
Tolga

Please follow the attached hyperlink to an important disclaimer




==
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

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


Re: [R] Can't get sample function from "An Introduction to R" to work

2005-07-15 Thread Spencer Graves
  Also, are you doing this with a version of R that will allow you to 
keep your scripts in separate files and run them one line at a time? 
Rgui allows this, and many people use different editors, e.g, XEmacs 
with ESS ("EMacs Speaks Statistics").  Some editors (like ESS) help with 
parentheses matching, which makes it easier to catch errors like this. 
When that fails, I define the necessary variables and work through the 
function line by line until I find the problem.

  spencer graves

Bret Collier wrote:

> David,
> If below is exactly what you typed, check your code again, I think you
> are missing a '}' after the last 2 parentheses.
> 
> HTH,
> Bret
> 
> 
David Groos <[EMAIL PROTECTED]> 7/15/2005 3:40:01 PM >>>
> 
> I'm trying to figure out R, a piece at a time, hours at a time...  I 
> was trying to copy the sample function in, "An Introduction to R"  (for
> 
> version 2.1.0) by W. N. Venables, D. M. Smith, page 42.  Section 10.1 
> "Simple examples" provides a sample function which I tried to duplicate
> 
> (I'm using Mac OS X 10.3.9, and "R for Mac OS X Aqua GUI v1.11).  The 
> following is what I typed and the last line is R's response when I hit
> 
> the return key after the penultimate line.  I've re-checked and 
> re-typed the code many times to no avail.  I wasn't able to find this 
> issue using search options, either.  Any help is GREATLY appreciated!
> 
>  > twosam<-function(y1, y2) {
> + n1<-length(y1);n2 <-length(y2)
> + yb1<-mean(y1); yb2<-mean(y2)
> + s1<-var(y1);s2<-var(y2)
> + s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> + tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
> Error: syntax error
> 
> David
>   [[alternative text/enriched version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help 
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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

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


Re: [R] Newbie guide for plot & graphics functions?

2005-07-15 Thread Don MacQueen
Significant goof in my first message. Here is the corrected version:

x <- 1:10
y <- 1:15
z <- outer(x,y)
image(x,y,z)

xb <- c(.5,x+.5)
yb <- c(.5,y+.5)
image(xb,yb,z)  ## xb, ybNOTx, y

Fortunately, corrected one also succeeds.

-Don

At 8:06 AM -0700 7/15/05, Don MacQueen wrote:
>I think you have it backwards (the error message not withstanding).
>Read the documentation for image, note the beginning of the Details
>section, and then compare these two examples, both of which succeed
>on my system (R 2.1.1).
>
>x <- 1:10
>y <- 1:15
>z <- outer(x,y)
>image(x,y,z)
>
>xb <- c(.5,x+.5)
>yb <- c(.5,y+.5)
>image(x,y,z)
>
>x and y provide either the centers of the cells, or the boundaries of
>the cells. In the latter case, the lengths of x and y should be 1
>greater than the dim of z, not one less.
>
>(I'm including my full version info to be complete, but I doubt that
>you problem has to do with your platform [OS]).
>
>-Don
>
>>   version
>   _  
>platform powerpc-apple-darwin7.9.0
>arch powerpc
>os   darwin7.9.0
>system   powerpc, darwin7.9.0   
>status  
>major2  
>minor1.1
>year 2005   
>month06 
>day  20 
>language R  
>
>
>At 7:23 AM -0700 7/15/05, Pete Cap wrote:
>>Hello all,
>>
>>Can anyone point me to a decent introduction to using the plotting
>>and assorted graphics functions in R?
>>
>>I keep getting simple errrors and I can't figure out why, for example:
>>
>>>   image(x,y,z)
>>Error in image.default(x, y, z) : dimensions of z are not
>>length(x)(+1) times length(y)(+1)
>>>   length(x)
>>[1] 206
>>>   length(y)
>>[1] 40
>>>   dim(z)
>>[1] 207  41
>>
>>
>>It seems to me as if R is wrong--the matrix z is obviously of
>>length(x)+1 times length(y)+1--but just as obviously I'm missing
>>something essential.  Are there any "newbie" guides out there for
>>getting started?
>>TIA,
>>
>>Pete
>>
>>
>>
>>-
>>
>>
>>  [[alternative HTML version deleted]]
>>
>>__
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>--
>--
>Don MacQueen
>Environmental Protection Department
>Lawrence Livermore National Laboratory
>Livermore, CA, USA
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

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


Re: [R] Can't get sample function from "An Introduction to R" to work

2005-07-15 Thread Marc Schwartz (via MN)
On Fri, 2005-07-15 at 15:40 -0500, David Groos wrote:
> I'm trying to figure out R, a piece at a time, hours at a time...  I 
> was trying to copy the sample function in, "An Introduction to R"  (for 
> version 2.1.0) by W. N. Venables, D. M. Smith, page 42.  Section 10.1 
> "Simple examples" provides a sample function which I tried to duplicate 
> (I'm using Mac OS X 10.3.9, and "R for Mac OS X Aqua GUI v1.11).  The 
> following is what I typed and the last line is R's response when I hit 
> the return key after the penultimate line.  I've re-checked and 
> re-typed the code many times to no avail.  I wasn't able to find this 
> issue using search options, either.  Any help is GREATLY appreciated!
> 
>  > twosam<-function(y1, y2) {
> + n1<-length(y1);n2 <-length(y2)
> + yb1<-mean(y1); yb2<-mean(y2)
> + s1<-var(y1);s2<-var(y2)
> + s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> + tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
> Error: syntax error
> 
> David

The code as you have above (without the "+" on each line) works for me
both in ESS and in the R console under Linux. There should be another
"+" on the next line, in anticipation of the remaining two lines:

 tst
}


Try to copy and paste the following into the console as is:

twosam<-function(y1, y2) {
 n1 <- length(y1);n2 <- length(y2)
 yb1 <- mean(y1); yb2 <- mean(y2)
 s1 <- var(y1);s2 <- var(y2)
 s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
 tst <- (yb1-yb2)/sqrt(s*(1/n1+1/n2))

and see what happens. You should be left at a:

+

on a new line again.

It is possible that there is a bug in the Aqua GUI, but not using a Mac,
I cannot replicate it.

You might want to consider subscribing and posting to the R-SIG-Mac
e-mail list, which is focused on Mac users of R. More information is
here:

https://stat.ethz.ch/mailman/listinfo/r-sig-mac

HTH,

Marc Schwartz

P.S. Greetings from Eden Prairie

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


Re: [R] Can't get sample function from "An Introduction to R" to work

2005-07-15 Thread Bret Collier
David,
If below is exactly what you typed, check your code again, I think you
are missing a '}' after the last 2 parentheses.

HTH,
Bret

>>> David Groos <[EMAIL PROTECTED]> 7/15/2005 3:40:01 PM >>>
I'm trying to figure out R, a piece at a time, hours at a time...  I 
was trying to copy the sample function in, "An Introduction to R"  (for

version 2.1.0) by W. N. Venables, D. M. Smith, page 42.  Section 10.1 
"Simple examples" provides a sample function which I tried to duplicate

(I'm using Mac OS X 10.3.9, and "R for Mac OS X Aqua GUI v1.11).  The 
following is what I typed and the last line is R's response when I hit

the return key after the penultimate line.  I've re-checked and 
re-typed the code many times to no avail.  I wasn't able to find this 
issue using search options, either.  Any help is GREATLY appreciated!

 > twosam<-function(y1, y2) {
+ n1<-length(y1);n2 <-length(y2)
+ yb1<-mean(y1); yb2<-mean(y2)
+ s1<-var(y1);s2<-var(y2)
+ s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
+ tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
Error: syntax error

David
[[alternative text/enriched version deleted]]

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

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


[R] Can't get sample function from "An Introduction to R" to work

2005-07-15 Thread David Groos
I'm trying to figure out R, a piece at a time, hours at a time...  I 
was trying to copy the sample function in, "An Introduction to R"  (for 
version 2.1.0) by W. N. Venables, D. M. Smith, page 42.  Section 10.1 
"Simple examples" provides a sample function which I tried to duplicate 
(I'm using Mac OS X 10.3.9, and "R for Mac OS X Aqua GUI v1.11).  The 
following is what I typed and the last line is R's response when I hit 
the return key after the penultimate line.  I've re-checked and 
re-typed the code many times to no avail.  I wasn't able to find this 
issue using search options, either.  Any help is GREATLY appreciated!

 > twosam<-function(y1, y2) {
+ n1<-length(y1);n2 <-length(y2)
+ yb1<-mean(y1); yb2<-mean(y2)
+ s1<-var(y1);s2<-var(y2)
+ s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
+ tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
Error: syntax error

David
[[alternative text/enriched version deleted]]

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


Re: [R] pdf() black&white; panel titles in lattice

2005-07-15 Thread Deepayan Sarkar
On 7/15/05, Chuck Cleland <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> > Thank you so much for your help. Now I think I can use R for
> > everything I need so far. However I think that I haven't found
> > a solution for my first question. trellis.device(color=F) only
> > affects the trellis device, but not the pdf device, doesn´t
> > it? At least that is my impression. I manage to get black and
> > white graphics in trellis, but whenever I switch on the pdf
> > device, the resulting pdf file is in color, even if I specify
> >  pdf(X.pdf, bg="white", fg="black") (I wonder what the use of
> > bg and fg is). The thing is that I need black and white
> > graphics for my papers. I am using R on OSX. Does this happen
> > to anyone else?
> 
> Call trellis.device() after pdf() and use new=FALSE in trellis.device().
> 
> pdf("c:/myfolder/myfigures.pdf")
> trellis.device(new=FALSE, col=FALSE)

That will work too, but the intended usage of trellis.device as a
wrapper for any device, including pdf. E.g.,

trellis.device(pdf, file = "foo.pdf", color = FALSE) 

Deepayan

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


Re: [R] pdf() black&white; panel titles in lattice

2005-07-15 Thread Chuck Cleland
[EMAIL PROTECTED] wrote:
> Thank you so much for your help. Now I think I can use R for
> everything I need so far. However I think that I haven't found
> a solution for my first question. trellis.device(color=F) only
> affects the trellis device, but not the pdf device, doesn´t
> it? At least that is my impression. I manage to get black and
> white graphics in trellis, but whenever I switch on the pdf
> device, the resulting pdf file is in color, even if I specify
>  pdf(X.pdf, bg="white", fg="black") (I wonder what the use of
> bg and fg is). The thing is that I need black and white
> graphics for my papers. I am using R on OSX. Does this happen
> to anyone else?

Call trellis.device() after pdf() and use new=FALSE in trellis.device().

pdf("c:/myfolder/myfigures.pdf")
trellis.device(new=FALSE, col=FALSE)

> Thanks again 
> 
>  Original message 
> 
>>Date: Fri, 15 Jul 2005 12:16:36 -0500
>>From: Deepayan Sarkar <[EMAIL PROTECTED]>  
>>Subject: Re: [R] pdf() black&white; panel titles in lattice  
>>To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>>Cc: r-help@stat.math.ethz.ch
>>
>>On 7/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>
>>>Hello,
>>>
>>>I have two questions:
>>>
>>>1. How can I get black and white graphics using the pdf()
>>>device? I have tried pdf(Name.pdf, bg="white", fg"black"), but
>>>I still get  full-color graphics.
>>
>>See ?trellis.device, specifically the 'color' argument.
>>
>>
>>>2. When using lattice, how do I change the title for each
>>>panel?  By default it uses the categories of the grouping
>>>factor. I would like to modify the labels in the graphic
>>>without changing the data. 
>>
>>See the entry for 'strip' in ?xyplot, as well as
> 
> ?strip.default. For
> 
>>one conditioning variable this can be as simple as
>>
>>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>>   strip = strip.custom(factor.levels = c("I. setosa", 
>> "I. versicolor", "I.
> 
> verginica")))
> 
>>or 
>>
>>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>>   strip = strip.custom(factor.levels = 
>>   expression(italic("I. setosa"), 
>>italic("I. versicolor"), 
>>italic("I. verginica"
>>
>>
>>
>>>Also, how do I add a title above
>>>the graphic referring to this factor (not the main title of
>>>the graph)? The title for the xlab refers to the independent
>>>factor within each panel. I would like to explain what each
>>>panel represents with something similar to xlab, this title
>>>being above the graphic if possible.
>>
>>You may be satisfied with 
>>
>>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>> strip = strip.custom(strip.names = TRUE))
>>
>>If not, use the 'key' argument (described in ?xyplot).
>>
>>Deepayan
> 
> Francisco Torreira
> Spanish, Italian and Portuguese
> Univ. of Illinois at Urbana-Champaign
> 707 South Mathews Aven.
> 4031 FLB
> Urbana, IL, 61801
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

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


[R] Cannot update some packages after upgrade to 2.1.1

2005-07-15 Thread Kevin E. Thorpe
I just upgraded to version 2.1.1 (from 2.0.1) today.

 > R.version
  _
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor1.1
year 2005
month06
day  20
language R

I am using SuSE 9.2 and did the upgrade using rpm -U with the RPM
available on CRAN.  After upgrading r-base, I ran update.packages().
Four previously installed packages failed to update:

Matrix (0.95-5 to 0.97-4)
gam (0.93 to 0.94)
lme4 (0.95-3 to 0.96-1)
mgcv (1.3-1 to 1.3-4)

In the case of Matrix, gam and mgcv I get the message:

[long path]/ld: cannot find -lf77blas

In the case of lme4 the messages are:

** preparing package for lazy loading
Error in setMethod("coef", signature(object = "lmList"), function(object,  :
 no existing definition for function 'coef'
Error: unable to load R code in package 'lme4'
Execution halted
ERROR: lazy loading failed for package 'lme4'

I have searched the SuSE repository for any package that provides
f77blas but came up empty.

I also could not identify any relevant messages in the mailing list
archives.

Is R looking for that library because it was present on the machine
the RPM was built on?  Would building R myself solve the missing library
problem or did I do something wrong?

-- 
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Department of Public Health Sciences
Faculty of Medicine, University of Toronto
email: [EMAIL PROTECTED]  Tel: 416.946.8081  Fax: 416.971.2462

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


Re: [R] 3d scatter plot

2005-07-15 Thread Sundar Dorai-Raj


Eric Hu wrote:
> Hi, I ran into a dilemma trying to plot the following data in a 3d 
> scatter fashion. My data are not always increasing as persp() expects. 
> For now I use scatterplot3d to get points in a 3d scatter plot. I 
> wonder if I have any way to plot the surfaces. Thanks!
> 
> Eric
> 
> 
> sample data
> 
> -0.50 0.40 1.281
> -0.50 0.45 1.795
> -0.50 0.50 1.766
> -0.40 0.35 1.595
> -0.40 0.40 1.388
> -0.40 0.45 2.344
> -0.40 0.50 2.179
> -0.30 0.35 1.792
> -0.30 0.40 2.349
> -0.30 0.45 1.682
> -0.30 0.50 1.493
> -0.20 0.35 1.836
> -0.20 0.40 2.186
> -0.20 0.45 1.863
> -0.20 0.50 1.775
> -0.10 0.25 2.991
> -0.10 0.30 2.426
> -0.10 0.35 1.954
> -0.10 0.40 1.136
> -0.10 0.45 1.438
> -0.10 0.50 1.429
> -0.05 0.30 2.163
> -0.05 0.35 1.953
> -0.05 0.40 1.672
> -0.05 0.45 1.688
> -0.05 0.50 1.963
> 


?wireframe in the lattice package may help.

--sundar

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


Re: [R] pdf() black&white; panel titles in lattice

2005-07-15 Thread ftorrei2
Thank you so much for your help. Now I think I can use R for
everything I need so far. However I think that I haven't found
a solution for my first question. trellis.device(color=F) only
affects the trellis device, but not the pdf device, doesn´t
it? At least that is my impression. I manage to get black and
white graphics in trellis, but whenever I switch on the pdf
device, the resulting pdf file is in color, even if I specify
 pdf(X.pdf, bg="white", fg="black") (I wonder what the use of
bg and fg is). The thing is that I need black and white
graphics for my papers. I am using R on OSX. Does this happen
to anyone else?

Thanks again 

 Original message 
>Date: Fri, 15 Jul 2005 12:16:36 -0500
>From: Deepayan Sarkar <[EMAIL PROTECTED]>  
>Subject: Re: [R] pdf() black&white; panel titles in lattice  
>To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>Cc: r-help@stat.math.ethz.ch
>
>On 7/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Hello,
>> 
>> I have two questions:
>> 
>> 1. How can I get black and white graphics using the pdf()
>> device? I have tried pdf(Name.pdf, bg="white", fg"black"), but
>> I still get  full-color graphics.
>
>See ?trellis.device, specifically the 'color' argument.
>
>> 2. When using lattice, how do I change the title for each
>> panel?  By default it uses the categories of the grouping
>> factor. I would like to modify the labels in the graphic
>> without changing the data. 
>
>See the entry for 'strip' in ?xyplot, as well as
?strip.default. For
>one conditioning variable this can be as simple as
>
>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>strip = strip.custom(factor.levels = c("I. setosa", 
>  "I. versicolor", "I.
verginica")))
>
>or 
>
>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>strip = strip.custom(factor.levels = 
>expression(italic("I. setosa"), 
> italic("I. versicolor"), 
> italic("I. verginica"
>
>
>> Also, how do I add a title above
>> the graphic referring to this factor (not the main title of
>> the graph)? The title for the xlab refers to the independent
>> factor within each panel. I would like to explain what each
>> panel represents with something similar to xlab, this title
>> being above the graphic if possible.
>
>You may be satisfied with 
>
>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>  strip = strip.custom(strip.names = TRUE))
>
>If not, use the 'key' argument (described in ?xyplot).
>
>Deepayan
Francisco Torreira
Spanish, Italian and Portuguese
Univ. of Illinois at Urbana-Champaign
707 South Mathews Aven.
4031 FLB
Urbana, IL, 61801

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


[R] 3d scatter plot

2005-07-15 Thread Eric Hu
Hi, I ran into a dilemma trying to plot the following data in a 3d 
scatter fashion. My data are not always increasing as persp() expects. 
For now I use scatterplot3d to get points in a 3d scatter plot. I 
wonder if I have any way to plot the surfaces. Thanks!

Eric


sample data

-0.50 0.40 1.281
-0.50 0.45 1.795
-0.50 0.50 1.766
-0.40 0.35 1.595
-0.40 0.40 1.388
-0.40 0.45 2.344
-0.40 0.50 2.179
-0.30 0.35 1.792
-0.30 0.40 2.349
-0.30 0.45 1.682
-0.30 0.50 1.493
-0.20 0.35 1.836
-0.20 0.40 2.186
-0.20 0.45 1.863
-0.20 0.50 1.775
-0.10 0.25 2.991
-0.10 0.30 2.426
-0.10 0.35 1.954
-0.10 0.40 1.136
-0.10 0.45 1.438
-0.10 0.50 1.429
-0.05 0.30 2.163
-0.05 0.35 1.953
-0.05 0.40 1.672
-0.05 0.45 1.688
-0.05 0.50 1.963

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


[R] 2D contour predictions

2005-07-15 Thread Michael Hopkins


Hi All

I have been fitting regression models and would now like to produce some
contour & image plots from the predictors.

Is there an easy way to do this?  My current (newbie) experience with R
would suggest there is but that it's not always easy to find it!

f3 <- lm( fc ~ poly( speed, 2 ) + poly( torque, 2 ) + poly( sonl, 2 ) +
poly( p_rail, 2 ) + poly( pil_sep, 2 ) + poly( maf, 2 ) + (speed + torque +
sonl + p_rail + pil_sep + maf)^2 )

hat <- predict( f3 )

contour( sonl, maf, hat )

Error in contour.default(sonl, maf, hat) :
increasing 'x' and 'y' values expected

image(sonl, maf, hat)

Error in image.default(sonl, maf, hat) : increasing 'x' and 'y' values
expected

I have tried naïve sorting but no luck with that.

I suspect I may need to produce a data grid of some kind but I'm not clear
how I would use R to specify such a 2D slice in the 6D design space.

TIA

Michael

P.S.  Whilst I'm asking the list - is there an easier way of expressing a
full 2nd order model than the one I used above?  I'm sure there is but
finding it etc etc...


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

_/_/   _/_/_/ Hopkins Research Ltd
   _/_/   _/_/
  _/_/_/_/   _/_/_/  http://www.hopkins-research.com/
 _/_/   _/   _/
_/_/   _/ _/   'touch the future'
   
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

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


Re: [R] pdf() black&white; panel titles in lattice

2005-07-15 Thread Deepayan Sarkar
On 7/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I have two questions:
> 
> 1. How can I get black and white graphics using the pdf()
> device? I have tried pdf(Name.pdf, bg="white", fg"black"), but
> I still get  full-color graphics.

See ?trellis.device, specifically the 'color' argument.

> 2. When using lattice, how do I change the title for each
> panel?  By default it uses the categories of the grouping
> factor. I would like to modify the labels in the graphic
> without changing the data. 

See the entry for 'strip' in ?xyplot, as well as ?strip.default. For
one conditioning variable this can be as simple as

xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
strip = strip.custom(factor.levels = c("I. setosa", 
  "I. versicolor", "I. verginica")))

or 

xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
strip = strip.custom(factor.levels = 
expression(italic("I. setosa"), 
 italic("I. versicolor"), 
 italic("I. verginica"


> Also, how do I add a title above
> the graphic referring to this factor (not the main title of
> the graph)? The title for the xlab refers to the independent
> factor within each panel. I would like to explain what each
> panel represents with something similar to xlab, this title
> being above the graphic if possible.

You may be satisfied with 

xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
  strip = strip.custom(strip.names = TRUE))

If not, use the 'key' argument (described in ?xyplot).

Deepayan

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


Re: [R] Passing character strings from C code to R

2005-07-15 Thread Prof Brian Ripley
Why invent your own function to do the same thing as the builtin 
one mkString?

Please discuss C programming questions on the R-devel list *as the posting 
guide asks*

On Fri, 15 Jul 2005, mkondrin wrote:

> Tuszynski, Jaroslaw W. wrote:
>
>> Hi,
>>
>> I have a C code which produces array of integers and potentially a string,
>> and I have problems passing the string out. Here is the relevant part of the
>> code:
>>
>> 1   PROTECT(Ret = allocVector(INTSXP, n));
>> 2   ret = (int*) INTEGER(Ret);  /* get pointer to R's Ret */
>> 3   for(i=0; i> 4   Free(data);
>> 5   i=1;
>> 6   if (comment) { // comment was found
>> 7 n = strlen(comment);
>> 8 if(n>0) {// and it actually have some length
>> 9Rprintf(" '%s' %i\n", comment, n);
>> 10   PROTECT(Str = allocString(n+1));
>> 11   str = CHAR(STRING_ELT(Str, 0));
>> 12   strcpy(str, comment);
>> 13   Rprintf(" '%s' %i\n", str, n);
>> 14   setAttrib(Ret, install("comm"), Str);
>> 15   i=2;
>> 16 }
>> 17 Free(comment);
>> 18   }
>> 20   UNPROTECT(i);
>>
>> Print statement in line 9 gives right results, but program crashes before
>> print statement in line 13.
>> Any ideas to what am I doing wrong?
>>
>> Jarek
>> =\
>> Jarek Tuszynski, PhD.   o / \
>> Science Applications International Corporation  <\__,|
>> (703) 676-4192">  \
>> [EMAIL PROTECTED]   `\
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
>>
> SEXP charToSexp(char * val) {
>  USER_OBJECT_ ans;
>  PROTECT(ans = NEW_CHARACTER(1));
>  if(val)
>  SET_STRING_ELT(ans, 0, COPY_TO_USER_STRING(val));
>  UNPROTECT(1);
>
>  return(ans);
> }
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

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


[R] [R-pkgs] new package: elliptic

2005-07-15 Thread Robin Hankin
Hi

I recently uploaded package "elliptic" to CRAN.  From the DESCRIPTION  
file, it is:


A suite of elliptic and related functions including
Weierstrass and Jacobi forms.  Also includes various
tools for manipulating and visualizing complex
functions.



enjoy

rksh

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

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


[R] New RVTK package is available for download and testing.

2005-07-15 Thread mkondrin
Hello!
I have just completed R-language binding for VTK library from Kitware.
The library is used for 3D modelling and data visualization. RVTK
allows you to do that sort of things in R-session. Because RVTK is in
quite an alpha stage it is not yet on CRAN and can be downloaded from my
homepage: www.hppi.troitsk.ru/Kondrin/rvtk.htm . The link to the
tarball is on the bottom of page after a long introduction (if you are
intended to use RVTK better do read it).

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


[R] nlme and spatially correlated errors

2005-07-15 Thread Patricia Balvanera
Dear R users,

I am using lme and nlme to account for spatially correlated errors as 
random effects. My basic question is about being able to correct F, p, R2 
and parameters of models that do not take into account the nature of such 
errors using gls, glm or nlm and replace them for new F, p, R2 and 
parameters using lme and nlme as random effects.

I am studying distribution patterns of 50 tree species along a gradient. 
That gradient
was sampled through 27 transects, with 10 plots within each transect. For 
each plot I
have data on presence/absence, abundance and basal area of the species. I 
also have data
for 4 environmental variables related to water availability (soil water 
retention
capacity, slope, insolation, altitude) and X and Y coordinates for each 
plot. I explored
wether the relationship between any of the response variables 
(presence/absence,
abundance, basal area) and the environmental variables was linear, 
polinomial, or
non-linear.

My main interest in this question is that I proceeded to correct for spatial
autocorrelation (both within transects and overall) following the 
procedures suggest by
Crawley 2002 for linear models
e.g. (GUAMAC = a species, CRAS = soil water retention capacity, TRANSECTO = 
transect)
 > model1<-gls(GUAMAC ~ CRAS)
 > model2<-lme(GUAMAC ~ CRAS, random = ~ 1 | TRANSECTO)
 > model3<-lme(GUAMAC ~ CRAS, random = GUAMAC ~ CRAS | TRANSECTO)
 > model4<-lme(GUAMAC ~ CRAS, random = GUAMAC ~ CRAS -1 | TRANSECTO)
 > AIC(model1,model2,model3,model4)
df AIC
model1 3 3730.537
model2 4 3698.849
model3 6 3702.408
model4 4 3704.722
 > plot(Variogram(model2, form = ~ X + Y))
 > model5<-update(model2,corr=corSpher(c(30,0.8), form = ~ X + Y, nugget = T))
 > plot(Variogram(modelo7, resType = "n"))
 > summary(model5)

In this case I obtain new F for the independent variable INSOLACION, new R2 
for the whole model and new parameters for the linear model.

I have also applied this procedure to polinomial models and to glms with 
binomial errors
(presence/absence) with no problem.

I am nevertheless stuck with non-linear models. I am using the protocols 
you suggested
in the 1998 manuals by Pinheiro and Bates, and those suggested by Crawley 
2002.
Please find enclose an example with an
exponential model (which I chose for being simple). In fact the linear 
models I am using
are a bit more complicated.
(HELLOT is a species, INSOLACION = INSOLATION, basal = basal area of the 
species, TRANSECTO = transect)

 > HELLOT ~ exp(A + (B * INSOLACION))
 > basal.HELLOT <-function(A,B,INSOLACION) exp(A + (B * INSOLACION))
 > HELLOT ~ basal.HELLOT(A,B,INSOLACION)
 > basal.HELLOT<- deriv(~ exp(A + (B * INSOLACION))
+ , LETTERS [1:2], function(A, B, INSOLACION){})
 > model1<- nlme(model = HELLOT ~ exp(A + (B * INSOLACION)), fixed = A + B 
~ 1,
random = A + B ~ 1, groups = ~ TRANSECTO, start = list(fixed = c(5.23, -0.05)))

It runs perfectly and gives new values for parameters A and B, but would 
only give me F for fixed effects of A and B, while what I am really looking 
for is F for fixed effects of INSOLACION and the R2 of the new model.

Thank you so much in advance for your help



Dra. Patricia Balvanera
Centro de Investigaciones en Ecosistemas, UNAM-Campus Morelia
Apdo. Postal 27-3, Xangari
58090 Morelia, Michoacán, Mexico
Tel. (52-443)3-22-27-07, (52-55) 56-23-27-07
FAX (52-443) 3-22-27-19, (52-55) 56-23-27-19

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


Re: [R] glm(family=binomial(link=logit))

2005-07-15 Thread Peter Dalgaard
Robin Hankin <[EMAIL PROTECTED]> writes:

> Hi
> 
> I am trying to make glm() work to analyze a toy logit system.
> 
> I have a dataframe with x and y independent variables.  I have
> 
> L=1+x-y  (ie coefficients 1,1,-1)
> 
> then if I have a logit relation with L=log(p/(1-p)),
> p=1/(1+exp(L)).
> 
> If I interpret "p" as the probability of  success in a Bernouilli
> trial, and I can observe the result (0 for "no", 1 for "yes")
> how do I retrieve the coefficients c(1,1,-1)
> from the data?
> 
> n <- 300
> des <- data.frame(x=(1:n)/n,y=sample(n)/n)   # experimental design
> des <- cbind(des,L=1+des$x-des$y)# L=1+x-y
> des <- cbind(des,p=1/(1+exp(des$L))) # p=1/(1+e^L)
> des <- cbind(des,obs=rbinom(n,1,des$p))  # observation: prob of  
> success = p.
> 
> 
> My attempt is:
> 
> glm(obs~x+y,data=des,family=binomial(link="logit"))
> 
> But it does not retrieve the correct coefficients of c(1,1,-1) ;
> I would expect a reasonably close answer with so much data.
> 
> What is the correct glm() call to perform my logit analysis?

Apart from a sign error, the only fault seems to be that you think
that 300 is a large number... Try upping n to 3 and you'll see.

(The sign error is of course that log(p/(1-p)) = L implies that
p = exp(L)/(1+exp(L)) = 1/(1+exp(-L))).  

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

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


Re: [R] Passing character strings from C code to R

2005-07-15 Thread mkondrin
If you want to install comment attribute on return value set it this way
setAttrib(ans, R_CommentSymbol, charToSexp("Some comment"));

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


Re: [R] Passing character strings from C code to R

2005-07-15 Thread mkondrin
Tuszynski, Jaroslaw W. wrote:

>Hi,
>
>I have a C code which produces array of integers and potentially a string,
>and I have problems passing the string out. Here is the relevant part of the
>code:
>
> 1   PROTECT(Ret = allocVector(INTSXP, n));
> 2   ret = (int*) INTEGER(Ret);  /* get pointer to R's Ret */
> 3   for(i=0; i 4   Free(data);
> 5   i=1;
> 6   if (comment) { // comment was found
> 7 n = strlen(comment);
> 8 if(n>0) {// and it actually have some length
> 9Rprintf(" '%s' %i\n", comment, n); 
> 10   PROTECT(Str = allocString(n+1)); 
> 11   str = CHAR(STRING_ELT(Str, 0));
> 12   strcpy(str, comment);
> 13   Rprintf(" '%s' %i\n", str, n);
> 14   setAttrib(Ret, install("comm"), Str);
> 15   i=2;
> 16 }
> 17 Free(comment);
> 18   }
> 20   UNPROTECT(i);  
>
>Print statement in line 9 gives right results, but program crashes before
>print statement in line 13.
>Any ideas to what am I doing wrong? 
>
>Jarek
>=\ 
> Jarek Tuszynski, PhD.   o / \ 
> Science Applications International Corporation  <\__,|  
> (703) 676-4192">  \
> [EMAIL PROTECTED]   `\
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>
SEXP charToSexp(char * val) {
  USER_OBJECT_ ans;
  PROTECT(ans = NEW_CHARACTER(1));
  if(val)
  SET_STRING_ELT(ans, 0, COPY_TO_USER_STRING(val));
  UNPROTECT(1);

  return(ans);
}

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


[R] New RVTK package is available for download and testing.

2005-07-15 Thread M.Kondrin
Hello!
I have just completed R language binding for VTK library from Kitware. 
The library is used for 3D modelling and data visualization. RVTK  
allows you to do that sort of things in R-session. Because RVTK is in 
quite an alpha stage it is not yet on CRAN and can be downloaded from my 
homepage: http://www.hppi.troitsk.ru/Kondrin/rvtk.htm . The link to the 
tarball is on the bottom of page after a long introduction (if you are 
intended to use RVTK better do read it).

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


Re: [R] glm(family=binomial(link=logit))

2005-07-15 Thread Prof Brian Ripley
On Fri, 15 Jul 2005, Robin Hankin wrote:

> I am trying to make glm() work to analyze a toy logit system.
>
> I have a dataframe with x and y independent variables.  I have
>
> L=1+x-y  (ie coefficients 1,1,-1)
>
> then if I have a logit relation with L=log(p/(1-p)),
> p=1/(1+exp(L)).

Not quite, see below.

> If I interpret "p" as the probability of  success in a Bernouilli
> trial, and I can observe the result (0 for "no", 1 for "yes")
> how do I retrieve the coefficients c(1,1,-1)
> from the data?
>
> n <- 300
> des <- data.frame(x=(1:n)/n,y=sample(n)/n)   # experimental design
> des <- cbind(des,L=1+des$x-des$y)# L=1+x-y
> des <- cbind(des,p=1/(1+exp(des$L))) # p=1/(1+e^L)

A logit would be p = e^L/(1+e^L), so your signs for L are reversed.

> des <- cbind(des,obs=rbinom(n,1,des$p))  # observation: prob of
> success = p.
>
>
> My attempt is:
>
> glm(obs~x+y,data=des,family=binomial(link="logit"))
>
> But it does not retrieve the correct coefficients of c(1,1,-1) ;
> I would expect a reasonably close answer with so much data.

You actually have so little data.

> What is the correct glm() call to perform my logit analysis?

The call is correct, the expectation is not.  A single bernoulli 
observation provides far less information than you seem to suppose.

I got

Coefficients:
 Estimate Std. Error z value Pr(>|z|)
(Intercept)  -1.4747 0.3670  -4.019 5.85e-05 ***
x-0.5549 0.4672  -1.188  0.23494
y 1.2963 0.4731   2.740  0.00614 **

and note how large the standard errors are.  With 1 examples you will 
get closer.  Having fixed your sign change, I got

Coefficients:
 Estimate Std. Error z value Pr(>|z|)
(Intercept)  0.987110.06024   16.39   <2e-16 ***
x1.008960.08052   12.53   <2e-16 ***
y   -0.877980.08031  -10.93   <2e-16 ***


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

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


[R] pdf() black&white; panel titles in lattice

2005-07-15 Thread ftorrei2
Hello,

I have two questions: 

1. How can I get black and white graphics using the pdf()
device? I have tried pdf(Name.pdf, bg="white", fg"black"), but
I still get  full-color graphics.

2. When using lattice, how do I change the title for each
panel?  By default it uses the categories of the grouping
factor. I would like to modify the labels in the graphic
without changing the data. Also, how do I add a title above
the graphic referring to this factor (not the main title of
the graph)? The title for the xlab refers to the independent
factor within each panel. I would like to explain what each
panel represents with something similar to xlab, this title
being above the graphic if possible.

Thanking you in adavance,
Francisco 
Francisco Torreira
Spanish, Italian and Portuguese
Univ. of Illinois at Urbana-Champaign
707 South Mathews Aven.
4031 FLB
Urbana, IL, 61801

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


Re: [R] Newbie guide for plot & graphics functions?

2005-07-15 Thread Don MacQueen
I think you have it backwards (the error message not withstanding). 
Read the documentation for image, note the beginning of the Details 
section, and then compare these two examples, both of which succeed 
on my system (R 2.1.1).

x <- 1:10
y <- 1:15
z <- outer(x,y)
image(x,y,z)

xb <- c(.5,x+.5)
yb <- c(.5,y+.5)
image(x,y,z)

x and y provide either the centers of the cells, or the boundaries of 
the cells. In the latter case, the lengths of x and y should be 1 
greater than the dim of z, not one less.

(I'm including my full version info to be complete, but I doubt that 
you problem has to do with your platform [OS]).

-Don

>  version
  _   
platform powerpc-apple-darwin7.9.0
arch powerpc 
os   darwin7.9.0 
system   powerpc, darwin7.9.0
status   
major2   
minor1.1 
year 2005
month06  
day  20  
language R   


At 7:23 AM -0700 7/15/05, Pete Cap wrote:
>Hello all,
>
>Can anyone point me to a decent introduction to using the plotting 
>and assorted graphics functions in R?
>
>I keep getting simple errrors and I can't figure out why, for example:
>
>>  image(x,y,z)
>Error in image.default(x, y, z) : dimensions of z are not 
>length(x)(+1) times length(y)(+1)
>>  length(x)
>[1] 206
>>  length(y)
>[1] 40
>>  dim(z)
>[1] 207  41
>
>
>It seems to me as if R is wrong--the matrix z is obviously of 
>length(x)+1 times length(y)+1--but just as obviously I'm missing 
>something essential.  Are there any "newbie" guides out there for 
>getting started?
>TIA,
>
>Pete
>
>
>
>-
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

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


[R] glm(family=binomial(link=logit))

2005-07-15 Thread Robin Hankin
Hi

I am trying to make glm() work to analyze a toy logit system.

I have a dataframe with x and y independent variables.  I have

L=1+x-y  (ie coefficients 1,1,-1)

then if I have a logit relation with L=log(p/(1-p)),
p=1/(1+exp(L)).

If I interpret "p" as the probability of  success in a Bernouilli
trial, and I can observe the result (0 for "no", 1 for "yes")
how do I retrieve the coefficients c(1,1,-1)
from the data?

n <- 300
des <- data.frame(x=(1:n)/n,y=sample(n)/n)   # experimental design
des <- cbind(des,L=1+des$x-des$y)# L=1+x-y
des <- cbind(des,p=1/(1+exp(des$L))) # p=1/(1+e^L)
des <- cbind(des,obs=rbinom(n,1,des$p))  # observation: prob of  
success = p.


My attempt is:

glm(obs~x+y,data=des,family=binomial(link="logit"))

But it does not retrieve the correct coefficients of c(1,1,-1) ;
I would expect a reasonably close answer with so much data.

What is the correct glm() call to perform my logit analysis?





--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

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


Re: [R] Padding in lattice plots

2005-07-15 Thread Deepayan Sarkar
On 7/15/05, Federico Gherardini <[EMAIL PROTECTED]> wrote:
> On Friday 15 July 2005 14:42, you wrote:
> > Hi all,
> > I've used the split argument to print four lattice plots on a single page.
> > The problem now is that I need to reduce the amount of white space between
> > the plots. I've read other mails in this list about the new trellis
> > parameters layout.heights and layout.widhts but I haven't been able to use
> > them properly. I've tried to input values between 0 and 1 as the padding
> > value (both left and right and top and bottom) but nothing changed. It
> > seems I can only increase the padding by using values > 1. Any ideas?
> >
> > Thanks in advance for your help
> > Federico Gherardini
> It seems like I've found an answer myself you have to use negative values
> to decrease the padding. I thought it was something like the cex parameter
> which acts like a multiplier 

I thought so too. 

> but this is not the case.

Could you post what you used? There are several different padding
parameters you need to set to 0, did you change them all?

Deepayan

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


Re: [R] Newbie guide for plot & graphics functions?

2005-07-15 Thread Christophe Pouzat
If you have a little bit of time, check out Ross Ihaka's Lectures on 
"Information Visualisation". The specific examples he gives are built 
with R:

http://www.stat.auckland.ac.nz/~ihaka/120/

Time could be required because this stuff is so great that you want to 
read all of it...

Christophe.

Pete Cap wrote:

>Hello all,
>
>Can anyone point me to a decent introduction to using the plotting and 
>assorted graphics functions in R?
> 
>I keep getting simple errrors and I can't figure out why, for example:
> 
>  
>
>>image(x,y,z)
>>
>>
>Error in image.default(x, y, z) : dimensions of z are not length(x)(+1) times 
>length(y)(+1)
>  
>
>>length(x)
>>
>>
>[1] 206
>  
>
>>length(y)
>>
>>
>[1] 40
>  
>
>>dim(z)
>>
>>
>[1] 207  41
>
> 
>It seems to me as if R is wrong--the matrix z is obviously of length(x)+1 
>times length(y)+1--but just as obviously I'm missing something essential.  Are 
>there any "newbie" guides out there for getting started?
>TIA,
> 
>Pete
>
>
>   
>-
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>  
>


-- 
A Master Carpenter has many tools and is expert with most of them.If you
only know how to use a hammer, every problem starts to look like a nail.
Stay away from that trap.
Richard B Johnson.
--

Christophe Pouzat
Laboratoire de Physiologie Cerebrale
CNRS UMR 8118
UFR biomedicale de l'Universite Paris V
45, rue des Saints Peres
75006 PARIS
France

tel: +33 (0)1 42 86 38 28
fax: +33 (0)1 42 86 38 30
web: www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html

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


Re: [R] Coxph with factors

2005-07-15 Thread Thomas Lumley
On Fri, 15 Jul 2005, Kylie-Anne Richards wrote:
>
> FIRST Q: The default uses the mean of 'vo' and mean of 'po', but what is it
> using for the factors?? Is it the sum of the coef of the factors divided by
> the number of factors??

It uses the mean of each factor variable.  The $means component of the fit 
gives the values it uses.

> SECOND Q: For a model with covariates I would normally specify:
> final.surv<-survfit((final), data.frame(po=0,vo=0,pom=0,individual=T)) to
> get the baseline survival prob.; what would I specify for a model with a
> factor, i.e., 'f.pom' ??

I would first note that the survival function at zero covariates is not a 
very useful thing and is usually numerically unstable, and it's often more 
useful to get the survival function at some reasonable set of covariates.

In any case, to specify f.pom You need it to be a factor with 
the same set of levels.  You don't say what the lowest level of pom is, 
but if it is, say, -3.

f.pom=factor(-3, levels=seq(-3,2.5, by=0.5))


=thomas

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


Re: [R] Newbie guide for plot & graphics functions?

2005-07-15 Thread Uwe Ligges
Pete Cap wrote:

> Hello all,
> 
> Can anyone point me to a decent introduction to using the plotting and 
> assorted graphics functions in R?
>  
> I keep getting simple errrors and I can't figure out why, for example:
>  
> 
>>image(x,y,z)
> 
> Error in image.default(x, y, z) : dimensions of z are not length(x)(+1) times 
> length(y)(+1)
> 
>>length(x)
> 
> [1] 206
> 
>>length(y)
> 
> [1] 40
> 
>>dim(z)
> 
> [1] 207  41
> 
>  
> It seems to me as if R is wrong--the matrix z is obviously of length(x)+1 
> times length(y)+1--but just as obviously I'm missing something essential.  
> Are there any "newbie" guides out there for getting started?


Can you specify a reproducible examples, please?

Uwe Ligges


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

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


[R] Newbie guide for plot & graphics functions?

2005-07-15 Thread Pete Cap
Hello all,

Can anyone point me to a decent introduction to using the plotting and assorted 
graphics functions in R?
 
I keep getting simple errrors and I can't figure out why, for example:
 
> image(x,y,z)
Error in image.default(x, y, z) : dimensions of z are not length(x)(+1) times 
length(y)(+1)
> length(x)
[1] 206
> length(y)
[1] 40
> dim(z)
[1] 207  41

 
It seems to me as if R is wrong--the matrix z is obviously of length(x)+1 times 
length(y)+1--but just as obviously I'm missing something essential.  Are there 
any "newbie" guides out there for getting started?
TIA,
 
Pete



-


[[alternative HTML version deleted]]

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


Re: [R] Dividing a vector into ntiles

2005-07-15 Thread Ravi Varadhan
Here is an example that shows how to divide a vector into "quartiles" and
create a categorical (factor) variable with 4 levels ("A", "B", "C", "D")
from it:

x <- rnorm(100)
xcat <- factor(cut(x, quantile(x), include.lowest = TRUE), 
  labels = LETTERS[1:4])
table(xcat)

Ravi.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:r-help-
> [EMAIL PROTECTED] On Behalf Of John Sorkin
> Sent: Friday, July 15, 2005 8:48 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Dividing a vector into ntiles
> 
> R 2.1.1
> Win 2k
> 
> Would someone suggest a method (or methods) that can be used to
> determine ntile cutpoints of a vector, i.e. to determine values that can
> be used to divide a vector into thirds such as 0-33 centile, 34-66
> centile, 67-100 centile. If for example I had a vector:
> 1,2,3,4,5,6,7,8,9
> and wanted to divide the vector into thirds
> I would have cut-points of 3, and 6.
> Thanks,
> John
> 
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC and
> University of Maryland School of Medicine Claude Pepper OAIC
> 
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> 
> 410-605-7119
> -- NOTE NEW EMAIL ADDRESS:
> [EMAIL PROTECTED]
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-
> guide.html

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


[R] Coxph with factors

2005-07-15 Thread Kylie-Anne Richards
My apologies for lack of clarity.

Sample data:

  time.sec po vo done f.pom
  55 0 4402 1 -0.25
  378 -0.5 5 1 -0.25
  51 0 1000 1 -0.25
  43 0 71581 1 -0.25

etc

>DATA<-data.frame(time.sec,done,f.pom=factor(f.pom),po,vo)
>final<-coxph(Surv(time.sec,done)~f.pom+vo+po,data=DATA)
  coef exp(coef) se(coef)   z   p
f.pom-2.5  1.30e+00  3.65 1.66e-01   7.822 5.2e-15
f.pom-21.11e+00  3.02 1.68e-01   6.604 4.0e-11
f.pom-1.5  1.37e+00  3.95 1.59e-01   8.656 0.0e+00
f.pom-11.76e+00  5.79 1.56e-01  11.286 0.0e+00
f.pom-0.5  2.10e+00  8.14 1.52e-01  13.757 0.0e+00
f.pom0 4.96e+00142.10 1.95e-01  25.433 0.0e+00
f.pom0.5   4.69e+00108.71 1.53e-01  30.573 0.0e+00
f.pom1 4.66e+00105.50 1.58e-01  29.575 0.0e+00
f.pom1.5   4.66e+00105.62 1.60e-01  29.051 0.0e+00
f.pom2 4.61e+00100.77 1.60e-01  28.792 0.0e+00
vo   -6.93e-05  1.00 6.57e-06 -10.548 0.0e+00
po   2.65e-03  1.00 1.29e-03   2.047 4.1e-02

 >final.surv<-survfit((final), individual=T,conf.type="log-log")
 >print(final.surv)

  time n.risk n.event survival  std.err lower 95% CI upper 95% CI
 0  139223914 8.10e-01 3.82e-03 8.02e-01  0.81712
 1   9726  91 7.98e-01 3.97e-03 7.90e-01  0.80547
 2   9457  46 7.92e-01 4.04e-03 7.84e-01  0.79949
 3   9297  36 7.87e-01 4.10e-03 7.79e-01  0.79477
etc

FIRST Q: The default uses the mean of 'vo' and mean of 'po', but what is it 
using for the factors?? Is it the sum of the coef of the factors divided by 
the number of factors??

SECOND Q: For a model with covariates I would normally specify: 
final.surv<-survfit((final), data.frame(po=0,vo=0,pom=0,individual=T)) to 
get the baseline survival prob.; what would I specify for a model with a 
factor, i.e., 'f.pom' ??

E.g. one of the many variations I have tried:
> final.surv<-survfit((final), 
> data.frame(po=0,vo=0,f.pom=0,individual=T))
Error in model.frame(formula, rownames, variables, varnames, extras, 
extranames,  :
variable lengths differ
In addition: Warning message:
'newdata' had 1 rows but variable(s) found have 13922 rows
Execution halted

I appreciate the time anyone can spare to help me with my problem, and 
apologies for it's simplistic nature.

Many thanks,

Kylie-Anne



Adaikalavan Ramasamy ramasamy at cancer.org.uk
Fri Jul 15 09:58:19 CEST 2005

  a.. Previous message: [R] Coxph with factors
  b.. Next message: [R] Pearson dispersion statistic
  c.. Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]



Yes, and please show us a reproducible example or small section of thedata 
as well as the error output. On Thu, 2005-07-14 at 15:36 +, Dieter Menne 
wrote:> Kylie-Anne Richards  itga.com.au> writes:> > > > > I am 
fitting a coxph model with factors. I am running into problems when> > using 
'survfit'. I am unsure how R is treating the factors when I fit, say:> > > 
DATA<-data.frame(time.sec,done,f.pom=factor(f.pom),po,vo)> > > 
final<-coxph(Surv(time.sec,done)~f.pom*vo+po,data=DATA)> > > 
final.surv<-survfit((final), individual=T,conf.type="log-log")> > > 
print(final.surv)> > > Better chances to get a reply when you tell us 
what problems you are running > into.> > Dieter Menne

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


Re: [R] crossed random fx nlme lme4

2005-07-15 Thread Douglas Bates
On 7/13/05, Simon Blomberg <[EMAIL PROTECTED]> wrote:
> At 09:35 AM 14/07/2005, Emilio A. Laca wrote:
> >I need to specify a model similar to this
> >
> >lme.formula(fixed = sqrt(lbPerAc) ~ y + season + y:season, data = cy,
> >  random = ~y | observer/set, correlation = corARMA(q = 6))
> >
> >except that observer and set are actually crossed instead of nested.
> 
> Does this work for you? (following P&B pp 162-3 and an R-help archive
> search on "crossed random effects")...
> 
> fit <- lme(sqrt(lbPerAc) ~ y * season, random=list(pdBlocked(pdIdent(~y),
> pdIdent(observer-1), pdIdent(set-1))), correlation=corARMA(q = 6), data=cy)
> 
> lme isn't very well set up for crossed random effects. It's easier in lmer.
> I don't think lmer can handle alternative correlation structures yet,
> though. (Prof. Bates?)

Exactly.  Thanks for the summary.

> 
> HTH,
> 
> Simon.
> 
> 
> >observer and set are factors
> >y and lbPerAc are numeric
> >
> >If you know how to do it or have suggestions for reading I will be
> >grateful.
> >
> >
> >eal
> >
> >ps I have already read Pinheiro & Bates, the jan 05 newsletter, and
> >several postings.
> >
> >__
> >R-help@stat.math.ethz.ch mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
> Centre for Resource and Environmental Studies
> The Australian National University
> Canberra ACT 0200
> Australia
> T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
> F: +61 2 6125 0757
> CRICOS Provider # 00120C
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Partek has Dunn-Sidak Multiple Test Correction. Is this the same/similar to any of R's p.adjust.methods?

2005-07-15 Thread Martin Maechler
> "Earl" == Earl F Glynn <[EMAIL PROTECTED]>
> on Thu, 14 Jul 2005 12:22:49 -0500 writes:

Earl> The Partek package (www.partek.com) allows only two selections for 
Multiple
Earl> Test Correction:  Bonferroni and Dunn-Sidak.  Can anyone suggest why 
Partek
Earl> implemented Dunn-Sidak and not the other methods that R has?  Is 
there any
Earl> particular advantage to the Dunn-Sidak method?
Earl> R knows about these methods (in R 2.1.1):

>> p.adjust.methods
Earl> [1] "holm" "hochberg" "hommel" "bonferroni" "BH" "BY" "fdr"
Earl> [8] "none"

Earl> BH is Benjamini & Hochberg (1995) and is also called "fdr" (I wish R's
Earl> documentation said this clearly).  BY is Benjamini & Yekutieli (2001).

The current R docu has

  >>   The '"BH"' and '"BY"' method of Benjamini, Hochberg, and Yekutieli
  >>   control the false discovery rate, the expected proportion of false
  >>   discoveries amongst the rejected hypotheses.  The false discovery
  >>   rate is a less stringent condition than the family wise error
  >>   rate, so these methods are more powerful than the others.

so both "BH" and "BY"   ``are FDR versions''. 
"fdr" was used - unfortunately - in some older versions of R,
so we kept it working as an *alias* for the time being.  
You should rather not know about it :-)
and use "BH" or "BY" (and maybe other methods in the future) instead.

Regards,

Martin

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


[R] Ordinal data - Regression Trees & Proportional Odds

2005-07-15 Thread Volker Schlecht
Dear Dr. Fieberg,

you used a regression tree approach to explore ordinal data set in addition to 
the proportinal odds model. I find this very interesting. I would like to know, 
how good the 
results of the regression tree approach turned out in comparison to the 
proportional odds model. Since people very often treat ordinal data as 
continuous, I would 
like to know how successfull this strategy is. I mean, I can see, what may be a 
reason
to do this: One could argue that ordinal data an a sufficiently large scale 
(say 1 to 10) are just 
coarsely measured continuous data. 

I would be delighted if you could tell me your experiences about the treatment 
of ordinal data with 
models for continuous data. Also I would be delighted, if you could tell me, if 
your results are published somewhere.

Best wishes,

Volker Schlecht

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


Re: [R] unexpected par('pin') behaviour

2005-07-15 Thread Martin Maechler
> "MM" == Martin Maechler <[EMAIL PROTECTED]>
> on Fri, 15 Jul 2005 14:36:16 +0200 writes:



MM> which I can simplify to

MM> graphics.off()
MM> layout(matrix(1:42,7,6))
MM> par("pin")

MM> ## [1]  0.2918620 -0.2974408  --- when using x11() "default" 

MM> clearly a bug in layout()  {which I'll file}

exploring more before filing a bug report,

I've now seen that this  *NO BUG*  of layout() 
but rather of the ``design bug'' of old-style graphics which
bites here.

MM> and it seems to me, one that is not shared by
MM> par(mfrow= / mfcol=) settings.

That's wrong, since

  postscript(paper="a4")
  par(mfrow=c(7,6))
  par("pin")
  ## [1]  1.0470855 -0.1047263

and when plot() you get message about margins being too wide.

Only after something like

  par(mar= rep(1,4))

you get both valid "pin" and can plot properly.

That's nothing new and not really astonishing,
...

Martin Maechler, ETH Zurich

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


Re: [R] Dividing a vector into ntiles

2005-07-15 Thread Wiener, Matthew
You could try using "cut":
> cut(1:9, breaks = 3)
[1] (0.992,3.66] (0.992,3.66] (0.992,3.66] (3.66,6.34]  (3.66,6.34] 
[6] (3.66,6.34]  (6.34,9.01]  (6.34,9.01]  (6.34,9.01] 
Levels: (0.992,3.66] (3.66,6.34] (6.34,9.01]
>

Quantile is another possible solution to get break points:
> quantile(1:9, p = c(0, .33, .66, 1))
  0%  33%  66% 100% 
1.00 3.64 6.28 9.00 
>
You could use rounding if you want the integers, or use the given cutpoints.

Hope this helps,

Matt Wiener

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Sorkin
Sent: Friday, July 15, 2005 8:48 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Dividing a vector into ntiles


R 2.1.1
Win 2k
 
Would someone suggest a method (or methods) that can be used to
determine ntile cutpoints of a vector, i.e. to determine values that can
be used to divide a vector into thirds such as 0-33 centile, 34-66
centile, 67-100 centile. If for example I had a vector:
1,2,3,4,5,6,7,8,9
and wanted to divide the vector into thirds
I would have cut-points of 3, and 6.
Thanks,
John
 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC
 
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
 
410-605-7119 
-- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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

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


[R] Passing character strings from C code to R

2005-07-15 Thread Tuszynski, Jaroslaw W.
Hi,

I have a C code which produces array of integers and potentially a string,
and I have problems passing the string out. Here is the relevant part of the
code:

 1   PROTECT(Ret = allocVector(INTSXP, n));
 2   ret = (int*) INTEGER(Ret);  /* get pointer to R's Ret */
 3   for(i=0; i0) {// and it actually have some length
 9Rprintf(" '%s' %i\n", comment, n); 
 10   PROTECT(Str = allocString(n+1)); 
 11   str = CHAR(STRING_ELT(Str, 0));
 12   strcpy(str, comment);
 13   Rprintf(" '%s' %i\n", str, n);
 14   setAttrib(Ret, install("comm"), Str);
 15   i=2;
 16 }
 17 Free(comment);
 18   }
 20   UNPROTECT(i);  

Print statement in line 9 gives right results, but program crashes before
print statement in line 13.
Any ideas to what am I doing wrong? 

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

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


Re: [R] Dividing a vector into ntiles

2005-07-15 Thread Chuck Cleland
?quantile

quantile(runif(1000), probs=seq(0,1,1/3))

John Sorkin wrote:
> R 2.1.1
> Win 2k
>  
> Would someone suggest a method (or methods) that can be used to
> determine ntile cutpoints of a vector, i.e. to determine values that can
> be used to divide a vector into thirds such as 0-33 centile, 34-66
> centile, 67-100 centile. If for example I had a vector:
> 1,2,3,4,5,6,7,8,9
> and wanted to divide the vector into thirds
> I would have cut-points of 3, and 6.
> Thanks,
> John
>  
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC and
> University of Maryland School of Medicine Claude Pepper OAIC
>  
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
>  
> 410-605-7119 
> -- NOTE NEW EMAIL ADDRESS:
> [EMAIL PROTECTED]
> 
>   [[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
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Pingping Zheng
I'm not sure what other applications use environment variable like "LANGUAGE".
I'm sorry I was so assertive. However, what I said is right in the sense that
environment variables are supposed to be used NOT by one specific application.
I happen to use lots of GnuWin32 and Cygwin applications such as lots of Unix
tools though I am not sure what will happen after setting system wise variable 
"LANGUAGE".

It's a good idea to set "LANGUAGE" in .Renviron under current directory before
running R.

Thanks.


Pingping Zheng
Department of Mathematics and Statistics
Fylde College
Lancaster University
Lancaster LA1 4YF
UK


Prof Brian Ripley wrote:
> On Fri, 15 Jul 2005, Uwe Ligges wrote:
> 
>> Pingping Zheng wrote:
>>
>>> I think what Nan Lin wanted is "How to change the language used in R
>>> console by re-setting something within R?"
>>>
>>> For a non-english user, sometime we prefer to set the system default
>>> language to a native one and use english in individual programs when
>>> we think necessary.
>>>
>>> a) setting the envrionment variable LANGUAGE=en will make an impact
>>>  on the whole system, which has its side effects.
> 
> 
> I'd like to see your evidence for that.  gettext deliberately chose 
> LANGUAGE because it was not commonly used, and I know of no application 
> other than those based on gettext (like R) which makes use of it.  It is 
> not at all common for Windows applications to use such environment 
> variables unless they are ported from the Unix world.
> 
>>> b) changing language setup through control panel is telling people to 
>>> throw
>>>  away their native windows system, let's all use English system.
>>>
>>> Any better idea?
>>
>>
>> What about setting LANGUAGE in .Renviron?
>> See ?.Renviron
> 
> 
> Or reading the rw-FAQ Q2.17 and seeing other ways to do so.
>

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


[R] Dividing a vector into ntiles

2005-07-15 Thread John Sorkin
R 2.1.1
Win 2k
 
Would someone suggest a method (or methods) that can be used to
determine ntile cutpoints of a vector, i.e. to determine values that can
be used to divide a vector into thirds such as 0-33 centile, 34-66
centile, 67-100 centile. If for example I had a vector:
1,2,3,4,5,6,7,8,9
and wanted to divide the vector into thirds
I would have cut-points of 3, and 6.
Thanks,
John
 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC
 
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
 
410-605-7119 
- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


Re: [R] unexpected par('pin') behaviour

2005-07-15 Thread Martin Maechler
Thank you, Joerg,
for the reproducable example 
 
> "joerg" == joerg van den hoff <[EMAIL PROTECTED]>
> on Thu, 14 Jul 2005 17:19:51 +0200 writes:

  ..
  ..

joerg> ===cut
joerg> graphics.off()

joerg> f <- function(n=7, m=6) {
joerg> nm <- n*m
joerg> layout(matrix(1:(nm),n,m))
joerg> opar <- par(no.readonly = T)
joerg> on.exit(par(opar))
joerg> par(mar = c(4.1, 4.1, 1.1, 0.1))
joerg> for (i in 1:nm) plot(i, pch=(i-1)%%25+1)
joerg> layout(1)
joerg> }
joerg> f(5) #good
joerg> par('pin')
joerg> f()  #bad (at least for x11() default size)
joerg> par('pin')
joerg> ===cut

which I can simplify to

  graphics.off()
  layout(matrix(1:42,7,6))
  par("pin")

  ## [1]  0.2918620 -0.2974408  --- when using x11() "default" 

clearly a bug in layout()  {which I'll file}

and it seems to me, one that is not shared by
par(mfrow= / mfcol=) settings.

Martin Maechler, ETH Zurich

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Prof Brian Ripley
On Fri, 15 Jul 2005, Uwe Ligges wrote:

> Pingping Zheng wrote:
>
>> I think what Nan Lin wanted is "How to change the language used in R
>> console by re-setting something within R?"
>>
>> For a non-english user, sometime we prefer to set the system default
>> language to a native one and use english in individual programs when
>> we think necessary.
>>
>> a) setting the envrionment variable LANGUAGE=en will make an impact
>>  on the whole system, which has its side effects.

I'd like to see your evidence for that.  gettext deliberately chose 
LANGUAGE because it was not commonly used, and I know of no application 
other than those based on gettext (like R) which makes use of it.  It is 
not at all common for Windows applications to use such environment 
variables unless they are ported from the Unix world.

>> b) changing language setup through control panel is telling people to throw
>>  away their native windows system, let's all use English system.
>>
>> Any better idea?
>
> What about setting LANGUAGE in .Renviron?
> See ?.Renviron

Or reading the rw-FAQ Q2.17 and seeing other ways to do so.

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

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Prof Brian Ripley
On Fri, 15 Jul 2005, Peter Dalgaard wrote:

> Gabor Grothendieck <[EMAIL PROTECTED]> writes:
>
>> I am not sure how generally this works but I was able to get it to switch
>> back and forth between two languages within  a single R
>> session like this:

The posting guide does ask people to read the documentation, and this is 
documented in the appropriate manual.

>>> Sys.getenv("LANGUAGE")
>> LANGUAGE
>>   ""
>>> q() # note English prompt; c means continue rather than exiting
>> Save workspace image? [y/n/c]: c
>>> Sys.putenv(LANGUAGE="it")
>>> q() # note Italian prompt
>> Salva area di lavoro? [y/n/c]: c
>>> Sys.putenv(LANGUAGE="en")
>>> q() # now we are back to English
>> Save workspace image? [y/n/c]: n
>
> Hmm, doesn't quite seem to work on Fedora:
>
>> Sys.putenv(LANGUAGE="it")
>> q()
> Save workspace image? [y/n/c]: c
>> Sys.setenv(LANGUAGE="it")
> Errore: non trovo la funzione "Sys.setenv"
>> Sys.putenv(LANGUAGE="en")
>> Sys.setenv(LANGUAGE="it")
> Errore: non trovo la funzione "Sys.setenv"
>> q()
> Save workspace image? [y/n/c]: c
>
> So the save prompt is untranslated (but this happens with
>
> LANG=it_IT R
>
> as well(?!)), but worse, it doesn't seem to want to set the language
> back to English.

This is not intended to work: it is documented that LANGUAGE should be set 
outside the process.  Does no one read the manuals?  R-admin says

   `Note that you should not expect to be able to change the language once
R is running ...'

It is phrased that way because it _sometimes_ will work on _some_ OSes and 
on _some_ versions of gettext.

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

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


Re: [R] Another simple q - removing negative values

2005-07-15 Thread Wiener, Matthew
To leave x with only the non-negative elements, you can use x[x >= 0].  Also
see the function "subset".

Hope this helps,

Matt Wiener

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Hopkins
Sent: Friday, July 15, 2005 8:00 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Another simple q - removing negative values



Sorry folks but again I have failed in my understanding of how to do a very
simple thing.  I've read the various texts and searched the help archives
but no positive result so far.

I want to remove all the rows in a data frame where one of the variables has
negative values.  In approx Stata pseudocode:

   drop _all, if( x < 0 )

Please either point me to relevant sections of the docs or supply me with
solution - I'm sure it's very simple.

Michael

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

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


Re: [R] Another simple q - removing negative values

2005-07-15 Thread Peter Dalgaard
Michael Hopkins <[EMAIL PROTECTED]> writes:

> Sorry folks but again I have failed in my understanding of how to do a very
> simple thing.  I've read the various texts and searched the help archives
> but no positive result so far.
> 
> I want to remove all the rows in a data frame where one of the variables has
> negative values.  In approx Stata pseudocode:
> 
>drop _all, if( x < 0 )
> 
> Please either point me to relevant sections of the docs or supply me with
> solution - I'm sure it's very simple.

There are variations:

d1 <- subset(d, x < 0)

d1 <- d[d$x < 0,]
d1 <- d[d$x < 0 & !is.na(d$x),] # essentially same as subset()

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

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


Re: [R] Padding in lattice plots

2005-07-15 Thread Federico Gherardini
On Friday 15 July 2005 14:42, you wrote:
> Hi all,
> I've used the split argument to print four lattice plots on a single page.
> The problem now is that I need to reduce the amount of white space between
> the plots. I've read other mails in this list about the new trellis
> parameters layout.heights and layout.widhts but I haven't been able to use
> them properly. I've tried to input values between 0 and 1 as the padding
> value (both left and right and top and bottom) but nothing changed. It
> seems I can only increase the padding by using values > 1. Any ideas?
>
> Thanks in advance for your help
> Federico Gherardini
It seems like I've found an answer myself you have to use negative values 
to decrease the padding. I thought it was something like the cex parameter 
which acts like a multiplier but this is not the case.

Thanks anyway
Federico

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


[R] Another simple q - removing negative values

2005-07-15 Thread Michael Hopkins

Sorry folks but again I have failed in my understanding of how to do a very
simple thing.  I've read the various texts and searched the help archives
but no positive result so far.

I want to remove all the rows in a data frame where one of the variables has
negative values.  In approx Stata pseudocode:

   drop _all, if( x < 0 )

Please either point me to relevant sections of the docs or supply me with
solution - I'm sure it's very simple.

Michael

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


Re: [R] PLS: problem transforming scores to variable space

2005-07-15 Thread Bjørn-Helge Mevik
rainer grohmann writes:

> However, when I try to map the scores back to variable space, I ran into
> problems:
[...]
> cbind(t$scores[,1],(t$scores%*%(t$loadings)%*%t$projection)[,1])

You need to transpose the loadings:

> all.equal(unclass(t$scores),
+   t$scores %*% t(t$loadings) %*% t$projection)
[1] TRUE

(A tip: Since 't' is used for transposing, it is usually a Good
Thing(TM) to avoid using it as a varable name.)

-- 
Bjørn-Helge Mevik

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Peter Dalgaard
Gabor Grothendieck <[EMAIL PROTECTED]> writes:

> I am not sure how generally this works but I was able to get it to switch
> back and forth between two languages within  a single R
> session like this:
> 
> > Sys.getenv("LANGUAGE")
> LANGUAGE
>   ""
> > q() # note English prompt; c means continue rather than exiting
> Save workspace image? [y/n/c]: c
> > Sys.putenv(LANGUAGE="it")
> > q() # note Italian prompt
> Salva area di lavoro? [y/n/c]: c
> > Sys.putenv(LANGUAGE="en")
> > q() # now we are back to English
> Save workspace image? [y/n/c]: n

Hmm, doesn't quite seem to work on Fedora:

> Sys.putenv(LANGUAGE="it")
> q()
Save workspace image? [y/n/c]: c
> Sys.setenv(LANGUAGE="it")
Errore: non trovo la funzione "Sys.setenv"
> Sys.putenv(LANGUAGE="en")
> Sys.setenv(LANGUAGE="it")
Errore: non trovo la funzione "Sys.setenv"
> q()
Save workspace image? [y/n/c]: c

So the save prompt is untranslated (but this happens with 

LANG=it_IT R

as well(?!)), but worse, it doesn't seem to want to set the language
back to English.

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

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Gabor Grothendieck
I am not sure how generally this works but I was able to get it to switch
back and forth between two languages within  a single R
session like this:

> Sys.getenv("LANGUAGE")
LANGUAGE
  ""
> q() # note English prompt; c means continue rather than exiting
Save workspace image? [y/n/c]: c
> Sys.putenv(LANGUAGE="it")
> q() # note Italian prompt
Salva area di lavoro? [y/n/c]: c
> Sys.putenv(LANGUAGE="en")
> q() # now we are back to English
Save workspace image? [y/n/c]: n


On 7/15/05, Pingping Zheng <[EMAIL PROTECTED]> wrote:
> That's pretty convenient. Set LANGUAGE in .Renviron
> under current directory is convenient for both Linux and
> windows users.
> 
> Thanks.
> 
> Pingping Zheng
> Department of Mathematics and Statistics
> Fylde College
> Lancaster University
> Lancaster LA1 4YF
> UK
> 
> 
> Uwe Ligges wrote:
> > Pingping Zheng wrote:
> >
> >
> >>Dear all,
> >>
> >>I think what Nan Lin wanted is "How to change the language used in R
> >>console by re-setting something within R?"
> >>
> >>For a non-english user, sometime we prefer to set the system default
> >>language to a native one and use english in individual programs when
> >>we think necessary.
> >>
> >>a) setting the envrionment variable LANGUAGE=en will make an impact
> >> on the whole system, which has its side effects.
> >>b) changing language setup through control panel is telling people to throw
> >> away their native windows system, let's all use English system.
> >>
> >>Any better idea?
> >
> >
> > What about setting LANGUAGE in .Renviron?
> > See ?.Renviron
> >
> > Uwe Ligges
> >
> >
> >
> >>
> >>Pingping Zheng
> >>Department of Mathematics and Statistics
> >>Fylde College
> >>Lancaster University
> >>Lancaster LA1 4YF
> >>UK
> >>
> >>
> >>Baoqiang Cao wrote:
> >>
> >>
> >>> Original message 
> >>>
> >>>
> >>>
> Date: Thu, 14 Jul 2005 19:50:41 +0200
> From: Uwe Ligges <[EMAIL PROTECTED]>
> Subject: Re: [R] East Asian language
> To: Nan Lin <[EMAIL PROTECTED]>
> Cc: r-help@stat.math.ethz.ch
> 
> Nan Lin wrote:
> 
> 
> 
> 
> >Dear all,
> >
> >I just installed R 2.1.1. The installation program
> >>>
> >>>automatically recognized
> >>>
> >>>
> >>>
> >my Windows XP was using Chinese language, so now my R
> >>>
> >>>console displays
> >>>
> >>>
> >>>
> >everything in Chinese. How can I still let R console
> >>>
> >>>display in English
> >>>
> >>>
> >>>
> >without modifying my Window XP language setup? Thank you so
> >>>
> >>>much!
> >>>
> >>>
> >>>
> E.g. by setting the envrionment variable
> LANGUAGE=en
> 
> >>>
> >>>Or, like what I did, change XP language setting back to
> >>>English from the control panel.
> >>>
> >>>
> >>>
> >>>
> Uwe Ligges
> 
> 
> 
> 
> 
> >Best,
> >
> >Nan
> >
> >__
> >R-help@stat.math.ethz.ch mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide!
> >>>
> >>>http://www.R-project.org/posting-guide.html
> >>>
> >>>
> >>>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> >>>
> >>>http://www.R-project.org/posting-guide.html
> >>>
> >>>__
> >>>R-help@stat.math.ethz.ch mailing list
> >>>https://stat.ethz.ch/mailman/listinfo/r-help
> >>>PLEASE do read the posting guide! 
> >>>http://www.R-project.org/posting-guide.html
> >>>
> >>
> >>
> >>__
> >>R-help@stat.math.ethz.ch mailing list
> >>https://stat.ethz.ch/mailman/listinfo/r-help
> >>PLEASE do read the posting guide! 
> >>http://www.R-project.org/posting-guide.html
> >
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> >
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


[R] Padding in lattice plots

2005-07-15 Thread Federico Gherardini
Hi all,
I've used the split argument to print four lattice plots on a single page. The 
problem now is that I need to reduce the amount of white space between the 
plots. I've read other mails in this list about the new trellis parameters 
layout.heights and layout.widhts but I haven't been able to use them 
properly. I've tried to input values between 0 and 1 as the padding value 
(both left and right and top and bottom) but nothing changed. It seems I can 
only increase the padding by using values > 1. Any ideas?

Thanks in advance for your help
Federico Gherardini

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


Re: [R] Calculation of group summaries

2005-07-15 Thread Søren Højsgaard
Perhaps I lost track of what the original question was, but on my homepage 
http://genetics.agrsci.dk/~sorenh/misc/ there is a package called doBy in which 
there is a function called summaryBy (which mimics proc summary from sas). For 
example
summaryBy(cbind(Weight,Feed)~Evit+Cu,  data=dietox12, 
FUN=c(mean,myvar))  
Søren


-Oprindelig meddelelse-
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Gabor Grothendieck
Sendt: 15. juli 2005 04:43
Til: [EMAIL PROTECTED]
Cc: R-Help
Emne: Re: [R] Calculation of group summaries

1. Try using more spaces so your code is easier to read.

2. Use data.frame to define your data frame (since the method in your post 
creates data frames of factors rather than the desired classes).  

3. Given the appropriate function, f, a single 'by' statement rbind'ed 
together, as shown, will create the result.

nsites <- 6
yearList <- 1999:2001
fakesub <- data.frame(
year = rep(yearList, nsites/length(yearList), each = 11),
site_id  = rep(c('site1','site2'), each = 11*nsites),
visit_no = rep(1, 11*2*nsites),
transect = rep(LETTERS[1:11], nsites, each = 2),
transdir = rep(c('LF','RT'), 11*nsites),
undercut = abs(rnorm(11*2*nsites, 10)),
angle= runif(11*2*nsites, 0, 180)
)


f <- function(x) cbind(year = x[1,1], site_id = x[1,2], visit_no = x[1,3], 
mean = mean(x[,6]), sd = sd(x[,6]), length = length(x[,6])) 
do.call("rbind", by(fakesub, fakesub[,1:3], f))





On 7/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Several people suggested specific functions (by, tapply, sapply and 
> others); thanks for not blowing off a simple question regarding how to 
> do the following SQL in R:
> >   select year,
> >  site_id,
> >  visit_no,
> >  mean(undercut) AS meanUndercut,
> >  count(undercut) AS nUndercut,
> >  std(undercut) AS stdUndercut
> >   from channelMorphology
> >   group by year, site_id, visit_no
> >   ;
> 
> I'd spent quite a bit of time with the suggested functions earlier but 
> had no luck as I'd misread the docs and put the entire dataframe where 
> it only wants the columns to be processed.  Sometimes it's the 
> simplest of things.
> 
> This has lead to another confoundment-- sd() acts differently than
> mean() for some reason, at least with R 1.9.0.  For some reason, means 
> generate NA results and a warning message for each group:
> 
>  argument is not numeric or logical: returning NA in:
> mean.default(data[x, ], ...)
> 
> Of course, the argument is numeric, or there'd be no sd value.  Or 
> more likely, I'm still missing something really basic. If I wrap the 
> value in
> as.numeric() things work fine.  Why should I have to do this for mean 
> and median, but not sd? The code below should reproduce this error
> 
>  # Fake data for demo:
>  nsites<-6
>  yearList<-1999:2001
>  fakesub<-as.data.frame(cbind(
> year =rep(yearList,nsites/length(yearList),each=11)
>,site_id  =rep(c('site1','site2'),each=11*nsites)
>,visit_no =rep(1,11*2*nsites)
>,transect =rep(LETTERS[1:11],nsites,each=2)
>,transdir =rep(c('LF','RT'),11*nsites)
>,undercut =abs(rnorm(11*2*nsites,10))
>,angle=runif(11*2*nsites,0,180)
>))
> 
>  # Create group summaries:
>  sdmets<-by(fakesub$undercut
>,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
>,sd
>)
>  nmets<-by(fakesub$undercut
>   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
>   ,length
>   )
>  xmets<-by(fakesub$undercut
>   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
>   ,mean
>   )
>   xmets<-by(as.numeric(fakesub$undercut)
>   ,list(fakesub$year,fakesub$site_id,fakesub$visit_no)
>   ,mean
>   )
> 
>  # Put site id values (year, site_id and visit_no) into results:
>  # List unique id combinations as a list of lists.  Then  # reorganize 
> that into 3 vectors for final results.
>  # Certainly, there MUST be a better way...
>  foo<-strsplit(unique(paste(fakesub$year
>,fakesub$site_id
>,fakesub$visit_no
>,sep='#'))
>   ,split='#'
>   )
>  year<-list()
>  for(i in 1:length(foo)) {year<-rbind(year,foo[[i]][1])}
>  site_id<-list()
>  for(i in 1:length(foo)) {site_id<-rbind(site_id,foo[[i]][2])}
>  visit_no<-list()
>  for(i in 1:length(foo)) {visit_no<-rbind(visit_no,foo[[i]][3])}
> 
>  # Final result, more or less
>  data.frame(cbind(a=year,b=site_id,c=visit_no,sdmets,nmets,xmets))
> 
> 
> cur
> 
> --
> Curt Seeliger, Data Ranger
> CSC, EPA/WED contractor
> 541/754-4638
> [EMAIL PROTECTED]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the post

Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Pingping Zheng
That's pretty convenient. Set LANGUAGE in .Renviron
under current directory is convenient for both Linux and
windows users.

Thanks.

Pingping Zheng
Department of Mathematics and Statistics
Fylde College
Lancaster University
Lancaster LA1 4YF
UK


Uwe Ligges wrote:
> Pingping Zheng wrote:
> 
> 
>>Dear all,
>>
>>I think what Nan Lin wanted is "How to change the language used in R
>>console by re-setting something within R?"
>>
>>For a non-english user, sometime we prefer to set the system default
>>language to a native one and use english in individual programs when
>>we think necessary.
>>
>>a) setting the envrionment variable LANGUAGE=en will make an impact
>> on the whole system, which has its side effects.
>>b) changing language setup through control panel is telling people to throw
>> away their native windows system, let's all use English system.
>>
>>Any better idea?
> 
> 
> What about setting LANGUAGE in .Renviron?
> See ?.Renviron
> 
> Uwe Ligges
> 
> 
> 
>>
>>Pingping Zheng
>>Department of Mathematics and Statistics
>>Fylde College
>>Lancaster University
>>Lancaster LA1 4YF
>>UK
>>
>>
>>Baoqiang Cao wrote:
>>
>>
>>> Original message 
>>>
>>>
>>>
Date: Thu, 14 Jul 2005 19:50:41 +0200
From: Uwe Ligges <[EMAIL PROTECTED]>  
Subject: Re: [R] East Asian language  
To: Nan Lin <[EMAIL PROTECTED]>
Cc: r-help@stat.math.ethz.ch

Nan Lin wrote:




>Dear all,
>
>I just installed R 2.1.1. The installation program
>>>
>>>automatically recognized 
>>>
>>>
>>>
>my Windows XP was using Chinese language, so now my R
>>>
>>>console displays 
>>>
>>>
>>>
>everything in Chinese. How can I still let R console
>>>
>>>display in English 
>>>
>>>
>>>
>without modifying my Window XP language setup? Thank you so
>>>
>>>much!
>>>
>>>
>>>
E.g. by setting the envrionment variable
LANGUAGE=en

>>>
>>>Or, like what I did, change XP language setting back to
>>>English from the control panel.
>>>
>>>
>>>
>>>
Uwe Ligges





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

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


Re: [R] exact values for p-values

2005-07-15 Thread S.O. Nyangoma


> there is no such thing as an "R lib".  
> Do you mean "R package"?

Yes. I usually refer to them R packages as as libraries, hence the use 
of lib.

Regards. Stephen.


> In any case, not it is not (yet).
> As David clearly says (a few lines below), it is a 'f90'
> library; which means it's "fortran 90" source code that you can
> compile and then use.
> 
> I've tried with gfortran (the latest avaiable on debian amd64
> sid) and it quickly ended in a compiler (!) error.
> 
>S> if so which version? How/where can I  download it?
> 
> Netlib has all the TOMS (= Transactions Of Mathematical Software)
> algorithms.  Look for '814'.
> 
> Regards,
> Martin
> 
>S> - Original Message -
>S> From: David Duffy <[EMAIL PROTECTED]>
>S> Date: Wednesday, July 13, 2005 9:46 am
>S> Subject: [R]  exact values for p-values
> 
>>> > This is obtained from F =39540 with df1 = 1, df2 = 7025.
>>> > Suppose am interested in exact value such as
>>> >
>>> 
>>> If it were really necessary, you would have to move to multiple
>>> precision.  The gmp R package doesn't seem to yet cover 
> this, but 
>>> FMLIB(TOMS814, DM Smith) is a multiple precision f90 
> library that 
>S> does
>>> include the incomplete beta -- it allows one to say for 
>>> F(1,7025)=39540,P=6.31E-2886 (evaluated using 200 sign. 
> digit 
>>> arithmetic).  Results from
>>> R's pf() agree quite closely with the FMLIB results for 
> less 
>>> extreme values
>>> eg
>>> > print(pf(1500,1,7025,lower=FALSE), digits=20)
>>> [1] 1.3702710894887480597e-297
>>> 
>>> cf   
> 1.37027108948832580215549799419452388134616261215463681945E-297
>>> 
>>> 
>>> | David Duffy (MBBS PhD)
> ,-
>S> _|\
>>> | email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -
> 0101  /  
>>> *
>>> | Epidemiology Unit, Queensland Institute of Medical 
> Research   
>>> \_,-._/
>>> | 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 
>>> 4D0B994A v
>>> 
>>> __
>>> R-help@stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide! http://www.R-
> project.org/posting-
>>> guide.html
> 
>S> __
>S> R-help@stat.math.ethz.ch mailing list
>S> https://stat.ethz.ch/mailman/listinfo/r-help
>S> PLEASE do read the posting guide! http://www.R-
> project.org/posting-guide.html
> 
> 
>S> !DSPAM:42d4da2c52151994935952!
>

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Uwe Ligges
Pingping Zheng wrote:

> Dear all,
> 
> I think what Nan Lin wanted is "How to change the language used in R
> console by re-setting something within R?"
> 
> For a non-english user, sometime we prefer to set the system default
> language to a native one and use english in individual programs when
> we think necessary.
> 
> a) setting the envrionment variable LANGUAGE=en will make an impact
>  on the whole system, which has its side effects.
> b) changing language setup through control panel is telling people to throw
>  away their native windows system, let's all use English system.
> 
> Any better idea?

What about setting LANGUAGE in .Renviron?
See ?.Renviron

Uwe Ligges


> 
> Pingping Zheng
> Department of Mathematics and Statistics
> Fylde College
> Lancaster University
> Lancaster LA1 4YF
> UK
> 
> 
> Baoqiang Cao wrote:
> 
>> Original message 
>>
>>
>>>Date: Thu, 14 Jul 2005 19:50:41 +0200
>>>From: Uwe Ligges <[EMAIL PROTECTED]>  
>>>Subject: Re: [R] East Asian language  
>>>To: Nan Lin <[EMAIL PROTECTED]>
>>>Cc: r-help@stat.math.ethz.ch
>>>
>>>Nan Lin wrote:
>>>
>>>
>>>
Dear all,

I just installed R 2.1.1. The installation program
>>
>>automatically recognized 
>>
>>
my Windows XP was using Chinese language, so now my R
>>
>>console displays 
>>
>>
everything in Chinese. How can I still let R console
>>
>>display in English 
>>
>>
without modifying my Window XP language setup? Thank you so
>>
>>much!
>>
>>
>>>E.g. by setting the envrionment variable
>>> LANGUAGE=en
>>>
>>
>>Or, like what I did, change XP language setting back to
>>English from the control panel.
>>
>>
>>
>>>Uwe Ligges
>>>
>>>
>>>
>>>
Best,

Nan

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

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


Re: [R] Fwd: Re: East Asian language

2005-07-15 Thread Pingping Zheng
Dear all,

I think what Nan Lin wanted is "How to change the language used in R
console by re-setting something within R?"

For a non-english user, sometime we prefer to set the system default
language to a native one and use english in individual programs when
we think necessary.

a) setting the envrionment variable LANGUAGE=en will make an impact
 on the whole system, which has its side effects.
b) changing language setup through control panel is telling people to throw
 away their native windows system, let's all use English system.

Any better idea?


Pingping Zheng
Department of Mathematics and Statistics
Fylde College
Lancaster University
Lancaster LA1 4YF
UK


Baoqiang Cao wrote:
> 
>  Original message 
> 
>>Date: Thu, 14 Jul 2005 19:50:41 +0200
>>From: Uwe Ligges <[EMAIL PROTECTED]>  
>>Subject: Re: [R] East Asian language  
>>To: Nan Lin <[EMAIL PROTECTED]>
>>Cc: r-help@stat.math.ethz.ch
>>
>>Nan Lin wrote:
>>
>>
>>>Dear all,
>>>
>>>I just installed R 2.1.1. The installation program
> 
> automatically recognized 
> 
>>>my Windows XP was using Chinese language, so now my R
> 
> console displays 
> 
>>>everything in Chinese. How can I still let R console
> 
> display in English 
> 
>>>without modifying my Window XP language setup? Thank you so
> 
> much!
> 
>>
>>E.g. by setting the envrionment variable
>>  LANGUAGE=en
>>
> 
> Or, like what I did, change XP language setting back to
> English from the control panel.
> 
> 
>>Uwe Ligges
>>
>>
>>
>>>Best,
>>>
>>>Nan
>>>
>>>__
>>>R-help@stat.math.ethz.ch mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide!
> 
> http://www.R-project.org/posting-guide.html
> 
>>__
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide!
> 
> http://www.R-project.org/posting-guide.html
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] exact values for p-values

2005-07-15 Thread Martin Maechler
> "S" == S O Nyangoma <[EMAIL PROTECTED]>
> on Wed, 13 Jul 2005 11:06:05 +0200 writes:

S> Hi David, Since I am looking at very extreme values, it appears I will 
S> need FMLIB. Is it an R lib? 

there is no such thing as an "R lib".  
Do you mean "R package"?

In any case, not it is not (yet).
As David clearly says (a few lines below), it is a 'f90'
library; which means it's "fortran 90" source code that you can
compile and then use.

I've tried with gfortran (the latest avaiable on debian amd64
sid) and it quickly ended in a compiler (!) error.

S> if so which version? How/where can I  download it?

Netlib has all the TOMS (= Transactions Of Mathematical Software)
algorithms.  Look for '814'.

Regards,
Martin

S> - Original Message -
S> From: David Duffy <[EMAIL PROTECTED]>
S> Date: Wednesday, July 13, 2005 9:46 am
S> Subject: [R]  exact values for p-values

>> > This is obtained from F =39540 with df1 = 1, df2 = 7025.
>> > Suppose am interested in exact value such as
>> >
>> 
>> If it were really necessary, you would have to move to multiple
>> precision.  The gmp R package doesn't seem to yet cover this, but 
>> FMLIB(TOMS814, DM Smith) is a multiple precision f90 library that 
S> does
>> include the incomplete beta -- it allows one to say for 
>> F(1,7025)=39540,P=6.31E-2886 (evaluated using 200 sign. digit 
>> arithmetic).  Results from
>> R's pf() agree quite closely with the FMLIB results for less 
>> extreme values
>> eg
>> > print(pf(1500,1,7025,lower=FALSE), digits=20)
>> [1] 1.3702710894887480597e-297
>> 
>> cf   1.37027108948832580215549799419452388134616261215463681945E-297
>> 
>> 
>> | David Duffy (MBBS PhD) ,-
S> _|\
>> | email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  /  
>> *
>> | Epidemiology Unit, Queensland Institute of Medical Research   
>> \_,-._/
>> | 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 
>> 4D0B994A v
>> 
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-
>> guide.html

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


S> !DSPAM:42d4da2c52151994935952!

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


Re: [R] Coxph with factors

2005-07-15 Thread Adaikalavan Ramasamy
Yes, and please show us a reproducible example or small section of the
data as well as the error output. 


On Thu, 2005-07-14 at 15:36 +, Dieter Menne wrote:
> Kylie-Anne Richards  itga.com.au> writes:
> 
> > 
> > I am fitting a coxph model with factors. I am running into problems when
> > using 'survfit'. I am unsure how R is treating the factors when I fit, say:
> > >DATA<-data.frame(time.sec,done,f.pom=factor(f.pom),po,vo)
> > >final<-coxph(Surv(time.sec,done)~f.pom*vo+po,data=DATA)
> > > final.surv<-survfit((final), individual=T,conf.type="log-log")
> > > print(final.surv)
> 
> 
> Better chances to get a reply when you tell us what problems you are running 
> into.
> 
> Dieter Menne
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Variance components from lm?

2005-07-15 Thread Prof Brian Ripley
In any case, the question was about lm, not lme.

The short answer is that this is easiest from aov, a wrapper for lm, and 
for balanced data will be equivalent to as using lme.  Steve can find 
worked examples for interlaboratory data in MASS (the book, see the FAQ).

On Thu, 14 Jul 2005, Spencer Graves wrote:

> Under normal circumstances, 'RSiteSearch("variance components")'
> would likely identify "lme" in package nlme and lmer in package lme4.  I
> recommend lme, as it comes with a fairly complete set of helper
> functions described in Pinheiro and Bates (2000) Mixed-Effect Models in
> S and S-Plus (Springer).  "lmer" is Doug Bates' next generation product
> currently under development and lacking some of the helper functions
> available with lme.
>
> spencer graves
> p.s.  I said, "Under normal circumstances", because when I tried
> RSiteSearch just now, it didn't work.  When I went to
> "www.r-project.org" -> Search -> "R site search", I got "Computer
> trouble, July 13, 2005".  When it works (which is 99.7% of the time), it
> is my favorite tool for finding things about R for which I don't already
> know where to look.
>
> Steve Ellison wrote:
>
>> I often use simple nested random-effect models for interlaboratory data.
>> The variance components are important things to know.
>>
>> Is there an R function or package that gets variance components from lm
>> objects? Or can someone point me to a method of doing so?
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
> -- 
> Spencer Graves, PhD
> Senior Development Engineer
> PDF Solutions, Inc.
> 333 West San Carlos Street Suite 700
> San Jose, CA 95110, USA
>
> [EMAIL PROTECTED]
> www.pdf.com 
> Tel:  408-938-4420
> Fax: 408-280-7915
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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