Re: [R] Excel

2007-08-30 Thread Austin, Matt

Ah . . . the hammer analogy.  In a conversation like this it's not a
question of will somebody drop it, it's when will it be dropped.


--Matt

Matt Austin
Statistician
Amgen, Inc.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Greg Snow
Sent: Thursday, August 30, 2007 12:14 PM
To: Erich Neuwirth; r-help
Subject: Re: [R] Excel


Earlier this week I was doing some work at our house and since my wife was
at the dentist office our 3 year old son was helping me.  He really wanted
to use the hammer, so I showed him where to tap and he was excited to tap
(not doing much good, but also not doing any damage).  He liked that so much
that he started to look for other things that he could use the hammer on,
some were benign, others made me jump in and stop him before he did major
damage.

What does this have to do with Excel and R?  Well I see Excel as being very
much like my hammer and different users like the different users of the
hammer.

There are some carpenters who can use a hammer along with other tools to
make things of pure beauty.  Simillarly, I expect there are people who can
use excel/spreadsheets along with other tools to make useful and beautiful
things (I expect that you (Erich) may be one of those).

My use of the hammer is far less than that of the experts, I can about 9
times out of 10 survive the use without blood and major bruising, fix or
make something that works, but is far  from a work of art.  My use of
spreadsheets is similar, I do use them for some specific purposes (holding
the bus schedule on my pda, amortization tables), but I know better than to
use them where I would cause more harm than good.

I fear that many users of Excel and other spreadsheets are much like my
toddler, they have a tool and they want to use it, ignorant of whether they
will cause more damage than good.  This is part of why I put in the
reference to Dr. Burns page, he does not say get rid of spreadsheet
altogether, but he points out that there are several cases where other tools
work better (It is possible to embed a screw in a piece of wood using a
hammer, but a screwdriver generally works better).

Erich Neuwirth wrote:

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Erich Neuwirth
 Sent: Wednesday, August 29, 2007 4:46 PM
 To: r-help
 Subject: Re: [R] Excel
 
 Greg Snow wrote:
  
   Or do you trust all of your clients to know to use 
 R(D)COM as well 
   as how to install and use it?
 
 Do you trust your clients to be fluent enough in R to use it?

I admitted that I don't trust some of my clients with their own data (I
think my record is 9 different sexes), I certainly don't expect them to use
R.  I trust them to bring their questions and data to me, then I use R (or
one of my coworkers uses their favorite stats package) to help them.  That
way I know that the correct things are being done (on the flip side, they
trust me to leave patient care up to them and not try surgery myself, it is
much better for the patients that way).

 For most of my clients, that is not true.
 For this kind of users, the following strategy works.
 They have their data in Excel, and I write some macros in 
 Excel which use RExcel to compute results and put them in the sheet.
 The clients press buttons similar to what they would do with 
 the Analysis toolpack in Excel, but they get the full power of R.

Who installs R and sets up R dcom on all these computers?

If the above clients want something in addition to what you prepared, do you
add additional macros for them?  Do they know enough R to write their own
Rapply statement? Or do they go looking in the Excel help and use the wrong
set of tools?  Or do you have them trained enough that they don't ask any
additional questions?
 

I have no problem with you using this approach, I just think that if you are
going to advocate that others use excel with clients, that you also let them
know of the extra work that they may be committing themselves to.




 
  
   The formula
   =RApply(var,A1:A1000) in an Excel cell for example 
 will use R to 
   compute the variance of the data in column A in Excel.
   If you change any of the values in the range A1:A1000 will 
   automatically recompute the variance.
  
   And what happens when you enter a value in cell A1001?
 
 If you use the following formula
 =RApply(var,DownFrom(A1))
 
 where DownFrom ist he following function defined in VBA
 
 Function DownFrom(startcell As Range) As Range
 Application.Volatile
 Set DownFrom = Range(startcell, startcell.End(xlDown)) 
 End Function
 
 Then writing a value in A1001 will a extend the range to 
 which the function var is applied.

So to answer a known inconsistancy in spreadsheets, you are now bringing in
a 3rd program/language.  At what point is it just simpler to use R directly?
(for me it was back a couple of steps).


 Arguments of worksheet function can be dynamic ranges, but 
 sadly this is a 

[R] Unexpected behavior in boxplot

2006-11-11 Thread Austin, Matt
When plotting using the cex.axis argument to boxplot(), the size of the
plotting symbols beyond the whiskers of the boxplot are being changes.

 

Example:

 

par(mfrow=c(2,1))

boxplot(c(rnorm(10), 10), horizontal=TRUE, main=Test, las=2, cex.axis=2)

boxplot(c(rnorm(10), 10), horizontal=TRUE, main=Test, las=2, cex.axis=1)  

 

This is from the following line in bxp()

 

outcex - pcycle(pars$outcex, pars$cex, par(cex))

 

Where pars$cex is matching pars$cex.axis.  This would also effect other
parameter specifications.

 

This is a behavior I did not expect; I'm not sure if this is a design
feature or something else.

 

--Matt

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431 
The purpose of computing is insight, not numbers --Richard Hamming 

 


[[alternative HTML version deleted]]

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


Re: [R] Unexpected behavior in boxplot

2006-11-11 Thread Austin, Matt
Apologies for the html mail, my company just upgraded and I forgot to change
the default mail behavior.

Version information that I also forgot:

 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.0 
year   2006
month  10  
day03  
svn rev39566   
language   R   
version.string R version 2.4.0 (2006-10-03)

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Austin, Matt
Sent: Saturday, November 11, 2006 8:15 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Unexpected behavior in boxplot

When plotting using the cex.axis argument to boxplot(), the size of the
plotting symbols beyond the whiskers of the boxplot are being changes.

 

Example:

 

par(mfrow=c(2,1))

boxplot(c(rnorm(10), 10), horizontal=TRUE, main=Test, las=2, cex.axis=2)

boxplot(c(rnorm(10), 10), horizontal=TRUE, main=Test, las=2, cex.axis=1)  

 

This is from the following line in bxp()

 

outcex - pcycle(pars$outcex, pars$cex, par(cex))

 

Where pars$cex is matching pars$cex.axis.  This would also effect other
parameter specifications.

 

This is a behavior I did not expect; I'm not sure if this is a design
feature or something else.

 

--Matt

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431 
The purpose of computing is insight, not numbers --Richard Hamming 

 


[[alternative HTML version deleted]]

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

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


Re: [R] Help with sample function

2006-06-07 Thread Austin, Matt
I couldn't help but respond to this one, it's not often I see my own name.

Using data from the survival library:

library(survival)
lung[1:10, c('time', 'status')]
Surv(lung$time, lung$status)[1:10]

--Matt

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Matthew Austin
Sent: Wednesday, June 07, 2006 6:57 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Help with sample function


I have generated some some survival times and censoring indicators. 
Thus I have an ordered pair for each observation. How do I sample these 
ordered paris? I only know how to sample from a vector? I would 
appreciate any help I could get.

Thanks
Matt

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

__
R-help@stat.math.ethz.ch 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] Reading SPSS .sav files

2006-04-16 Thread Austin, Matt
I don't use SPSS, so I can't help with the details.  That being said, have
you looked at the foreign package?

--Matt

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of David Kaplan
Sent: Sunday, April 16, 2006 1:35 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Reading SPSS .sav files


Greetings,

How to I read in SPSS .sav files into R.  

Thank you.

David


=
David Kaplan, PhD  
Professor of Education   
School of Education   
University of Delaware  
Newark DE 19716

Voice: 302-831-8696
Fax:302-831-4110 
email:  mailto:[EMAIL PROTECTED] 
Homepage: http://www.udel.edu/dkaplan   
SOE page:  http://www.udel.edu/educ

__
R-help@stat.math.ethz.ch 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] How can I pass a R matrix as parameter to C code?

2006-03-20 Thread Austin, Matt
You need to pass it as a vector and then you can convert to an array
structure in C.  Look at carray.c for one way to do this, there are others.
Browse the source code and see how different authors handle your problem.

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of johan Faux
Sent: Monday, March 20, 2006 1:13 PM
To: r-help
Subject: [R] How can I pass a R matrix as parameter to C code?


Hello, 
   
  Is it possible to pass R matrix as a parameter to an internal C procedure?
  From the documentation I got the impression that only 1-dim vectors can be
passed. 
  Why the following wont work for me?
   
   
   a-matrix(1:15,3,5)
 .C(pr,as.integer(a))
   
  void pr(int **a){
  a[1][1]=100;
}
   
   
  Thanks,
  Johan
   


-


[[alternative HTML version deleted]]

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

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


Re: [R] How to add two different axis to one plot?

2006-01-29 Thread Austin, Matt
Using traditional graphics you probably want to look at

?lines, ?points, ?text . . . 

These allow you to add to your plot without calling new axes.

For custom axes:

plot(1:10, 1:10, axes=FALSE)
lines(1:10, 10:1)
points(1:10, runif(10, 2, 5), col=1, pch=21, bg=3, cex=3)
axis(1, at=1:10)
axis(3, at=1:10, lab=10:1)
axis(2)
box()

Look  at ?axis for details.

--Matt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Michael
Sent: Sunday, January 29, 2006 8:49 PM
To: [EMAIL PROTECTED]
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] How to add two different axis to one plot?


No this is not good.

When I used par(new=TRUE), it does not adjust axis accordingly...

Thus two different axes end up overlap together.

For example, if my first plot has x-axis from 0 to 10, with ticks at 1, 3,
5, 7, 9;

and my second plot has x-axis from 2 to 12, with ticks at 2, 2.9, 5.5...

then the two plots have two different axes with ticks overlap together.

The visual appearance is very bad.

On 1/29/06, Andrew Robinson [EMAIL PROTECTED] wrote:

 Use the axis() command to add custom axes.

 To hold the plot, insert

 par(new=TRUE)

 between the plot statements, thus:

 plot(x1, y1, etc ...)
 par(new=TRUE)
 plot(x2, y2, etc ...)



 Andrew

 On Mon, January 30, 2006 2:49 pm, Michael said:
  Hi all,
 
  I need to put two different axis to one plot. On the top of the plot, I
  need
  to put one axis, with increments from left side to the right side; then
 at
  the bottom of the same plot, I need to put another axis, with increments
  from right side to the left side and showing a different unit. How do I
 do
  that?
 
  By the way, is there a hold command for plotting?
 
  If I first plot a picture, how to add another plot command onto it
  without
  erasing it?
 
  In matlab, it can be convinient done by hold on and hold off... and
  can
  I do it in R?
 
  Thanks a lot,
 
  Micheal
 
[[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
 


 Andrew Robinson
 Senior Lecturer in Statistics   Tel: +61-3-8344-9763
 Department of Mathematics and StatisticsFax: +61-3-8344 4599
 University of Melbourne, VIC 3010 Australia
 Email: [EMAIL PROTECTED]Website:
 http://www.ms.unimelb.edu.au



[[alternative HTML version deleted]]

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

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


Re: [R] question about system command

2006-01-25 Thread Austin, Matt
Something like this.

See ?formatC, ?paste

for (i in 1:100)
{
system(paste(C:\\Progra~1\\DOSPROGRAM\\RUN.exe input,
  formatC(i, digits=2, flag='0'),
  '.dat',
  sep=''))
}

--Matt
Statistician
Amgen, Inc


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Taka Matzmoto
Sent: Wednesday, January 25, 2006 9:31 PM
To: r-help@stat.math.ethz.ch
Subject: [R] question about system command


Hi R Users
I am going to write a very short script for my small pilot simulation study.
I need to call a DOS program with different input data files in the middle 
of for loop.
There are 100 input data files (e.g., input001.dat, input002.dat,  , 
input100.dat)

for (1 in i :100)
{
system('C:\\Program Files\\DOSPROGRAM\\RUN.exe input001.dat')
}

I like to change the input data file name as for loop runs. How can I do 
that ?

Thanks in advance

TM

__
R-help@stat.math.ethz.ch 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] multiple lowess line in one plot

2006-01-04 Thread Austin, Matt
Try using the panel.plsmo function in Dr. Harrell's Hmisc package.

xyplot(AWGT ~ lipid, groups = var_name, panel=panel.plsmo)

--Matt

Matt Austin

Statistician
Amgen, Inc.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dean Sonneborn
Sent: Wednesday, January 04, 2006 8:54 AM
To: r-help@stat.math.ethz.ch
Subject: [R] multiple lowess line in one plot


I'm using this code to plot a smoothed line.  These two columns of data 
really represent 4 groups and I'd like to plot a separate line for each 
group but have them all in the same plot. The R-Docs for lowess do not 
seem to indicate some type of GROUPS=var_name option. What would be 
the syntax for this?

plot(AWGT ~ lipid )
lines(lowess(lipid , AWGT, f=.8))


-- 
Dean Sonneborn, MS
Programmer Analyst
Department of Public Health Sciences
University of California, Davis
(530) 754-9516

__
R-help@stat.math.ethz.ch 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] How do I edit the x-axis on a time series plot?

2005-12-21 Thread Austin, Matt
Phil,

Does the following do what you want?

plot(RecfS,
 ylab = 'Temperature (deg C)',
 xlab = 'Year',
 main = 'Average air temperature (deg C) at Recife, Brazil, in
successive months from 1953 to 1962',
 adj = 0.5,
 axes=FALSE)

axis(1, at=1952:1962, label=paste(Jan, 52:62), las=2)
axis(2)
box()

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Philip Turk
Sent: Tuesday, December 20, 2005 8:37 PM
To: r-help@stat.math.ethz.ch
Subject: [R] How do I edit the x-axis on a time series plot?


I am merely trying to reproduce Figure 1.2 of Chris Chatfield's 6th 
edition of his The Analysis of Time Series: An Introduction (page 2). 
The S-PLUS code is on pages 305-306. I am almost there but I am having a 
heck of a time trying to modify and change the x-axis per the book. The 
book shows the x-axis with 10 tick marks, correctly positioned, and 
labeled Jan 53, ..., Jan 62. I have not provided the data for the 
sake of brevity although it is readily available at 
http://www.bath.ac.uk/~mascc/Recife.TS

Can anyone help?

recife - as.vector(t(recife))
RecfS - ts(recife, start = c(1953,1), frequency = 12) 
plot(RecfS, ylab = “Temperature (deg C)”, xlab = “Year”, main = “Average 
air temperature (deg C) at Recife, Brazil, in successive months from 
1953 to 1962”, adj = 0.5)

Thanks,

Philip Turk


__
R-help@stat.math.ethz.ch 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] Impaired boxplot functionality - mean instead of median

2005-12-01 Thread Austin, Matt

Check your syntax on the bwplot call.

fa - data.frame(doz=sample(500:2000, size=500), fabp2=rep(1:20, 25))

bwplot(factor(fabp2) ~ doz, data=fa, panel=panel.bpplot)

fa.sum -  summarize( fa$doz, list( fabp2 = fa$fabp2), smean.sd,
stat.name=doz)

Dotplot( factor(fabp2) ~ Cbind(doz, doz - SD, doz + SD) , data=fa.sum)

You can ignore the warning, I'm sure Dr. Harrell has already fixed that
issue.

--Matt 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Behalf Of Evgeniy Kachalin
 Sent: Thursday, December 01, 2005 2:43 PM
 To: Frank E Harrell Jr
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Impaired boxplot functionality - mean 
 instead of median
 
 
 Frank E Harrell Jr пишет:
  Evgeniy Kachalin wrote:
  
  Marc Schwartz (via MN) пишет:
 
  Marc Schwartz (via MN) пишет:
 
 
  
  library(Hmisc)
  library(lattice)
  ?panel.bpplot
  
  bwplot(, panel=panel.bpplot)
  
  By default, panel.bpplot shows the mean (dot) and median 
 (line) plus 
  several quantiles.  To bother Martin in a friendly way, I 
 think that 
  means  can be useful additions - not that they are so useful by 
  themselves, but that when they differ a lot from the median, 
  non-statisticians gain further information about asymmetry. 
  Also, even 
  though the simple box plot is elegant, I sometimes think it 
 has a high 
  ink to information ratio.  I have gained a lot from seeing outer 
  quantiles on the plot, and I don't like to show outer 
 points for fear of 
  someone labeling them outliers.  For describing raw data 
 distributions, 
  I never find standard deviations useful, however.
  
 
 = fa
   doz fabp2
 1900 2
 4   1500 2
 6   1000 2
 8750 3
 10   750 1
 11  1750 2
 12   500 3
 
 
 
 
 
 
   bwplot(doz~factor(fabp2),data=fa,panel=panel.bpplot)
 Error in sort(x, partial = unique(c(lo, hi))) :
  unsupported options for partial sorting
 
 
 That's NOT simple way.
 
 I need just one change.
 Is there any good way?
 $-(
 
 -- 
 Evgeniy
 
 __
 R-help@stat.math.ethz.ch 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] floor()

2005-11-29 Thread Austin, Matt
I believe this is a FAQ.

Examine:

 format((5.05-floor(5))*100, nsmall=16)
[1] 4.9822

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Werner Bier
 Sent: Tuesday, November 29, 2005 3:35 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] floor()
 
 
 Dear All,

   Is this right? 

 floor((5.05-floor(5))*100)
 [1] 4
 
   I would expect 5, or am I wrong?

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


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


Re: [R] rotated ylab with xyplot

2005-11-28 Thread Austin, Matt
Try

library(grid)
xyplot(y~x,data.frame(x=1:10,y=runif(10)), ylab=textGrob(label=my label,
rot=0))

Note in the ?xyplot the xlab/ylab section points to the 'main' parameter
where it defines that a list can be used, however string rotation parameters
are not in the list.  The helpfile notes that a grob object can be used.

The reference for lattice and grid is R Graphics by Paul Murrell.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Viet Nguyen
 Sent: Monday, November 28, 2005 8:33 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] rotated ylab with xyplot
 
 
 hi all,
 
 in R, what's the best way to have a rotated ylab in a graph 
 plotted with 
 either xyplot or xYplot?  I tried this but it didn't work.
 
 xyplot(y~x,data.frame(x=1:10,y=runif(10)),ylab=list(srt=90,crt
 =90,rot=90,label=my label))
 
 
 more generally, how do you output a text at an angle in a 
 lattice graph?
 
 what would be a good reference for R lattice graphics?  I 
 need more help 
 than the help pages provide.
 
 thank you in advance.
 
 vn
 
 __
 R-help@stat.math.ethz.ch 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] On survival curve scale

2005-11-20 Thread Austin, Matt
In the helpfile, look at the ymin argument to the plot method for survfit.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Zhaojing Gong
 Sent: Sunday, November 20, 2005 6:47 PM
 To: R-help@stat.math.ethz.ch
 Cc: Zhaojing Gong
 Subject: [R] On survival curve scale
 
 
 Hello, everyone,
 
 I was wondering if you can kindly help me to set the scale in the 
 plot.survfit, whose default range is (0,1). In my case, I 
 need to set at 
 (0.8,1). I have tried plot.window with ylim=(0.8,1) but it 
 did not work.
 
 Many thanks in advance.
 
 
 -- 
 Zhaojing Gong
 Ph D. student in Statistics
 The Department of Mathematics and Statistics
 University of Canterbury
 New Zealand
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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

2005-11-18 Thread Austin, Matt
Warning:  non-expert thoughts to follow.

When passing an object to a predict method, the method looks at (a copy) of
the original information from the dataframe that was used in the fit.  Your
original data contains information on trt1 and trt2, but factor(trt1) and
factor(trt2) cannot be found in the original data.  If you did the factor
conversion in the original data 

myDat - factor(myDat$trt1)
myDat - factor(myDat$trt2)

then used myDat as the dataframe in the nlme call, all information would be
available for the augPred method.  That's why it works when you use trt1 and
trt2 instead of factor(trt1) and factor(trt2).  There is actually an
implicit factor conversion happening in the nlme call if trt1 and trt2 are
character variables, however if trt1 and trt2 are defined as numeric (ie 0
1) then it will fit as a numeric.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Christian Mora
 Sent: Friday, November 18, 2005 4:01 AM
 To: Spencer Graves
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] nlme questions
 
 
 
 
 
 
 
 Spencer;
 
 Thanks for your suggestions. I found the problem is in the 
 library nlme. If
 you define phi1~factor(trt1)+factor(trt2) instead of 
 phi1~trt1+trt2 the
 augPred function works. A bug? I don't know.
 
 Christian
 
 
 
 
 
 
 Spencer Graves [EMAIL PROTECTED] on 17-11-2005 20:19:32
 
 To:Christian Mora [EMAIL PROTECTED]
 cc:r-help@stat.math.ethz.ch
 
 Subject:Re: [R] nlme questions
 
 
Both your questions seem too vague to me.  You might get 
 more useful
 replies if you provide a simple example in a few lines of R 
 code that a
 reader could copy from your email into R and see the result (as
 suggested in the posting guide! 
 www.R-project.org/posting-guide.html).
   The process of preparing such a simple example might by 
 itself provide
 the insight you desire.  Alternatively, you might work line by line
 through the code for the R function you are using.  Also, if you don't
 have Pinheiro and Bates (2000) Mixed-Effects Models in S and S-PLUS
 (Springer), I suggest you get it;  it is excellent for things 
 like this.
 
I'm sorry I couldn't help more.
spencer graves
 
 Christian Mora wrote:
 
 
 
 
  Dear R users;
 
  Ive got two questions concerning nlme library 3.1-65 
 (running on R 2.2.0
 /
  Win XP Pro). The first one is related to augPred function. Ive been
 working
  with a nonlinear mixed model with no problems so far. 
 However, when the
  parameters of the model are specified in terms of some 
 other covariates,
  say treatment (i.e. phi1~trt1+trt2, etc) the augPred 
 function give me the
  following error: Error in predict.nlme(object,
  value[1:(nrow(value)/nL),,drop=FALSE], : Levels 0,1 not 
 allowed for trt1,
  trt2. The same model specification as well as the augPred 
 function under
  SPlus 2000 run without problems. The second question has to 
 deal with the
  time needed for the model to converge. It really takes a 
 lot of time to
 fit
  the model on R in relation to the time required to fit the 
 same model on
  SPlus. I can imagine this is related to the optimization 
 algorithm or
  something like that, but I would like to have a different opinion on
 these
  two issues.
 
  Thanks in advance
 
  Christian Mora
 
  __
  R-help@stat.math.ethz.ch 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 http://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


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


Re: [R] Using pakage foreign and to import SAS file

2005-11-14 Thread Austin, Matt
If sas isn't in the path, then you might have trouble with sas.get or
read.ssd.

Assuming you are using windows, go to the Start menu, select run and type
sas.  If sas fires up it's in your path, if not then that is the reason.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Rick Bilonick
 Sent: Monday, November 14, 2005 8:22 PM
 To: Walter R. Paczkowski
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Using pakage foreign and to import SAS file
 
 
 On Mon, 2005-11-14 at 22:55 +, Walter R. Paczkowski wrote:
  Hi,
  
  I'm struggling with foreign to import a SAS file.  The 
 file, for lack of imagination, is d.sas7bdat and is in my 
 root directory (c:\) under Windows XP.  When I type
  
  read.ssd(c:\\, d)
  
  which I think I'm suppose to enter, I get
  
  SAS failed.  SAS program at 
 C:\DOCUME~1\Owner\LOCALS~1\Temp\Rtmp32758\file19621.sas 
  The log file will be file19621.log in the current directory
  NULL
  Warning messages:
  1: sas not found 
  2: SAS return code was -1 in: read.ssd(c:\\, d) 
  
  I have SAS 9.1 running on my computer so SAS is there.  
 What am I doing wrong?
  
  Thanks,
  
  Walt
  
  
 I've not used read.ssd but I've had good results with sas.get 
 in Hmisc.
 
 Rick B.
 
 __
 R-help@stat.math.ethz.ch 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] ltext - adding text to each panel from a matrix

2005-11-10 Thread Austin, Matt
Haven't checked it too carefully, but how about:

bwplot(treatment~foo|group, data = dat,
   panel=function(x,y,...) {
   panel.violin(x,y, ..., col = transparent, varwidth = F)
   gt0 - table( x  0, y)
   panel.abline(v=0, lty = dotted)
   grid.text(as.character(gt0[1,]), unit(1, 'lines'), unit(1:3,
'native'), just='left')
   grid.text(as.character(gt0[2,]), unit(1, 'npc') - unit(1,
'lines'), unit(1:3, 'native'), just='left')
   },
   par.strip.text = list(cex = 0.8),  xlim = my.xlim)


--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Andy Bunn
 Sent: Thursday, November 10, 2005 8:19 AM
 To: R-Help
 Subject: [R] ltext - adding text to each panel from a matrix
 
 
 Hi all (really probably just Deepayan):
 
 In the plot below I want to add text on either side of each 
 violin plot that
 indicates the number of observations that are either positive 
 or negative.
 I'm trying to do this with ltext() and I've also monkeyed about with
 panel.text(). The code below is generally what I want but my calls to
 ltext() are wrong and I'm not sure how to fix them. Right now 
 they replicate
 the first column of the matrices obs.pos and obs.neg for each 
 panel. How do
 I tell ltext to advance to the next column when the next 
 panel is plotted? I
 don't see how subscripts can do it, but I bet it's something 
 along that
 line...
 
 Thanks, Andy
 
 rm(list = ls())
 set.seed(354)
 # make a bimodal dataset with three groups and three treatments
 foo - c(rnorm(150,-1,0.5), rnorm(150,1,0.25))
 treatment - factor(rep(seq(1,3),100), labels = c(Treatment 
 1, Treatment
 2, Treatment 3))
 group - factor(rep(seq(1,3),100), labels = c(Group A, 
 Group B, Group
 C))
 group - sample(group)
 # corrupt Group A, Treatment 2 for fun.
 foo[group==Group A  treatment==Treatment 2][1:8] - rnorm(8,1,1)
 dat - data.frame(foo,treatment,group)
 
 # set the limits for the plot, which also tells where to put the text
 my.xlim - c(-6, 6)
 
 # make a matrix that counts the number of obs greater or less 
 than zero
 obs.pos - tapply(dat[dat[,1]  0,1], dat[dat[,1]  0,-1], length)
 obs.neg - tapply(dat[dat[,1] = 0,1], dat[dat[,1] = 0,-1], length)
 #write some coordinate data
 x.obs.pos - rep(my.xlim[2],dim(obs.pos)[2])
 y.obs.pos - 1:dim(obs.pos)[2]
 x.obs.neg - rep(my.xlim[1],dim(obs.neg)[2])
 y.obs.neg - 1:dim(obs.neg)[2]
 
 bwplot(treatment~foo|group, data = dat,
panel=function(...) {
panel.violin(..., col = transparent, varwidth = F)
panel.abline(v=0, lty = dotted)
ltext(x.obs.pos, y.obs.pos, obs.pos, pos = 2)
ltext(x.obs.neg, y.obs.neg, obs.neg, pos = 4)
},
par.strip.text = list(cex = 0.8),  xlim = my.xlim)
 obs.pos
 obs.neg
 
 # note that the numbers in the plot only match the matrices 
 for Group A,
 # which is the first panel. Alas.
 
 __
 R-help@stat.math.ethz.ch 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] Use of paste with apply()

2005-11-06 Thread Austin, Matt
The apply function is passing each row of you matrix as a single vector into
paste.  If paste receives a single vector and collapse is NULL, it will
simply coerce the vector into a character vector. 

However, when you collapse instead of sep

 test - matrix( as.character(1:4), 2)
 apply(test, 1, paste, sep=+)
 [,1] [,2]
[1,] 1  2 
[2,] 3  4 

 apply(test, 1, paste, collapse=+)
[1] 1+3 2+4

Which may be closer to what you were expecting, but I'm just guessing.

--Matt


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Kjetil 
 Brinchmann
 halvorsen
 Sent: Sunday, November 06, 2005 5:34 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Use of paste with apply()
 
 
 I was surprised by:
 
   test - matrix( as.character(1:4), 2)
   test
   [,1] [,2]
 [1,] 1  3
 [2,] 2  4
   apply(test, 1, paste, sep=+)
   [,1] [,2]
 [1,] 1  2
 [2,] 3  4
   apply(test, 1, paste, sep=*)
   [,1] [,2]
 [1,] 1  2
 [2,] 3  4
   te - matrix(1:4, 2)
   te
   [,1] [,2]
 [1,]13
 [2,]24
   apply(te, 1, sum)
 [1] 4 6
 
 Why doesn't paste behave in apply as sum?
 
 Kjetil
 
 
 -- 
 
 Checked by AVG Free Edition.
 
 __
 R-help@stat.math.ethz.ch 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] Still a bug with NA in sd() or var()?

2005-10-31 Thread Austin, Matt
The behavior is actually documented in the var() help file (?var), although
it's not clear that this would be the behavior if you just read ?sd.  sd()
does call var if you look at the code, so the behavior should not be
unexpected.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Roger Dungan
 Sent: Monday, October 31, 2005 1:24 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Still a bug with NA in sd() or var()?
 
 
 Dear R-users,
 
 Running R 2.1.1 in WindowsXP, there seems to be a 'bug' in sd()
 If
 x-c(1,2,3,NA,5)
 mean(x) 
 [1] NA
 
 But 
 sd(x) 
 Or
 var(x)
 give
 Error in var(x, na.rm = na.rm) : missing observations in cov/cor
 
 There are obvious work-rounds, like
 sd(x, is.na(x)==F)
 which gives the result (with error message)
 [1] 1.707825
 Warning message:
 the condition has length  1 and only the first element will 
 be used in:
 if (na.rm) complete.obs else all.obs
 
 or
 
 y-subset(x, is.na(x)==F)
 sd(y)
 [1] 1.707825
 
 Am I missing something, or is this a problem with sd()? Why 
 does mean(x)
 give a simple NA, but var(x) requires some additional work? There was
 some previous discussion in r-help about this for R v 1.6.0, with
 mention of a fix for 1.6.1. 
 
 Dr Roger Dungan
 School of Biological Sciences
 University of Cantebury
 Christchurch, New Zealand
 ph +64 3 366 7001 ext. 4848
 fax +64 3 364 2590
 
 __
 R-help@stat.math.ethz.ch 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] why does glm.predict give values over 1 ?

2005-10-31 Thread Austin, Matt
If you left the type argument to the predict method then your predictions
are on the log-odds scale.  Try using the type='response' in the predict
method for glm.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Rohit Singh
 Sent: Monday, October 31, 2005 2:52 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] why does glm.predict give values over 1 ?
 
 
 Hi,
 
  This is a newbie question. I have been using glm to perform 
 some logistic
 regression. However, if I take the fitted parameters (as part 
 of the glm
 object) and pass them on the glm.predict function, for some 
 test cases I
 am getting predicted values that are a little over 1.  This is a bit
 puzzling for me, because my understanding was that these numbers are
 probabilities and so should be between 0 and 1.
 
 
 Thanks a lot! I'd appreciate any help you could provide.
 
 -rohit
 
 __
 R-help@stat.math.ethz.ch 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] adding error bars to lattice plots

2005-10-20 Thread Austin, Matt
Have you looked at xYplot and panel.xYplot from Dr. Harrell's Hmisc package?

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Mario
 Aigner-Torres
 Sent: Thursday, October 20, 2005 9:52 AM
 To: Berton Gunter; r-help@stat.math.ethz.ch
 Subject: Re: [R] adding error bars to lattice plots
 
 
 Thanks Bert!
 
 I have right now a dataset that looks like this:
 
  tail(partition, 3)
 element run logfO2 TC buffer xAn sdXan Di Disigma
 416 Al 36 -0.68 1180 AIR 0.734 0.007 2.10 0.02
 417 Ca 36 -0.68 1180 AIR 0.734 0.007 1.29 0.02
 418 Na 36 -0.68 1180 AIR 0.734 0.007 1.16 0.06
 
 Basicaly I would like to insert error bars into a xyplot like this
 
  xyplot(log10(Di) ~ TC | element.ord, groups=buffer.ord, #pch=16,
 + #subset=no1140,
 + data=partition,
 + auto.key=list(columns=3),
 + )
 
 How could llines, lsegments or perhaps panel.arrows look like?
 
 I appreciate any help on this.
 
 Best regards,
 
 Mario
 
 
 On 10/19/05, Berton Gunter [EMAIL PROTECTED] wrote:
 
  ?llines, lsegments and the like can be used in the panel 
 functions to draw
  any sort of error bar that you can compute from the x,y,... 
 data of the
  panel.
 
  -- Bert Gunter
  Genentech Non-Clinical Statistics
  South San Francisco, CA
 
  The business of the statistician is to catalyze the 
 scientific learning
  process. - George E. P. Box
 
 
 
   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Mario
   Aigner-Torres
   Sent: Wednesday, October 19, 2005 2:34 PM
   To: r-help@stat.math.ethz.ch
   Subject: [R] adding error bars to lattice plots
  
   Dear R-Users,
  
   how to include error bars within lattice?
   How should the panel = function(x,y,...){
   looks like?
   Does panel.arrows works here as well?
  
   I appreciate any help on this.
  
   Regards,
  
   Mario AT
  
   [[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
  
 
 
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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


Re: [R] what OS

2005-09-13 Thread Austin, Matt
.Platform$OS.type

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Omar Lakkis
 Sent: Tuesday, September 13, 2005 11:30 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] what OS
 
 
 How can I determine whT OS I am running under?
 
 if WINDOWS do this 
 if LINUX do that
 
 __
 R-help@stat.math.ethz.ch 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] Plot of multiple data sets

2005-09-09 Thread Austin, Matt
The book is out--I received mine a few weeks ago.  It is very useful.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Chris 
 Buddenhagen
 Sent: Friday, September 09, 2005 6:30 AM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] Plot of multiple data sets
 
 
 I found a lot of answers at this type of problem website wrt 
 graphics and
 multiple plots- I bet the book will be useful when it comes out.
 
  
 
 http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html
 
  
 
 Chris Buddenhagen, Botany Department, Charles Darwin Research 
 Station, Santa
 Cruz,Galapagos. Mail: Charles Darwin Foundation, Casilla 
 17-01-3891 Avenida
 6 de Diciembre N36-109 y Pasaje California Quito, ECUADOR
 
  
 
 
 
 
 
 __
 EL CONTENIDO DE ESTE MENSAJE ES DE ABSOLUTA RESPONSABILIDAD DEL AUTOR.
 FUNDACION CHARLES DARWIN
 WWW.DARWINFOUNDATION.ORG
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


RE: [R] lme How to validate a model with a validation set and a t est set

2005-05-11 Thread Austin, Matt

If you used all 28 animals to find the model out of a group of candidate
models, I would have my reservations about this 'validation'.  Any
confidence intervals you get from the final model are bound to be overly
optimistic because you haven't accounted for the degrees of freedom chewed
up during the model fitting/finding process.

Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431

Today has the fatigue of a Friday and the desperation of a Monday  -- S.
Pearce 2005


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Laurent Fanchon
Sent: Wednesday, May 11, 2005 9:56 AM
To: r-help@stat.math.ethz.ch
Subject: [R] lme How to validate a model with a validation set and a
test set


Dear all,

I am still trying to fit a model for habituation with lme (Dogs are 
trotting on a treadmill once a week during 4 consecutive weeks).
I have maybe found a good one.
In order to validate it, I would like to split my data.
I have 28 dogs, I am thinking to build the model with 20 and use the 
remaining 8 to validate it.

Is it a good method to validate the model?
How can I do this?

I would like to use the data from the first 2 weeks as input and see how 
good the model is to predict the data from the last 2 weeks.
I tried to use predict but this function does not take into account the 
data from the first 2 weeks. I can only get the results for the population.

I would appreciate any suggestions for this

Thank for your help

Laurent

__
R-help@stat.math.ethz.ch 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] Help with MERGE gratefully accepted

2005-04-14 Thread Austin, Matt
 dat1 - data.frame(var1=c(140, 151, 167), var2=c(30.1, 11.4, 40))
 dat2 - data.frame(var1=c(140, 167), var3=c(5.7, 30.3))
 merge(dat1, dat2, all=TRUE)
  var1 var2 var3
1  140 30.1  5.7
2  151 11.4   NA
3  167 40.0 30.3


Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431

Today has the fatigue of a Friday and the desperation of a Monday  -- S.
Pearce 2005


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Briggs, Meredith M
Sent: Thursday, April 14, 2005 18:26 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Help with MERGE gratefully accepted






Hello

How do I use function 'MERGE to combine the FILE A and FILE B below to make
FILE C?

Thank you



 FILE A  
140151167   
30.1 11.4   40 

FILE B

140   167   
5.7  30.3

FILE C

140151167   
30.1 11.4  40   
5.7   NA30.3

__
R-help@stat.math.ethz.ch 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] One mixed effects model for two variables

2005-03-07 Thread Austin, Matt
Here are two possibilities, but neither tests simultaneously--others may
have those suggestions.  

1.  If one of the variables in clinically more important than the other,
consider a stepdown procedure where the more important is tested first, then
if the first is successful the second is tested.  Procedures such as this
are well documented in the literature.

2.  Find a function of the two that has a clinical interpretation and model
that response. Body mass index is an example of such a function (kg/m^2),
but probably is not an endpoint that would be of interest in a growth study
in pediatrics.

Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431

Today has the fatigue of a Friday and the desperation of a Monday  -- S.
Pearce 2005


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Dominik 
 Grathwohl
 Sent: Monday, March 07, 2005 17:18 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] One mixed effects model for two variables
 
 
 Hello R-help group,
 
 I need some suggestions in stating a mixed effects model. I 
 would like to
 fit one mixed effect model to two or more variables and than 
 investigating
 treatment effects by applying the multcomp library. I will explain my
 problem along an example of weight and length measurements on infants.
 Weight and length  are measured at two occasions in time and for two
 treatment groups, one group got some experimental formula and 
 the other some
 control formula. It is also reasonable to assume that weight 
 and length are
 correlated. Aim is to estimate the treatment effect on weight 
 and on length
 taking multiplicity into account. 
 Below I generated some data of the proposed properties and I 
 applied also
 two mixed effects models, one model for weight and one for 
 length. Up to now
 I#8217;m not able to state a model for both variables together, any
 suggestions?
 
 library(nlme)
 
 n - 200# n = number of subjects
 id - rep(1:n, each=2)  # id = subject identification number
 t - rep(0:1, times=n)  # two occations in time
 trt - rep(sample(rep(0:1, times=n/2)), each=2) # two treatment groups
 b1 - rnorm(n, mean=0, sd=0.5)  # b1 = random 
 effect of weight
 
 y1 - 3.5 + rep(b1, each=2) + 0.7 * t + 0.01 * trt + 0.1 * t * trt +
 rnorm(2*n,mean=0, sd=0.09)
 # y1 = weight measurements, 3.5 kg at baseline, 
 # 0.7 kg more at the second time occation 
 # 0.01 = the treatment effect at baseline, 
 # the treatment effect is 0.1 kg for the 
 # experimental group at at the second time occation. 
 # The whithin subject standard deviation is 0.09.
 
 b2 - 0.9 * 3/sd(b1) * b1 + rnorm(length(b1), mean=0, 
 sd=sqrt(1-0.9**2)*3)
 # b2 = random effect for length with standard deviation = 3 
 # and correlated with the random effect of weight (b1) by r=0.9
 
 y2 - 49 + rep(b2, each=2) + 2 * t - 0.05 * trt + 0.5 * t * trt +
 rnorm(2*n,mean=0, sd=1)
 # y2 = length measurements, 49 cm at baseline, 
 # 2 cm more at the second time occation 
 # 0.05 = the treatment effect at baseline, 
 # the treatment effect is 0.5 cm for the 
 # experimental group at at the second time occation. 
 # The whithin subject standard deviation is 1.
 
 
 # data frame of the data:
 df - data.frame(var=as.factor(rep(0:1, each=2*n)),
  id=c(id, id), t=as.factor(c(t, t)), trt=as.factor(c(trt, 
 trt)), y=c(y1,
 y2))
 
 # grouped data object:
 gd - groupedData(y ~ t | id, data=df)
 
 # mixed effects model on weight:
 fm1weight - lme(y ~ t * trt, random = ~ 1 | id, data = gd, 
 subset=var==0)
 summary(fm1weight)
 
 # mixed effect model on length:
 fm1length - lme(y ~ t * trt, random = ~ 1 | id, data = gd, 
 subset=var==1)
 summary(fm1length)
 
 -- 
 DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
 AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl
 
 __
 R-help@stat.math.ethz.ch 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] Passing colnames to graphics title

2005-02-16 Thread Austin, Matt
If i is 1:20, there are no column names.  Make sure you are indexing the
names from your your dataframe.

 xx - data.frame(a=c(1:10), b = letters[1:10])
 colnames(xx)
[1] a b
 for(i in 1:2) print(colnames(xx)[i])
[1] a
[1] b
 for(i in colnames(xx)) print(i)
[1] a
[1] b

Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Laura Quinn
 Sent: Wednesday, February 16, 2005 6:47 AM
 To: Uwe Ligges
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Passing colnames to graphics title
 
 
 Obviously I have been trying to use the colnames() function!
 
 However, when I try to subscript ie:
 
 for(i in 1:20){
 main=paste(Site:,colnames(i),sep=)
 }
 
 this doesn't work! I thought that as.character(colnames(i)) or
 substitute(colnames(i)) might work, but to no avail...
 
 Laura Quinn
 Institute of Atmospheric Science
 School of Earth and Environment
 University of Leeds
 Leeds
 LS2 9JT
 
 tel: +44 113 343 1596
 fax: +44 113 343 6716
 mail: [EMAIL PROTECTED]
 
 On Wed, 16 Feb 2005, Uwe Ligges wrote:
 
  Laura Quinn wrote:
 
   Hi,
  
   Just a quick query - if I'm creating a function to 
 produce a number of
   histograms per page of output (one per column from a 
 matrix), how can I
   pass the column name of the matrix into the title (or 
 indeed to form part
   of the x-axis label)?
 
 
  By extracting them using colnames()?
 
  Uwe Ligges
 
 
 
   TIA,
   Laura
  
   Laura Quinn
   Institute of Atmospheric Science
   School of Earth and Environment
   University of Leeds
   Leeds
   LS2 9JT
  
   tel: +44 113 343 1596
   fax: +44 113 343 6716
   mail: [EMAIL PROTECTED]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



__
R-help@stat.math.ethz.ch 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] no. at risk in survfit()

2005-02-04 Thread Austin, Matt
Have you looked at the times argument to the summary method?

--Matt


Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of array chip
 Sent: Friday, February 04, 2005 12:2 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] no. at risk in survfit()
 
 
 Hi,
 
 when I generated a survfit() object, I can get number
 of patients at risk at various time points by using
 summary():
 
 fit-survfit(Surv(time,status)~class,data=mtdata)
 summary(fit)
 
 class=1
  time n.risk n.event survival std.err lower 95% CI
 upper 95% CI 
   9.9 78   10.987  0.0127  0.963 1
  41.5 77   10.974  0.0179  0.940 1
  54.0 76   10.962  0.0218  0.920 1
  99.1 38   10.936  0.0328  0.874 1
 
class=2
   time n.risk n.event survival std.err lower 95% CI
 upper 95% CI 
6.9102   10.990 0.00976 0.971   1.000
8.0101   10.980 0.01373 0.954   1.000
   14.4100   10.971 0.01673 0.938   1.000
   16.1 99   10.961 0.01922 0.924   0.999
   16.6 98   10.951 0.02138 0.910   0.994
   18.7 97   10.941 0.02330 0.897   0.988
:
:
:
 
 I have many censoring observations in the dataset, and
 I would like to know the number of patients at risk
 (n.risk in the above output) for certain time points,
 for example at 60, 72, etc, which is not available
 from the above printout for class=1. Is there anyway I
 can get them?
 
 Thanks
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


RE: [R] PBIB datataset

2004-12-19 Thread Austin, Matt
Is it the PBIB dataset in the SASmixed package?  I don't have my copy of the
text at home.

--Matt

 library(SASmixed)
Loading required package: lme4 

Attaching package 'lme4':


The following object(s) are masked from package:nlme :

 Alfalfa Assay bdf BodyWeight Cefamandole Dialyzer Earthquake
ergoStool Fatigue Gasoline getCovariateFormula getResponseFormula Glucose
Glucose2 Gun IGF lmeControl Machines MathAchieve MathAchSchool Meat Milk
Muscle Nitrendipene Oats Orthodont Ovary Oxboys Oxide PBG Phenobarb Pixel
Quinidine Rail RatPupWeight Relaxin Remifentanil Soybean Spruce
Tetracycline1 Tetracycline2 Wafer Wheat Wheat2 

Warning message: 
package 'SASmixed' was built under R version 2.0.1 
 data(PBIB)
 PBIB
   response Treatment Block
1   2.415 1
2   2.5 9 1
3   2.6 1 1
4   2.013 1
5   2.7 5 2

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 [EMAIL PROTECTED]
 Sent: Sunday, December 19, 2004 11:44 AM
 To: [EMAIL PROTECTED]
 Subject: [R] PBIB datataset
 
 
 I'm looking at Pinheiro  Bates Mixed-Effects Models in
 S and S-PLUS at the moment. Several datasets are used,
 one of which is called PBIB (a partially balanced
 incomplete block design).
 
 All the other datasets can be found somewhere or other in R.
 
 However, I cannot locate PBIB, and it does not seem to
 be mentioned in the latest edition of the R Full Reference
 Manual.
 
 I Have Been Good. I Have Searched The Arcives.
 
 There was a similar query back on 16 July 2002 from E. Corda;
 it seems this got no response (that I could find).
 
 So: Is it available? If not, is there a particular reason
 (e.g. copyright)?
 
 If not available on CRAN, is there an alternative source?
 
 With thanks,
 Ted.
 
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
 Date: 19-Dec-04   Time: 19:44:19
 -- XFMail --
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] SAS or R software

2004-12-17 Thread Austin, Matt
One point that is missing in this discussion is ease of review by the
statistician at the FDA.  As a statistician in clinical trials, you want to
make it as easy as possible for your colleague at the FDA to do their job,
so you put the programs in a format that they are more likely to find
useful.  As more reviewing statisticians are familiar with SAS than with
other statistical packages/languages, I feel more comfortable sending a
submission in SAS. 

Reviewers do use the programs in a filing that were written for creation of
data sets and analysis to check for correct variable definitions and
appropriate analyses.  If the programs are written in a package/language
that the reviewer understands they can get their job done easier.

Given this, I have used S-Plus in regulatory work where it was clearly
stronger--at some point I hope to use R where it adds a clear benefit.  Of
course 95% of the statistical analyses that are performed for regulatory
submission can probably be done just as well with any of the major
statistical package/languages available.

$0.02

--Matt  

Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431




 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Marc Schwartz
 Sent: Friday, December 17, 2004 16:19 PM
 To: Alexander C Cambon
 Cc: R-Help; Douglas Bates
 Subject: Re: [R] SAS or R software
 
 
 On Fri, 2004-12-17 at 17:11 -0500, Alexander C Cambon wrote: 
  I apologize for adding this so late to the SAS or R software 
  thread.
  This is a question, not a reply, but it seems to me to fit in well
  with
  the subject of this thread.
  
  I would like to know anyone's experiences in the following two areas
  below.  I should add I have no experience myself in these areas:
  
  1) Migrating from SAS to R in the choice of statistical 
 software used
  for FDA  reporting.
 
 You will find that to be a non-issue from the FDA's perspective. This
 has been discussed here with some frequency.  If you search 
 the archives
 you will find comments from Frank Harrell and others.
 
 The FDA does not and cannot endorse a particular software product. Nor
 does it validate any statistical software for a specific purpose. They
 do need to be able to reproduce the results, which means they need to
 know what software product was used, which version and on 
 what platform,
 etc.
 
 The SAS XPORT Transport Format (which is openly defined and 
 documented),
 has been used for the transfer of data sets and has been available in
 many statistical products.
 
 There have been a variety of activities (CDISC, HL-7, etc) 
 regarding the
 electronic submission of data to the FDA. Some additional 
 information is
 here:
 
 http://www.fda.gov/cder/regulatory/ersr/default.htm
 
 and here:
 
 http://www.cdisc.org/news/index.html
 
 Any other issues impacting the selection of a particular statistical
 application are more likely to be political within your working
 environment and FUD. 
 
 As you are likely aware, other statistically relevant issues are
 contained in various ICH guidance documents regarding GCP 
 considerations
 and principles for clinical trials:
 
 http://www.ich.org/[EMAIL PROTECTED]@_TEMPLATE=272
 
 
 Keep in mind also that one big advantage R has (in my mind) is the use
 of Sweave for the reproducible generation of reports, which 
 to an extent
 are self-documenting. 
 
 
   (For example, was there more effort involved in areas of
  documentation, revision tracking,  or validation of software codes?
 
 Since the FDA's role with computer software and validation has been
 raised before, the following documents cover many of these areas. The
 list is not meant to be exhaustive, but should give a flavor in this
 domain.
 
 There are specific guidance documents by the FDA pertaining 
 to software
 that is contained in a medical device (ie. the firmware in a pacemaker
 or medical monitoring equipment) or is used to develop a 
 medical device.
 The current guidance in this case is here:
 
 http://www.fda.gov/cdrh/comp/guidance/938.html
 
 Other guidance pertains to 21 CFR 11, which addresses data management
 systems used for clinical trials and covers issues such as electronic
 signatures, audit trails and the like. A guidance document for that is
 here:
 
 http://www.fda.gov/cder/guidance/5667fnl.htm
 
 Keep in mind, from a perspective standpoint, that even MS Excel and
 Access can be made to be 21 CFR 11 compliant and there are companies
 whose business is focused on just that task.
 
 There is also a general guidance document for computer systems used in
 clinical trials here:
 
 http://www.fda.gov/ora/compliance_ref/bimo/ffinalcct.htm
 
 Though it is to be superseded by a draft document here:
 
 http://www.fda.gov/cder/guidance/6032dft.htm 
 
 
  2) Migrating from SAS to R in the choice of statistical 
 software used
  for NIH reporting  (or other US or non-US) government agencies) .
 
 Same here to 

RE: [R] The survival rate at a certain time

2004-12-06 Thread Austin, Matt
You can use the summary method for a survfit object from the package
survival as in the following example:

 library(survival)
 summary( survfit( Surv(futime, fustat)~rx,data=ovarian), times=500)
Call: survfit(formula = Surv(futime, fustat) ~ rx, data = ovarian)

rx=1 
time   n.risk  n.event survival  std.err lower 95%
CI 
 500.0005.0006.0000.5380.138
0.326 
upper 95% CI 
   0.891 

rx=2 
time   n.risk  n.event survival  std.err lower 95%
CI 
 500.0007.0004.0000.6580.141
0.433 
upper 95% CI 
   1.000 


Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Lisa Wang
 Sent: Monday, December 06, 2004 8:27 AM
 To: R-Help
 Subject: [R] The survival rate at a certain time
 
 
 Hello there,
 
 I am doing analysis on survival data. How do I pick out a 
 probability of
 survival at a chosen landmark time(for example, 3 years, 4 years) from
 the result of survfit? or any other functions? As I know, the result
 of 'survfit' only have the probabilities for all event or cencor time.
 
 Thank you very much
 
 Lisa Wang
 
 Princess Margaret Hospital
 Toronto, Ca
 
 tel: 416-946-4501 ext.5201
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] Response Surface

2004-11-25 Thread Austin, Matt
wireframe() is available in the package lattice.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED]
 Sent: Thursday, November 25, 2004 20:36 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Response Surface
 
 
 Hi. I'm a student at Simon Fraser University in British 
 Columbia, Canada. I
 can't for the life of me figure out how to plot a 3D surface 
 (A 3D response
 surface to be more specific) in R. I found your email address on a web
 board, and saw someone mention wireframe(), but using the 
 help in R yielded
 no results. Any suggestions?
 
 Thanks.
 
 Dean Vrecko
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] 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] scatterplot of 100000 points and pdf file format

2004-11-24 Thread Austin, Matt


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 [EMAIL PROTECTED]
 Sent: Wednesday, November 24, 2004 16:37 PM
 To: R Help Mailing List
 Subject: RE: [R] scatterplot of 10 points and pdf file format
 
 
 On 24-Nov-04 Prof Brian Ripley wrote:
  On Wed, 24 Nov 2004 [EMAIL PROTECTED] wrote:
  
  1. Multiply the data by some factor and then round the
results to an integer (to avoid problems in step 2).
Factor chosen so that the result of (4) below is
satisfactory.
 
  2. Eliminate duplicates in the result of (1).
 
  3. Divide by the factor you used in (1).
 
  4. Plot the result; save plot to PDF.
 
  As to how to do it in R: the critical step is (2),
  which with so many points could be very heavy unless
  done by a well-chosen procedure. I'm not expert enough
  to advise about that, but no doubt others are.
  
  unique will eat that for breakfast
  
  x - runif(1e6)
  system.time(xx - unique(round(x, 4)))
  [1] 0.55 0.09 0.64 0.00 0.00
  length(xx)
  [1] 10001
 
 'unique' will eat x for breakfast, indeed, but will have some
 trouble chewing (x,y).
 


  xx - data.frame(x=round(runif(100),4), y=round(runif(100),4))
  system.time(xx2 - unique(xx))
[1] 14.23  0.06 14.34NANA

The time does not seem too bad, depending on how many times it has to be
performed.
--Matt

Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431

 I still can't think of a neat way of doing that.
 
 Best wishes,
 Ted.
 
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
 Date: 25-Nov-04   Time: 00:37:15
 -- XFMail --
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


RE: [R] Error in anova(): objects must inherit from classes

2004-11-24 Thread Austin, Matt
The lme method for anova() checks the inheritance of the object when a
single object is supplied, which is why there is no error when you use one
object at a time.  When two objects are supplied, the method uses the class
of the object by invoking the data.class function (which does not list
glmmPQL class).  If you replace the check of the class with a check of
inheritance it should work.

Following is a check from the example listed in MASS (Venables and Ripley)

  library(MASS)
  library(nlme) 
  x1 - glmmPQL(y ~ I(week  2), random = ~ 1 | ID,
+  family = binomial, data = bacteria)
iteration 1 
iteration 2 
iteration 3 
iteration 4 
iteration 5 
iteration 6 
  x2 - glmmPQL(y ~ trt + I(week  2), random = ~ 1 | ID,
+  family = binomial, data = bacteria)
iteration 1 
iteration 2 
iteration 3 
iteration 4 
iteration 5 
iteration 6 
  anova(x1)
numDF denDF F-value p-value
(Intercept) 1   169  35  .0001
I(week  2) 1   169  21  .0001
  anova(x2)
numDF denDF F-value p-value
(Intercept) 1   169  35  .0001
trt 247   20.22
I(week  2) 1   169  20  .0001

  anova(x1, x2)
Error in anova.lme(x1, x2) : Objects must inherit from classes gls, gnls
lm,lmList, lme,nlme,nlsList, or nls

After replacement:

  anovaLME(x1, x2)
   Model df  AIC  BIC logLik   Test L.Ratio p-value
x1 1  4 1107 1121   -550   
x2 2  6 1114 1134   -551 1 vs 2 2.60.28


Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Andrew Criswell
 Sent: Wednesday, November 24, 2004 18:47 PM
 To: R-help
 Subject: [R] Error in anova(): objects must inherit from classes
 
 
 Hello:
 
 Let me rephrase my question to attract interest in the 
 problem I'm having. When I appply anova() to two equations
 estimated using glmmPQL, I get a complaint,
 
  anova(fm1, fm2)
 Error in anova.lme(fm1, fm2) : Objects must inherit from 
 classes gls,
 gnls lm,lmList, lme,nlme,nlsList, or nls
 
 
 The two equations I estimated are these:
 
  fm1 - glmmPQL(choice ~ day + stereotypy,
 +random = ~ 1 | bear, data = learning, family 
 = binomial)
  fm2 - glmmPQL(choice ~ day + envir + stereotypy,
 +random = ~ 1 | bear, data = learning, family 
 = binomial)
 
 Individually, I get results from anova():
 
  anova(fm1)
 numDF denDF   F-value p-value
 (Intercept) 1  2032   7.95709  0.0048
 day 1  2032 213.98391  .0001
 stereotypy  1  2032   0.42810  0.5130
 
  anova(fm2)
 numDF denDF   F-value p-value
 (Intercept) 1  2031   5.70343  0.0170
 day 1  2031 213.21673  .0001
 envir   1  2031  12.50388  0.0004
 stereotypy  1  2031   0.27256  0.6017
 
 
 I did look through the archives but didn't finding anything 
 relevant to my problem.
 
 Hope someone can help.
 
 ANDREW
 
  _
 platform i586-mandrake-linux-gnu
 arch i586
 os   linux-gnu
 system   i586, linux-gnu
 status
 major2
 minor0.0
 year 2004
 month10
 day  04
 language R
 
 
 
 -- 
 Andrew R. Criswell, Ph.D.
 Graduate School, Bangkok University
 
 mailto:[EMAIL PROTECTED] 
 http://email.bu.ac.th/src/compose.php?send_to=andrew.c%40bu.ac.th
 mailto:[EMAIL PROTECTED] 
 http://email.bu.ac.th/src/compose.php?send_to=andrew%40arcris
well.com

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

__
[EMAIL PROTECTED] 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] RE: [S] worked in R, but not in S-Plus

2004-11-09 Thread Austin, Matt
The following works, you need to include x=TRUE in the call to coxph.
Passing the time and status variables as additional arguments is a matter of
personal preference.

f.coxph.zph-function(x, timeVar, statusVar)
{
cox.fit - coxph(Surv(timeVar, statusVar) ~ x, na.action =
na.exclude, method = breslow, x=TRUE)
fit.zph-cox.zph(cox.fit)
fit.zph$table[,3]
}

time.cox   - ovarian$futime
status.cox - ovarian$fustat

apply(ovarian[,-(1:2)],2, f.coxph.zph, timeVar = time.cox, statusVar =
status.cox)


--Matt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of array chip
Sent: Tuesday, November 09, 2004 16:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [S] worked in R, but not in S-Plus


Hi, 

I wrote a function that worked well in R, but not in
S-Plus, can anyone suggest a solution?

 f.coxph.zph-function(x)
{
cox.fit - coxph(Surv(time.cox, status.cox) ~ x,
na.action = na.exclude, method = breslow)
fit.zph-cox.zph(cox.fit,transform='log')
fit.zph$table[,3]
}

yyy is my data frame that contains survial time,
censor status and predictor variables.

 time.cox-yyy$time
 status.cox-yyy$status
 apply(yyy[,-(1:2)],2,f.coxph.zph)

When run in S-Plus, it gave the following error
message:

Problem in model.frame.coxph(fit): Object x not
found

If I remove the 2nd and 3rd lines inside the function,
it worked, so definitely something is wrong in passing
the coxph object into the cox.zph().

Thanks







__ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


This message was distributed by [EMAIL PROTECTED]  To
...(s-news.. clipped)...

__
[EMAIL PROTECTED] 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] List seems to drop empty levels of factors when containin g them

2004-11-09 Thread Austin, Matt
I don't get the same result, do you have a package loaded that would change
the default behavior (such as Hmisc)?

 list(grp.1)
[[1]]
[1] 1 2
Levels: 1 2

 list(grp.1[mask])
[[1]]
[1] 1
Levels: 1 2

 library(Hmisc)
snip

 list(grp.1[mask])
[[1]]
[1] 1
Levels: 1

--Matt

 version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor0.0
year 2004   
month10 
day  04 
language R 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Andrew Robinson
Sent: Tuesday, November 09, 2004 19:44 PM
To: R-Help Discussion
Cc: Andrew Robinson
Subject: [R] List seems to drop empty levels of factors when containing
them


Greetings R community,

I am curious about the following behaviour: if I define a factor, and
then store a subset of it in a list, the stored version seems to drop
levels that were not included in the subset.  E.g. ..

 mask - c(T, F)
 grp.1 - factor(c(1,2))
 list(grp.1)
[[1]]
[1] 1 2
Levels: 1 2

 list(grp.1[mask])
[[1]]
[1] 1
Levels: 1

It is as though the list were redefining the factor and dropping
empty levels.  I would like to keep them (I am using the list for a
two-dimensional tapply). Is there any way to avoid this?

I'm using R 2.0.0 on FreeBSD 5.2.1.

Thanks,

Andrew
-- 
Andrew Robinson  Ph: 208 885 7115
Department of Forest Resources   Fa: 208 885 6226
University of Idaho  E : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

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

__
[EMAIL PROTECTED] 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] lag variable addition to data frame question

2004-10-29 Thread Austin, Matt
?diff

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of s viswanath
Sent: Friday, October 29, 2004 7:22 AM
To: [EMAIL PROTECTED]
Subject: [R] lag variable addition to data frame question


Hi,

I was wondering if there is a more efficient way of handling the following
method of creating a lagged value in a data frame without using the
recursive 
'for(i in 1:n)' loop and without using as.ts

#Steps to creating a lag variable in a data frame 'my.dat.fr'
# with 275 columns, 2400 rows of numbers and factors . The #variable x is a
factor of #with five different levels
the way i am creating the variable now is:

attach(my.dat.fr)
#my.dat.fr contains a variable 'x', i want to create #lagged variables #of
this without using as.ts(). Is #there a more effient way of doing this
than#below and #without using a recursive loop  such as 
#for( i in 1:obs)x.lag[i]= x[(i-1)]

1.here is the way i am doing the lag now
x=c(3,2,3,2,1,1,1,2,1,2,1,3...1)

obs=length(x)

x.nolag=x[2:obs]
x.lag1=x[1:(obs-1)]

my.new=cbind(x.nolag,x.lag1)

#since my data frame must line up my orginal x values to other columns I
also # add the following


x.fill= cbind(0,0)
# as named the above cell lines up my factor to other factors in my data
frame, #since I had chopped off the first x observation to create x above
(ie x[2:obs]) #then finally

my.dat.fr=rbind(x.fill, my.new)
my.dat.fr

#Is there a easier way to create a lag variable and install in my data
frame?
#thankyou in advance, Sri

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

__
[EMAIL PROTECTED] 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] Secondary y axis

2004-10-26 Thread Austin, Matt
You could replace your last two lines with the following.  You'll need to
play with the axes labeling to make it pretty.

scaled.c - scale(c)
par(new=TRUE)
plot(scaled.c, ylim=c(-5, 5), xaxt=n, yaxt=n, col='green', type='l',
xlab=, ylab=)

axis (4,
  labels=round(seq(-2, 2, .25)*attr(scaled.c, 'scaled:scale')  +
attr(scaled.c, 'scaled:center'), 1),
  at=seq(-2, 2, .25), col=black, tck=-0.01, cex=.5)
par(new=FALSE)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of John Robot
Sent: Tuesday, October 26, 2004 16:46 PM
To: [EMAIL PROTECTED]
Subject: [R] Secondary y axis


Hi
I had a look at the help and previous discussions but I am
still unable to solve these issues:


1
I have a set of air pressure data. I would like to
plot a and b (both about 980-1000 millibar) and c, the difference
(around 0-8 millibar). I use axis (4) to create a new axis (to the right)
but I do not know how to assign c to the new axis which currently
features the same values as the first axis. So, how do I show a, b and c
in the same plot with different scales (one for each y-axis)?


2
I would like the x-axis to be time (h): 04, 05, 06 ... 24, 01, 02 ...
(the data is stored in the same table as a and b). How do define where
to get data for the a-axis and show for example every 5th value along
the axis? When I try plot (a ~ h ... the results are messed up in the
plot.


3
Is there a way to define the color within the box in the plot?


I pasted my current code here:
-
# Import

a = read.table(pres.txt, header=TRUE)
b = read.table(pres.txt, header=TRUE)
h = read.table(pres.txt, header=TRUE)

a = (a[,2])
b = (b[,3])
c = abs(a-b)
h = (h[,1])

f = seq(980, 995, 2.5)

### Plot

par (mfrow=c(1,1))# rows, columns
par (cex.lab=1, col.axis=black, bg=lightyellow, fg=black, mar=c(4, 4, 
2.5, 2))# cex sets font size


# Plot 1
plot (a, type=l, xlab=Time (h), ylab=Temperature (°C), ylim=c(980, 
995), pch=1, col=red, lwd=2, tck=-0.01)
abline (h=f, lwd=1, lty=2)

lines(b, pch=3, col=blue,  cex=2, type=l, lty=1, lwd=2) # lty controls 
line type
title(Air Pressure (mb), font.main=1, adj=0.5, cex.main=2)


axis (4, labels=TRUE, tick=TRUE, col=black, tck=-0.01)
lines(c, pch=3, col=green, cex=2, type=l, lty=5, lwd=2)
-



Best regards,

Magnus Nilsson, Sweden

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

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


RE: ??: [R] R plot problems

2004-10-17 Thread Austin, Matt
The following should work, note I made x.name a factor.

x - data.frame(main.name=AAA,
x.name=factor(rep(c(Apply,Watermelon,Lemon,Banana,
 
Grape,Pineapply,Cherry,Peach,Orange,Mango,Strawberry),each=5))
,
   y.name=(1:55))

plot(x$x.name, x$y.name, axes=FALSE)
axis(1, at=1:length(levels(x$x.name)), lab=FALSE)
axis(2)
box()
text(1:length(levels(x$x.name)), par('usr')[3]-par('cxy')[2]*.5,
levels(x$x.name), offset=1, xpd=TRUE, srt=-45, adj=0)


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ivy_Li
Sent: Sunday, October 17, 2004 19:27 PM
To: Bobby Corpus
Cc: Henric Nilsson; [EMAIL PROTECTED]
Subject: ??: ??: [R] R plot problems


Yes! You are right ! It is perpendicular to the axis.
 Thank you very much!
Could I choose the angle ,such as 45 degree?




Best Regards!
Ivy Li
YMS in Production  Testing
Semiconductor Manufactory International(ShangHai) Corporation
#18 ZhangJiang Road, PuDong New Area, Shanghai, China
Tel: 021-5080-2000 *11754
Email: [EMAIL PROTECTED]



--
: Bobby Corpus [mailto:[EMAIL PROTECTED]
: 20041018 10:01
: Ivy_Li
: Henric Nilsson; [EMAIL PROTECTED]
: Re: : [R] R plot problems


Hi Ivy,

How about

x - data.frame(main.name=AAA,
x.name=rep(c(Apply,Watermelon,Lemon,Banana,
 
Grape,Pineapply,Cherry,Peach,Orange,Mango,Strawberry),each=5),
y.name=(1:55))
par(las=2);
plot(x$x.name, x$y.name)

Bobby

On Mon, 18 Oct 2004 09:36:12 +0800, Ivy_Li [EMAIL PROTECTED] wrote:
 Thank you for your help!
 I gave you an example, you could run it in R . Maybe you will understand
my meaning clearly.
 
 x - data.frame(main.name=AAA,
x.name=rep(c(Apply,Watermelon,Lemon,Banana,

Grape,Pineapply,Cherry,Peach,Orange,Mango,Strawberry),each=5),
y.name=(1:55))
 plot(x$x.name, x$y.name)
 
 I can't find you said package ,whick library should I include in R ?
 
 Best Regards!
 Ivy Li
 YMS in Production  Testing
 Semiconductor Manufactory International(ShangHai) Corporation
 #18 ZhangJiang Road, PuDong New Area, Shanghai, China
 Tel: 021-5080-2000 *11754
 Email: [EMAIL PROTECTED]
 
 --
 : Henric Nilsson [mailto:[EMAIL PROTECTED]
 : 20041015 17:39
 : Ivy_Li
 : [EMAIL PROTECTED]
 : Re: [R] R plot problems
 
 At 16:17 2004-10-15 +0800, you wrote:
 
 [...] I want to rotate the direction of  x-coordinates' letter so that it
 can show all. But I don't know how to write this option or function .
 
 I'm not sure if I've understood your question correctly. But if you use
 base graphics and want e.g. rotated labels, you'll achive this rather
 easily using functions in the gridBase package. (Take a look at the
package
 vignette for an  example that'll get you started.)
 
 Henric
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


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

__
[EMAIL PROTECTED] 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] incomplete function output

2004-10-13 Thread Austin, Matt
I would return the values from the various tests in a list. If you only want
them to print and not for use in other parts of your program you could
explicitly print each test using print().

root - function(var)
{
#---Phillips-Perron
 test1 - PP.test(var, lshort = TRUE) 
 test2 - PP.test(var, lshort = FALSE) 

#---Augmented Dickey-Fuller 
 test3 - adf.test(var, alternative = stationary, k =
 test4 - trunc((length(var)-1)^(1/3)))

#---KPSS
 test5 - kpss.test(var, null = Level, lshort = TRUE)
 test6 - kpss.test(var, null = Trend, lshort = FALSE)
 list(test1, test2, test3, test4, test5, test6)
}

--Matt
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of bogdan romocea
Sent: Wednesday, October 13, 2004 10:20 AM
To: [EMAIL PROTECTED]
Subject: [R] incomplete function output


Dear R users,

I have a function (below) which encompasses several tests.
However, when I run it, only the output of the last test is
displayed. How can I ensure that the function root(var)
will run and display the output from all tests, and not
just the last one?

Thank you,
b.

root - function(var)
{
#---Phillips-Perron
PP.test(var, lshort = TRUE) 
PP.test(var, lshort = FALSE) 

#---Augmented Dickey-Fuller 
adf.test(var, alternative = stationary, k =
trunc((length(var)-1)^(1/3)))

#---KPSS
kpss.test(var, null = Level, lshort = TRUE)
kpss.test(var, null = Trend, lshort = FALSE)
}

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

__
[EMAIL PROTECTED] 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] covariate selection?

2004-10-12 Thread Austin, Matt
I like Kjetil's suggestion of a shrinkage estimator.  Perhaps this would be
a good time to experiment with Trevor Hastie's 'lars' package.

If you have a lot of correlated inputs I might suggest using Andy Liaw's
randomforest package.  I have found this technique to be very valuable in
this setting.  The partial dependency plots are a good way to explore the
functional relationships of the variables.

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Kjetil Brinchmann
Halvorsen
Sent: Tuesday, October 12, 2004 17:16 PM
To: Ian Fiske
Cc: [EMAIL PROTECTED]
Subject: Re: [R] covariate selection?


Ian Fiske wrote:

 Hello,

 I am hoping someone can help me with the following multivariate 
 issue:  I have a model consisting of about 50 covariates.  I would 
 like to reduce this to about 5 covariate for the reduced model by 
 combining cofactors that are strongly correlated.  Is there a package 
 or function that would help me with this in R?  I appreciate any 
 suggestions.

 Thanks,
 Ian

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


have a look at package leaps, and also consider ridge regression.

-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
   --  Mahdi Elmandjra

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

__
[EMAIL PROTECTED] 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: followup: Re: [R] Issue with predict() for glm models

2004-09-23 Thread Austin, Matt
Could you just use

lines(newX, myPred, col=2)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Paul Johnson
Sent: Thursday, September 23, 2004 10:3 AM
To: r help
Subject: followup: Re: [R] Issue with predict() for glm models


I have a follow up question that fits with this thread.

Can you force an overlaid plot showing predicted values to follow the 
scaling of the axes of the plot over which it is laid?

Here is an example based on linear regression, just for clarity.  I have 
followed the procedure described below to create predictions and now 
want to plot the predicted values on top of a small section of the x-y 
scatterplot.

x - rnorm(100, 10, 10)
e - rnorm(100, 0, 5)
y - 5 + 10 *x + e

myReg1 - lm (y~x)
plot(x,y)
newX - seq(1,10,1)
myPred - predict(myReg1,data.frame(x=newX))

Now, if I do this, I get 2 graphs overlaid but their axes do not line 
up.

par(new=T)
plot(newX,myPred$fit)

The problem is that the second one uses the whole width of the graph 
space, when I'd rather just have it go from the small subset where its x 
is defined, from 1 to 10.  Its stretching the range (1,10) for newX to 
use the same scale that goes from (-15, 35) where it plots x

I know abline() can do this for lm, but for some other kinds of models, 
no  lines() method is provided, and so I am doing this the old fashioned 
way.

pj

John Fox wrote:
 Dear Uwe, 
 
 
-Original Message-
From: Uwe Ligges [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 23, 2004 8:06 AM
To: John Fox
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [R] Issue with predict() for glm models

John Fox wrote:


Dear Uwe,

Unless I've somehow messed this up, as I mentioned 

yesterday, what you 

suggest doesn't seem to work when the predictor is a 

matrix. Here's a 

simplified example:



X - matrix(rnorm(200), 100, 2)
y - (X %*% c(1,2) + rnorm(100))  0
dat - data.frame(y=y, X=X)
mod - glm(y ~ X, family=binomial, data=dat) new - data.frame(X = 
matrix(rnorm(20),2)) predict(mod, new)

Dear John,

the questioner had a 2 column matrix with 40 and one with 50 
observations (not a 100 column matrix with 2 observation) and 
for those matrices it works ...

 
 
 Indeed, and in my example the matrix predictor X has 2 columns and 100
rows;
 I did screw up the matrix for the new data to be used for predictions
(in
 the example I sent today but not yesterday), but even when this is done
 right -- where the new data has 10 rows and 2 columns -- there are 100
(not
 10) predicted values:
 
 
X - matrix(rnorm(200), 100, 2)  # original predictor matrix with 100 rows
y - (X %*% c(1,2) + rnorm(100))  0
dat - data.frame(y=y, X=X)
mod - glm(y ~ X, family=binomial, data=dat)
new - data.frame(X = matrix(rnorm(20),10, 2)) # corrected -- note 10 rows
predict(mod, new) # note 100 predicted values
 
12345
 6 
   5.75238091   0.31874587  -3.00515893  -3.77282121  -1.97511221
 0.54712914 
789   10   11
 12 
   1.85091226   4.38465524  -0.41028694  -1.53942869   0.57613555
 -1.82761518 
 
  . . .
 
   91   92   93   94   95
 96 
   0.36210780   1.71358713  -9.63612775  -4.54257576  -5.29740468
 2.64363405 
   97   98   99  100 
  -4.45478627  -2.44973209   2.51587537  -4.09584837 
 
 Actually, I now see the source of the problem:
 
 The data frames dat and new don't contain a matrix named X; rather the
 matrix is split columnwise:
 
 
names(dat)
 
 [1] y   X.1 X.2
 
names(new)
 
 [1] X.1 X.2
 
 Consequently, both glm and predict pick up the X in the global environment
 (since there is none in dat or new), which accounts for why there are 100
 predicted values.
 
 Using list() rather than data.frame() produces the originally expected
 behaviour:
 
 
new - list(X = matrix(rnorm(20),10, 2))
predict(mod, new)
 
  1  2  3  4  5  6
7
 
  5.9373064  0.3687360 -8.3793045  0.7645584 -2.6773842  2.4130547
0.7387318
 
  8  9 10 
 -0.4347916  8.4678728 -0.8976054 
 
 Regards,
  John
 
 
Best,
Uwe








   12345
6 
  1.81224443  -5.92955128   1.98718051 -10.05331521   2.6506
-2.50635812 
   789   10   11
12 
  5.63728698  -0.94845276  -3.61657377  -1.63141320   5.03417372
1.80400271 
  13   14   15   16   17
18 
  9.32876273  -5.32723406   5.29373023  -3.90822713 -10.95065186
4.90038016

 . . .

   97   98   99  100 
 -6.92509812   0.59357486  -1.17205723   0.04209578 


Note that there are 100 rather than 10 predicted values.

But with individuals predictors (rather than a matrix),



x1 - X[,1]
x2 - X[,2]
dat.2 - data.frame(y=y, x1=x1, x2=x2)
mod.2 - glm(y ~ x1 + x2, family=binomial, data=dat.2)

RE: [R] unable to download

2004-09-20 Thread Austin, Matt
You may need to supply some additional information about your setup.  

What operating system and version are you using?
How are you connecting to the internet?  
Can you download packages from other sources (such as CRAN)?
Exactly what procedure are you using to download the packages?
Have you tried to download individual packages and install locally?

Asking for help ASAP because you are running late is not considerate to
those willing to provide help, because most of us are already behind on our
own projects.

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of #AMELIA ANWAR#
Sent: Monday, September 20, 2004 19:40 PM
To: [EMAIL PROTECTED]
Subject: [R] unable to download 


Hi,
I am currently trying to install packages from BioConductor to R. However, I
received a error stating: unable to connect to 'www.bioconductor.org' on
port 80
May I know what is wrong and how may I correct it?? If possible give a step
by step procedures on how can I do it...
Thanks alot,
Amelia
 
PS: Please reply ASAP as I am currently doing a Final Year Project on
microarray analysis and already beyond scheduled.

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

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


RE: [R] how to take this experiment with R?

2004-09-20 Thread Austin, Matt
My mistake, you can't use the structure I proposed with lm() in combination
with step().

If what was suggested earlier by Gabor was not what you wanted, and instead
you want the 'best' three variable model, then it may be easier to use the
leaps package.  


 library(leaps)
 x - data.frame(matrix(rnorm(1550),c(50,31)))
 model - regsubsets(y=x[,1], x=x[,2:31])
 m1-summary(model, matrix=TRUE, matrix.logical=TRUE)
 apply(m1$outmat, 1, which)[3]
$3  ( 1 )
X10 X14 X15 
  9  13  14 

 lm.fit(x=as.matrix(x[,as.vector(unlist(apply(m1$outmat, 1,
which)[3])+1)]), y=x[,1])
$coefficients
   X10X14X15 
-0.2694923 -0.4055546 -0.2692063 


--Matt
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Gabor Grothendieck
Sent: Monday, September 20, 2004 21:57 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [R] how to take this experiment with R?




Suppose you just wanted variables 2,4 and 7 (which are in columns
3, 5 and 8, respectively).  Then you could do this:

   lm(X1 ~ X2 + X4 + X7, x)
or
   lm(X1 ~., x[,c(2,4,7)+1])


Date:   Tue, 21 Sep 2004 12:27:38 +0800
From:   rongguiwong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject:Re: [R] how to take this experiment with R?

ÔÚ 2004Äê9ÔÂ21ÈÕ ÐÇÆÚ¶þ 12:10£¬Gabor Grothendieck дµÀ£º
it works.
but i come across anather problem.
i just wnat to select 3 of the best indepent variables.
but the reslut from step(lm(X1 ~., x)) is :

Step: AIC= -37.64
X1 ~ X2 + X3 + X4 + X8 + X10 + X11 + X13 + X14 + X15 + X18 +
X21 + X22 + X25 + X26 + X27 + X29 + X30 + X31

Df Sum of Sq RSS AIC
none 11.014 -37.642
- X8 1 0.559 11.574 -37.165
- X27 1 0.867 11.881 -35.853
- X2 1 0.971 11.986 -35.416
- X18 1 0.978 11.992 -35.390
- X31 1 1.122 12.136 -34.793
- X10 1 1.400 12.414 -33.659
- X15 1 1.563 12.578 -33.005
- X29 1 1.608 12.622 -32.828
- X13 1 1.805 12.819 -32.055
- X30 1 1.880 12.894 -31.763
- X4 1 2.368 13.382 -29.906
- X14 1 2.495 13.509 -29.433
- X3 1 2.983 13.997 -27.659
- X22 1 2.999 14.013 -27.600
- X21 1 3.377 14.391 -26.271
- X25 1 4.323 15.338 -23.086
- X11 1 6.775 17.789 -15.672
- X26 1 7.232 18.246 -14.403

 You can express your model like this:



 lm(X1 ~., x)



 ?formula gives some help on formulas although the . notation

 above does not seem to be referred to there.





 Date:  Tue, 21 Sep 2004 11:52:04 +0800

 From:  rongguiwong [EMAIL PROTECTED]

 To:  [EMAIL PROTECTED]

 Subject:  [R] how to take this experiment with R?



 i want to generate 30 independent variables and 1 dependent variable,each
 has

 50 draws from a unit normal distribution.

 then, searching for the independent variables that together would do the
 best

 job for fitting the denpendent variabe.



 my way to generate the data is.

 x-data.frame(matrix(rnorm(1550),c(50,31)))

 but is there more better way to do it?



 i want to use the followling is to search the model.

 model-step(lm(X1~X2+X3+X4.))

 but i don't know the to express the formula with lm function.i think there
 is

 a way the express it efficently.

 i try ?lm .but on result be found.



 any help is welcome!


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

__
[EMAIL PROTECTED] 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] Printing output on Plot

2004-09-02 Thread Austin, Matt
The following example should get you started.


library(survival)
test1 - list(time=  c(4, 3,1,1,2,2,3),
status=c(1,NA,1,0,1,1,0),
x= c(0, 2,1,1,1,0,0),
sex=   c(0, 0,0,0,1,1,1))
cpfit - coxph( Surv(time, status) ~ x + strata(sex), test1)  #stratified
model

cpfit

pval - paste(P-value: , round(1 -
pchisq((cpfit$coef/sqrt(diag(cpfit$var)))^2, 1), 3))
plot(survfit(cpfit))
text(par('usr')[1], par('usr')[3] +par('cxy')[2], pval, adj=0)

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Neil Leonard
Sent: Thursday, September 02, 2004 19:12 PM
To: [EMAIL PROTECTED]
Subject: [R] Printing output on Plot



Hi,

I'm trying to print the p-values from the output of a CPH test onto a  
Kaplan Meier plot. Can this be done? I only really want the p-values  
from the CPH test to appear but if this can't be done I am willing to  
have the entire CPH output.

This is what I am currently trying: (it doesn't print the CPH output)

plot_KM - function(field)
{
library(survival)
y = length(levels(factor(field)))
field.KM - survfit(Surv(age_at_death,death)~field)
field.CPH - coxph(Surv(age_at_death,death)~factor(field))
plot(field.KM,mark.time=FALSE,col=2: 
(y+1),lty=1,main=paste(as.character(substitute(field)), Kaplan-Meier  
Plot))
text(1000, .3, paste(as.character(field.CPH)), col=red)
legend(1000, .5, levels(factor(field)), col=2:(y+1), lty=1)
}


Thanks,
Neil

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

__
[EMAIL PROTECTED] 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] (no subject)

2004-08-30 Thread Austin, Matt

You need to use a device to print to such as

postscript(file=/where/to/put/file/filename.ps)
##your plotting code here
dev.off()

Writing a plot at each iteration of your simulation can impact the runtime
greatly.

Please read the posting guide at the bottom of the e-mail, it can help you
get more helpful . . . help

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Loke Chok Kang
Sent: Monday, August 30, 2004 18:42 PM
To: [EMAIL PROTECTED]
Subject: [R] (no subject)


Hi,
Sorry, I have a problem that require some help. As I am doing a project with
R and this project requires me to do a lot of plotting as I run my
simulation, I need R to help me store my plots automatically as the
simulation is run. Could anyone advise me on how this can be done? If
possible I need all the plots to be written to a file.
 
PS:In all I have over 500 over plots, thus it will not be possible to
manually plot all the plots out.
 
From yours faithfully,
Chok Kang
[EMAIL PROTECTED]

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

__
[EMAIL PROTECTED] 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] (no subject)

2004-08-30 Thread Austin, Matt
A correction.  You either need to open the plotting device prior to the
simulation that includes your plotting commands and close it after the
simulation or have the name change dynamically in your simulation so that
the runs go in separate files.

An example of the first method would be

postscript(file=/where/to/put/file/filename.ps)

## your simulation commands

dev.off()

for the second method more info would be needed to know how you are running
your simulation to help with dynamic naming.

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Austin, Matt
Sent: Monday, August 30, 2004 18:56 PM
To: 'Loke Chok Kang'; [EMAIL PROTECTED]
Subject: RE: [R] (no subject)



You need to use a device to print to such as

postscript(file=/where/to/put/file/filename.ps)
##your plotting code here
dev.off()

Writing a plot at each iteration of your simulation can impact the runtime
greatly.

Please read the posting guide at the bottom of the e-mail, it can help you
get more helpful . . . help

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Loke Chok Kang
Sent: Monday, August 30, 2004 18:42 PM
To: [EMAIL PROTECTED]
Subject: [R] (no subject)


Hi,
Sorry, I have a problem that require some help. As I am doing a project with
R and this project requires me to do a lot of plotting as I run my
simulation, I need R to help me store my plots automatically as the
simulation is run. Could anyone advise me on how this can be done? If
possible I need all the plots to be written to a file.
 
PS:In all I have over 500 over plots, thus it will not be possible to
manually plot all the plots out.
 
From yours faithfully,
Chok Kang
[EMAIL PROTECTED]

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

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

__
[EMAIL PROTECTED] 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] column names in data.frame

2004-08-19 Thread Austin, Matt
Note that split() creates a list with each component named by the year.
When you use the sapply function the names are retained in the attribute
names, you can print this out to see or use str() or look at the output
from the attribute() function.

Your division also maintains the names and then when you coerce av.tl into a
dataframe they are translated to row names.  Check out the output from
row.names(d2).  If you want these as part of your dataframe you could so
something like

data.frame(d2, year=row.names(d2))
or 
data.frame(av.tl, year=names(av.tl))

Hope this helps,

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Louize Hill
Sent: Thursday, August 19, 2004 16:26 PM
To: [EMAIL PROTECTED]
Subject: [R] column names in data.frame


Dear R-help,
Please can someone explain how to put a column name on an output data.frame.

##Starting with a data.frame with 3 columns (d$Year, d$NoIndiv, d$wtd_tl)

yr_ind - split (d$NoIndiv, d$Year)
yr_tl - split (d$wtd_tl, d$Year)

ann_ind - sapply (yr_ind, sum)
ann_tl - sapply (yr_tl, sum)

av_tl - ann_tl/ann_ind

d2- data.frame (av_tl)

##This gives me a data.frame with columns, the second of which has a column
name (av_tl)
I have tried
 d2- data.frame (year = x, av_tl)
 d2- data.frame (x=year, av_tl)
 d2- data.frame (x=year, av_tl, check.names = TRUE)
 d2- data.frame (year, av_tl)

as well as several combinations with cbind, as.matrix, etc...
I cannot relate the examples given in ?data.frame with my problem or find a
similar problem in the archives.
Thanks
Louize

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

__
[EMAIL PROTECTED] 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] calibration/validation sets

2004-08-14 Thread Austin, Matt
You could keep a row index vector like in the following example.

 data(iris)
 indx - sample(nrow(iris), 20, replace=FALSE)
 train - iris[indx,]
 test  - iris[-indx,]

--Matt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Peyuco Porras
Porras .
Sent: Saturday, August 14, 2004 17:15 PM
To: [EMAIL PROTECTED]
Subject: [R] calibration/validation sets
Importance: High


Hi; 
Does anyone know how to create a calibration and validation set from a
particular dataset? I have a dataframe with nearly 20,000 rows! and I would
like to select (randomly) a subset from the original dataset (...I found how
to do that) to use as calibration set. However, I don't know how to remove
this calibration set from the original dataframe in order to get my
validation set.Any hint will be greatly appreciated. 
TT

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

__
[EMAIL PROTECTED] 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] Private methods

2004-08-13 Thread Austin, Matt
.class1 is an 'internal' method in the namespace of the package 'methods'.
It can be accessed with the ::: operator.  A good start for documentation
may be Vol 3/1 of R-News.


methods:::.class1
function (x) 
class(x)[[1]]
environment: namespace:methods

--Matt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Matthew Walker
Sent: Friday, August 13, 2004 17:19 PM
To: [EMAIL PROTECTED]
Subject: [R] Private methods


Hi,

I'm trying to understand R's object oriented abilities.

I have read (in a very recent email to r-help) that R's methods package 
does not support private methods.  However, I also looked at the source 
for the function is:

  is
function (object, class2)
{
cl - .class1(object)
if (missing(class2))
return(extends(cl))
if (.identC(cl, class2) || .identC(class2, ANY))
return(TRUE)
...

The first line of the function, the assignment to cl, seems to call a 
function called .class1.  I was unable to see the source for .class1:

  .class1
Error: Object .class1 not found

It seems to me that either (a) I don't understand what I'm doing, or (b) 
.class1 is a very private method.  The help system finds nothing about 
.class1. 

Could someone please help me to understand this.  Most helpful of all 
would be pointers on where I could find more information.  (So far I 
have found only two documents on R's object oriented abilities:  A 
guide to using S4 Objects and A draft of the R language definition.)

Thanks,

Matthew

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

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


RE: [R] How to put multiple plots in the same window? (not par(mf row=))

2004-07-30 Thread Austin, Matt
Lattice graphics may be the answer depending on your exact problem.

Here is an example of four traditional plots without space:

par(mfrow=c(2,2), omi=c(.5, .5, .5, .5))
par(mar=c(0, 2, 2, 0))
  plot(rnorm(10), rnorm(10), axes=FALSE)
  box(); axis(2); axis(3)
par(mar=c(0, 0, 2, 2))
  plot(rnorm(10), rnorm(10), axes=FALSE) 
  box(); axis(3); axis(4)
par(mar=c(2, 2, 0, 0))
  plot(rnorm(10), rnorm(10), axes=FALSE)
  box(); axis(1); axis(2)
par(mar=c(2, 0, 0, 2))
  plot(rnorm(10), rnorm(10), axes=FALSE); box()
  box(); axis(1); axis(4)

I have generalized this in the past to allow for more (in a for loop I
think), but I don't have access to my home computer from here.

--Matt



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of F Duan
Sent: Friday, July 30, 2004 8:42 AM
To: [EMAIL PROTECTED]
Subject: [R] How to put multiple plots in the same window? (not
par(mfrow=))


Dear All,

I am sorry if this question has been asked before. Below is my Question:

I want to put several plots in the same window, but I don't want the blank 
space between plots (like par(mfrow=)) --- that makes the plots too small. 
Could anyone tell me how to do it?

Thanks a lot.

Frank

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

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


RE: [R] Problem with bwplot

2004-07-09 Thread Austin, Matt
Try factor(vec2) in your bwplot() call.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ernesto Jardim
Sent: Friday, July 09, 2004 9:41 AM
To: Mailing List R
Subject: [R] Problem with bwplot


Hi, 

I'm ploting some box-and-whisker plots with bwplot but I'm not getting
any box-and-whiskers ... just dots.

I'm using lattice 0.9-16 with R 1.9.1.

Try

library(lattice)
rnorm(60)-vec1
rep(1:3,20)-vec2
rep(LETTERS[1:2],30)-vec3
bwplot(vec1~vec2|vec3)

Thanks

EJ

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

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


RE: [R] funny plotting

2004-06-29 Thread Austin, Matt
Try something like

plot(x,y)
box.dat - boxplot(x=split(counts, dial), plot=FALSE)
bxp(box.dat, add=TRUE, at=c(-1, 0, 1), show.names=FALSE)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Karla Meurk
Sent: Tuesday, June 29, 2004 21:46 PM
To: [EMAIL PROTECTED]
Subject: [R] funny plotting


Hi, I just wanted to plot a boxplot with a nice curve going through it, 
I thought this would be a simple task but for some reason I can't get 
the two graphs on the same page accurately. Enclosed is the code showing 
the two plots seperately and together.  I would have thought it should 
work if I could use boxplot() then plot() overlayed but it won't allow 
the command add=TRUE (which has worked for me in the past).

Thanks

Carla

P.S. please excuse the clumsy code!

#Section 2 Data Set particle

dial-rbind(-1,
-1,
0,
0,
0,
0,
1,
1,
1)
counts-rbind(2,
3,
6,
7,
8,
9,
10,
12,
15)
particle-as.data.frame(cbind(dial,counts),row.names=NULL)
names(particle)-c(dial,counts)
attach(particle)

pois.particle-glm(counts~dial,family=poisson)
x-seq(-2,2,length=20)
y-predict(pois.particle,data.frame(dial=x),type=response)

#Overlaying plots
x11()
boxplot(counts~dial,main=Boxplot of counts for dial setting and poisson 
fit,ylim=c(0,25))
lines(x,y)

#The seperate plots
x11()
boxplot(counts~dial,ylim=c(0,25))
x11()
plot(x,y,ylim=c(0,25),type=l)

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

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


RE: [R] function for running MS-DOS on R

2004-05-20 Thread Austin, Matt
Perhaps you could use the R2WinBugs package?

--Matt

-Original Message-
From: [EMAIL PROTECTED] [mailto:r-help-
[EMAIL PROTECTED] Behalf Of bang jeong sook
Sent: Thursday, May 20, 2004 19:9 PM
To: [EMAIL PROTECTED]
Subject: [R] function for running MS-DOS on R



I had downloaded the program that runs on MS-DOS.
Is it possible for MS-DOS to be run in R such as WinBugs1.4?
I wonder whether there is the R function for running MS-DOS from R such as  
the 'bug.r' function to make Winbugs practicable in R.

I had heard Rterm.exe that runs on MS-DOS.
However, What I need is to run MS-DOS in R but to run R in MS-DOS.

_
 MSN Hotmail  .
http://loginnet.passport.com/login.srf?id=2svc=mailcbid=24325msppjph=1lc
=1042

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

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


RE: [R] question

2004-02-27 Thread Austin, Matt
You want to use  instead of .

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Svetlana Eden
Sent: Friday, February 27, 2004 7:57 AM
To: r-help
Subject: [R] question


Hi everybody.

The question:
I get two vectors 'iFalseFalse' and 'i2'.
I think they should be the same but they are not.
Is it because 
R does not handle complicated logical expressions in such cases 
or I do something wrong?


 z1 = c(NA, , 3, NA, , 3)
 z2 = c(, , 3, NA, 3, NA)
 cV = (as.character(z1)==as.character(z2))
 cV
[1]NA  TRUE  TRUENA FALSENA

 iFalse = (c(1:(length(z1[(cV==FALSE)]
 iNonNA = (c(1:(length(z1[(!(is.na(cV)))]
 iFalse
[1] NA NA  5 NA

 iNonNA
[1] 2 3 5

 iFalseFalse = intersect(iFalse, iNonNA)
 iFalseFalse
[1] 5
 i2 = (c(1:(length(z1[( (cV==FALSE)(!(is.na(cV))) )]
 i2
numeric(0)


-- 
Svetlana EdenBiostatistician IISchool of Medicine
 Department of Biostatistics   Vanderbilt University

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

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