Re: [R] avoiding a loop: cumsum-like

2006-11-03 Thread Petr Pikal
Hi

I have not seen any answer yet so I wil try (partly).

I believe that the loop can be vectorised but I am a little bit lost 
in your fors and ifs. I found that first part of res is same as 
cumsum(tab$x.jour) until about 81st value. However I did not decipher 
how to compute the remaining part. I tried to add 
cumsum(tab$posit.lat) (after changing NA to 0) what is not correct.

Probably some combination of logical operation and summing can do 
what you want. I thought that something like
((cumsum(tab$posit.lat)*0.8)*(cumsum(tab$x.jour)30)+cumsum(tab$x.jour
))

can do it but the result is defferent from your computation.
Not much of help, but maybe you can do better with above suggestion.

Petr



On 2 Nov 2006 at 11:15, GOUACHE David wrote:

Date sent:  Thu, 2 Nov 2006 11:15:49 +0100
From:   GOUACHE David [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] avoiding a loop: cumsum-like

 Hello Rhelpers,
 
 I need to run the following loop over a large number of data-sets, and
 was wondering if it could somehow be vectorized. It's more or less a
 cumulative sum, but slightly more complex. Here's the code, and an
 example dataset (called tab in my code) follows. Thanks in advance for
 any suggestions!
 
 res-0
 for (i in min(tab$Date):max(tab$Date))
 {
  if (is.na(tab$posit.lat[tab$Date==i])==T)
  {
   res-c(res,res[length(res)]+tab$x.jour[tab$Date==i])
  }
  else
  {
   if (res[tab$posit.lat[tab$Date==i]+1]30)
   {
res-c(res,res[length(res)]+tab$x.jour[tab$Date==i])
   }
   else
   {
res-c(res,res[length(res)]+tab$x.jour[tab$Date==i]+0.8*res[tab$pos
it.lat[tab$Date==i]+1])
   }
  }
 }
 res[-1]
 
 
 Date  x.jour  posit.lat
 35804 0   NA
 35805 0   NA
 35806 0   NA
 35807 0   NA
 35808 0   NA
 35809 2.97338883  NA
 35810 2.796389915 NA
 35811 0   NA
 35812 0   NA
 35813 1.000711886 NA
 35814 0.894422571 NA
 35815 0   NA
 35816 0   NA
 35817 0   NA
 35818 0   NA
 35819 0   NA
 35820 0   NA
 35821 0   NA
 35822 0   NA
 35823 0   NA
 35824 0   NA
 35825 0   NA
 35826 0   NA
 35827 0   NA
 35828 0   NA
 35829 0   NA
 35830 0   NA
 35831 0   NA
 35832 0   NA
 35833 0   NA
 35834 0   NA
 35835 0   NA
 35836 0   NA
 35837 0   NA
 35838 0   NA
 35839 0   NA
 35840 2.47237455  NA
 35841 0   2
 35842 0   3
 35843 0   4
 35844 0   5
 35845 0   6
 35846 0   7
 35847 4.842160488 8
 35848 2.432125036 9
 35849 0   10
 35850 0   12
 35851 0   14
 35852 0   16
 35853 3.739683882 18
 35854 1.980214421 20
 35855 0   22
 35856 0   24
 35857 5.953444078 27
 35858 6.455722475 29
 35859 0   31
 35860 3.798690334 32
 35861 6.222993364 34
 35862 3.746243098 35
 35863 0   35
 35864 0   36
 35865 0   37
 35866 0   38
 35867 0   38
 35868 0   39
 35869 0   40
 35870 0   41
 35871 0   42
 35872 0   43
 35873 0   44
 35874 0   45
 35875 0   46
 35876 0   47
 35877 1.951774892 48
 35878 0   49
 35879 0   50
 35880 1.702837643 50
 35881 0   52
 35882 0   53
 35883 0   54
 35884 0   55
 35885 5.953444078 57
 35886 0   58
 35887 5.737515358 59
 35888 0   61
 35889 6.215941227 63
 35890 4.731576675 64
 35891 0   66
 35892 2.255448314 66
 35893 3.782283008 67
 35894 3.244474546 68
 35895 1.808553193 69
 35896 2.622680002 70
 35897 0   71
 35898 0   72
 35899 0   72
 35900 1.7084177   73
 35901 1.28455982  74
 35902 2.320013736 76
 35903 0   77
 35904 0   78
 35905 0   79
 35906 0   79
 35907 0   80
 35908 6.716812458 81
 35909 0   82
 35910 6.796571531 84
 35911 5.573668337 85
 35912 5.42513958  86
 35913 3.774513877 86
 35914 0   87
 35915 0   89
 35916 0   90
 35917 4.208252725 91
 35918 0   92
 35919 0   93
 35920 0   95
 35921 5.70023661  97
 35922 0   98
 35923 0   100
 35924 0   102
 35925 0   103
 35926 0   104
 
 David Gouache
 Arvalis - Institut du Végétal
 Station de La Miničre
 78280 Guyancourt
 Tel: 01.30.12.96.22 / Port: 06.86.08.94.32
 
 __
 R-help@stat.math.ethz.ch 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.

Petr Pikal
[EMAIL PROTECTED]

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


[R] Installing a package - and making it work?

2006-11-03 Thread Hvidberg, Martin
Dear list
 
- Propoerly a beginner question, so bare with my frustration...
 
I tried install the 'shapefiles' package into R 2.4.0 but it seems that the 
install had little effect...
 

 install.packages(c(shapefiles))
--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://cran.dk.r-project.org/bin/windows/contrib/2.4/shapefiles_0.5.zip'
Content type 'application/zip' length 42335 bytes
opened URL
downloaded 41Kb
package 'shapefiles' successfully unpacked and MD5 sums checked
The downloaded packages are in
C:\TEMP\RtmpMz5Pqb\downloaded_packages
updating HTML package descriptions
  dbf - read.dbf(test.dbf)
Error: could not find function read.dbf
 

Note thet the last line contains an error.

 
Is the package installed or not?
How do I get access to use the functionality it offers??
 
:-? Martin Hvidberg

[[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] Installing a package - and making it work?

2006-11-03 Thread Torsten Hothorn

On Fri, 3 Nov 2006, Hvidberg, Martin wrote:

 Dear list

 - Propoerly a beginner question, so bare with my frustration...

 I tried install the 'shapefiles' package into R 2.4.0 but it seems that the 
 install had little effect...


install.packages(c(shapefiles))
   --- Please select a CRAN mirror for use in this session ---
   trying URL 
 'http://cran.dk.r-project.org/bin/windows/contrib/2.4/shapefiles_0.5.zip'
   Content type 'application/zip' length 42335 bytes
   opened URL
   downloaded 41Kb
   package 'shapefiles' successfully unpacked and MD5 sums checked
   The downloaded packages are in
   C:\TEMP\RtmpMz5Pqb\downloaded_packages
   updating HTML package descriptions

library(shapefiles)

 dbf - read.dbf(test.dbf)
   Error: could not find function read.dbf
   

   Note thet the last line contains an error.


 Is the package installed or not?

yes. The book (package) is in the library (is is installed). But you need 
to take it from the shelf and open it to read (load it into R via 
`library(pkgname)').

Best wishes,

Torsten

 How do I get access to use the functionality it offers??

 :-? Martin Hvidberg

   [[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] Installing a package - and making it work?

2006-11-03 Thread Roger Bivand
On Fri, 3 Nov 2006, Hvidberg, Martin wrote:

 Dear list
  
 - Propoerly a beginner question, so bare with my frustration...

Yes, and posting to R-help three minutes after posting to R-sig-geo, the 
correct list - raises the question about who's time is more important, 
doesn't it?

What does help.search(read.dbf) tell you? 

(hint: read.dbf() in shapefiles calls read.dbf() in the recommended 
foreign package, which is certainly already present in your (unstated) 
Windows binary R 2.4.0 installation.)

  
 I tried install the 'shapefiles' package into R 2.4.0 but it seems that the 
 install had little effect...
  
 
install.packages(c(shapefiles))
   --- Please select a CRAN mirror for use in this session ---
   trying URL 
 'http://cran.dk.r-project.org/bin/windows/contrib/2.4/shapefiles_0.5.zip'
   Content type 'application/zip' length 42335 bytes
   opened URL
   downloaded 41Kb
   package 'shapefiles' successfully unpacked and MD5 sums checked
   The downloaded packages are in
   C:\TEMP\RtmpMz5Pqb\downloaded_packages
   updating HTML package descriptions
 dbf - read.dbf(test.dbf)
   Error: could not find function read.dbf

   
   Note thet the last line contains an error.
 
  
 Is the package installed or not?
 How do I get access to use the functionality it offers??
  
 :-? Martin Hvidberg
 
   [[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.
 

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

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


Re: [R] Compare linear regressios for significant differenc es of the slopes

2006-11-03 Thread Dieter Menne

Rainer M Krug wrote:
  I have (8 measures * 96 groups) = 768 datasets for which I did linear
  regressions using lm().
  
  Now I want to compare the slopes for each of the 8 measures in each of 
  the 96 groups. As I understand , I can not use
  anova(lm1, ..., lm8)
  as the lm1 ... lm8 are based on different datasets.
  

Instead of doing this in two steps, you would better use lme in package nlme to
test the hypothesis in one run. I don't understand the details of you design,
but is looks like the oxboys example in Pinheiro/Bates (the book of nlme) could
give you a first starter.

Dieter

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


Re: [R] Installing a package - and making it work?

2006-11-03 Thread Roger Bivand
On Fri, 3 Nov 2006, Torsten Hothorn wrote:

 
 On Fri, 3 Nov 2006, Hvidberg, Martin wrote:
 
  Dear list
 
  - Propoerly a beginner question, so bare with my frustration...
 
  I tried install the 'shapefiles' package into R 2.4.0 but it seems that the 
  install had little effect...
 
 
   install.packages(c(shapefiles))
  --- Please select a CRAN mirror for use in this session ---
  trying URL 
  'http://cran.dk.r-project.org/bin/windows/contrib/2.4/shapefiles_0.5.zip'
  Content type 'application/zip' length 42335 bytes
  opened URL
  downloaded 41Kb
  package 'shapefiles' successfully unpacked and MD5 sums checked
  The downloaded packages are in
  C:\TEMP\RtmpMz5Pqb\downloaded_packages
  updating HTML package descriptions
 
 library(shapefiles)
 
dbf - read.dbf(test.dbf)
  Error: could not find function read.dbf
  
 
  Note thet the last line contains an error.
 
 
  Is the package installed or not?
 
 yes. The book (package) is in the library (is is installed). But you need 
 to take it from the shelf and open it to read (load it into R via 
 `library(pkgname)').

Yes, rather a FAQ, and certainly the cause of the questioner's problem. 
Perhaps reading sections 5.2 and 5.3 of the R FAQ? Or looking at the 
Windows Packages menu a bit more carefully? Reading what sessionInfo() 
says?

Roger

 
 Best wishes,
 
 Torsten
 
  How do I get access to use the functionality it offers??
 
  :-? Martin Hvidberg
 
  [[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.
 

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

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


Re: [R] Prediction intervals for predict.gls

2006-11-03 Thread Dieter Menne
Spencer Jones ssj1364 at gmail.com writes:

 
 I am using R 2.3.0, Is there a way to get prediction intervals using
 predict.gls?
 
A r-project site search (alway recommended) would have given you

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

Dieter

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


[R] Using a deriv function in nlme

2006-11-03 Thread Lisa Avery
Hello,

 

I have a deriv function that I am feeding to nlme. It works, and I can use
it in nls, but when I try to use it in nlme I get Error: subscript out of
bounds.  I can fit the model using SSasympOrig, instead of the deriv
function, but I am trying to reproduce an earlier analysis (done in Splus)
and I get slightly different results with SSasympOrig.

 

Here are my calls:

 

This does fit the nlme model:

L1.lis-nlsList(SSasympOrig,L1.gd)

L1.nlme-nlme(L1.lis) 

 

Here is the derive function -it works for the nls call:

boundedexp-deriv(~100/(1+exp(-L))*(1-exp(-exp(logR)*x)), 

c(L, logR), function(x,L,logR){} )

 

L1.nls-nls(ability ~ boundedexp(age,limit,lograte),

data=L1.gd, start=c(limit=2,lograte=-3))

summary(L1.nls)

 

. but here I run into problems

L1.nlme2-nlme(ability~boundedexp(age,limit,lograte),

data=L1.gd, fixed=limit+lograte~1,start=c(limit=2,lograte=-3))

 

Any suggestions would be well appreciated!


[[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] Forest plot

2006-11-03 Thread brko brko
Need to modify ods ratios (like ods ratios from rmeta) so that they can line 
forest plot? 

How to do that? 

Branko! 

Branko 
Education inc. 
Brd. Icc.

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

2006-11-03 Thread Marc Bernard
Dear All,
   
  I wonder if this is a technical or an interpretation problem. I fitted an lme 
model including a random intercept  and a random slope. The estimated 
correlation, from the lme,  between the random intercept and the random slope 
is equal to 1. Does it mean that I should suppress  one of the random effect 
from the model? 
   
  Thanks a lot,
   
  Bernard 
   


-

[[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] correaltion equal 1

2006-11-03 Thread Doran, Harold
or, it could mean you need to recenter your time variable.


-Original Message-
From: [EMAIL PROTECTED] on behalf of Marc Bernard
Sent: Fri 11/3/2006 7:24 AM
To: r-help@stat.math.ethz.ch
Subject: [R] correaltion equal 1
 
Dear All,
   
  I wonder if this is a technical or an interpretation problem. I fitted an lme 
model including a random intercept  and a random slope. The estimated 
correlation, from the lme,  between the random intercept and the random slope 
is equal to 1. Does it mean that I should suppress  one of the random effect 
from the model? 
   
  Thanks a lot,
   
  Bernard 
   


-

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] Likelihood of multiple random processes

2006-11-03 Thread Eric Elguero
this way the problem is not well posed. You need to place an upper
bound on the number of distributions in the mixture you want to
estimate, for otherwise the likelihood is unbounded (take one normal 
distribution for each value in your data).

- Original Message - 

 Do you know which observations came from which process (you do in your 
 example, but it whatever it is supposed to emulate)?

No- I need to determine whether more than one process could have been 
involved.

__
R-help@stat.math.ethz.ch 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] Rank transformation and the linear mixed model

2006-11-03 Thread Bruno L. Giordano
Hello,
I am looking for references about mixed models built on rank transformed 
data.
Did anybody ever consider this topic?

Thank you,
Bruno


~~
Bruno L. Giordano, Ph.D.
CIRMMT
Schulich School of Music, McGill University
555 Sherbrooke Street West
Montréal, QC H3A 1E3
Canada
http://www.music.mcgill.ca/~bruno/

__
R-help@stat.math.ethz.ch 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] Compare linear regressios for significant differences of the slopes

2006-11-03 Thread Rainer M Krug
Dieter Menne wrote:
 Rainer M Krug wrote:
 I have (8 measures * 96 groups) = 768 datasets for which I did linear
 regressions using lm().

Sorry for my (probably incorrect) usage of group and measure.

Here a (probably better) description of my design:

I ran 96 different simulations (spread of a species along a transect) 
over four generations, based on different parameter sets. These resulted 
in 96 results (groups). Now I have 8 different ways to describe the 
result of one simulation based on x individuals further away then 
distance d, where x is replaced by 1, 5, 10, 50, 100, 500, 1000 and 5000 
(measures). For each group / simulation, I did linear regressions for 
each measure

  lm.measure_1 - lm(distance ~ generation)
...

resulting in lm.measure_1 to lm.measure_8

Within each group (based on one simulation), I get a different slope for 
each measure.

What I want to know is if these resulting slopes differ within one group 
/ simulation.


 Now I want to compare the slopes for each of the 8 measures in each of 
 the 96 groups. As I understand , I can not use
 anova(lm1, ..., lm8)
 as the lm1 ... lm8 are based on different datasets.

 
 Instead of doing this in two steps, you would better use lme in package nlme 
 to
 test the hypothesis in one run. I don't understand the details of you design,
 but is looks like the oxboys example in Pinheiro/Bates (the book of nlme) 
 could
 give you a first starter.
 
 Dieter
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:   +27 - (0)83 9479 042

email:  [EMAIL PROTECTED]
[EMAIL PROTECTED]

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


[R] difference in using with() and the data argument in glm call

2006-11-03 Thread vito muggeo
Dear all,
I am dealing with the following (apparently simple problem):
For some reasons I am interested in passing variables from a dataframe 
to a specific environment, and in fitting a standard glm:

dati-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
KK-new.env()
for(i in 1:ncol(dati)) assign(names(dati[i]),dati[[i]],envir=KK)
#Now the following two lines work correctly:
coef(glm(y~x1+x2,data=KK))
with(KK,coef(glm(y~x1+x2)))

#However if I write the above code inside a function, with() does not 
appear to work..

ff-function(Formula,Data,method=1){
 KK-new.env()
 for(i in 1:ncol(Data)) assign(names(Data[i]),Data[[i]],envir=KK)
 o-if(method==1) glm(Formula,data=KK) else with(KK,glm(Formula))
 o}

  ff(y~x1+x2,dati,1) #it works
Call:  glm(formula = Formula, data = KK)
..[SNIP]..
  ff(y~x1+x2,dati,2) #it does not
Error in eval(expr, envir, enclos) : object y not found
 

Could anyone to explain such difference? I believed that
with(data,glm(formula)) and glm(formula,data) were equivalent.

Many thanks,
vito



-- 

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612

__
R-help@stat.math.ethz.ch 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] [R-pkgs] rcompletion: TAB completion for the R command line

2006-11-03 Thread Deepayan Sarkar
Just a quick follow-up. Thanks to Simon Urbanek and hints from
Alexandre Aguiar, CRAN now has a version (0.0-10) of rcompletion that
should work on more systems. If it still doesn't work when you think
it should, please let me know.

-Deepayan

On 10/30/06, Deepayan Sarkar [EMAIL PROTECTED] wrote:
 CRAN now has a package called rcompletion that attempts to provide TAB
 completion for R using the GNU readline library, intended for R
 sessions run from a command line. From the package help page:
 ...

___
R-packages mailing list
R-packages@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-packages

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


Re: [R] Rank transformation and the linear mixed model

2006-11-03 Thread Bruno L. Giordano
- Original Message - 
From: Frank E Harrell Jr [EMAIL PROTECTED]
To: Bruno L. Giordano [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Friday, November 03, 2006 8:22 AM
Subject: Re: [R] Rank transformation and the linear mixed model


 Bruno L. Giordano wrote:
 Hello,
 I am looking for references about mixed models built on rank transformed
 data.
 Did anybody ever consider this topic?

 Thank you,
 Bruno

 If you are speaking about the response variable, it's better to use a
 formal model such as the proportional odds model (generalization of the
 Wilcoxon test).  That way you can do meaningful interaction tests and much
 more, plus handle ties elegantly with likelihood ratio tests.  Some
 researchers have developed mixed effects prop. odds models (which I
 haven't used yet).

 Frank


That's a nice start indeed!!

However, I am referring both to rank transformation of response variables
and covariates.

The reference to this idea is the work by Conover and Iman (e.g., Conover
and Iman - 1981 - Rank transformations as a bridge between parametric and
nonparametric statistics).

The need would be to handle robustly monotone and nonlinear 
response-covariates relationships.

Bruno



 ~~
 Bruno L. Giordano, Ph.D.
 CIRMMT
 Schulich School of Music, McGill University
 555 Sherbrooke Street West
 Montréal, QC H3A 1E3
 Canada
 http://www.music.mcgill.ca/~bruno/

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



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


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


Re: [R] difference in using with() and the data argument in glm call

2006-11-03 Thread Gabor Grothendieck
It looks into the data argument first and if not found there it looks into
environment(formula).  Thus to pick it out of the 'with' try this:

with(KK, glm(fo, data = environment())

Also you could try this:

environment(fo) - KK
glm(fo)


On 11/3/06, vito muggeo [EMAIL PROTECTED] wrote:
 Dear all,
 I am dealing with the following (apparently simple problem):
 For some reasons I am interested in passing variables from a dataframe
 to a specific environment, and in fitting a standard glm:

 dati-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
 KK-new.env()
 for(i in 1:ncol(dati)) assign(names(dati[i]),dati[[i]],envir=KK)
 #Now the following two lines work correctly:
 coef(glm(y~x1+x2,data=KK))
 with(KK,coef(glm(y~x1+x2)))

 #However if I write the above code inside a function, with() does not
 appear to work..

 ff-function(Formula,Data,method=1){
 KK-new.env()
 for(i in 1:ncol(Data)) assign(names(Data[i]),Data[[i]],envir=KK)
 o-if(method==1) glm(Formula,data=KK) else with(KK,glm(Formula))
 o}

   ff(y~x1+x2,dati,1) #it works
 Call:  glm(formula = Formula, data = KK)
 ..[SNIP]..
   ff(y~x1+x2,dati,2) #it does not
 Error in eval(expr, envir, enclos) : object y not found
  

 Could anyone to explain such difference? I believed that
 with(data,glm(formula)) and glm(formula,data) were equivalent.

 Many thanks,
 vito



 --
 
 Vito M.R. Muggeo
 Dip.to Sc Statist e Matem `Vianelli'
 Università di Palermo
 viale delle Scienze, edificio 13
 90128 Palermo - ITALY
 tel: 091 6626240
 fax: 091 485726/485612

 __
 R-help@stat.math.ethz.ch 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] Rank transformation and the linear mixed model

2006-11-03 Thread Frank E Harrell Jr
Bruno L. Giordano wrote:
 - Original Message - From: Frank E Harrell Jr 
 [EMAIL PROTECTED]
 To: Bruno L. Giordano [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Friday, November 03, 2006 8:22 AM
 Subject: Re: [R] Rank transformation and the linear mixed model
 
 
 Bruno L. Giordano wrote:
 Hello,
 I am looking for references about mixed models built on rank transformed
 data.
 Did anybody ever consider this topic?

 Thank you,
 Bruno

 If you are speaking about the response variable, it's better to use a
 formal model such as the proportional odds model (generalization of the
 Wilcoxon test).  That way you can do meaningful interaction tests and 
 much
 more, plus handle ties elegantly with likelihood ratio tests.  Some
 researchers have developed mixed effects prop. odds models (which I
 haven't used yet).

 Frank

 
 That's a nice start indeed!!
 
 However, I am referring both to rank transformation of response variables
 and covariates.
 
 The reference to this idea is the work by Conover and Iman (e.g., Conover
 and Iman - 1981 - Rank transformations as a bridge between parametric and
 nonparametric statistics).

That has largely been replaced by flexible right-hand-side regression 
modeling (regression splines, gams, etc).  These will handle any smooth 
shape and allow for modeling interactions.  The problem with Conover and 
Iman's method is that when more than one X-variable is being ranked, 
interpretation of partial effects is difficult, and interpretation of 
interactions is nearly impossible.

Frank

 
 The need would be to handle robustly monotone and nonlinear 
 response-covariates relationships.
 
Bruno
 


 ~~
 Bruno L. Giordano, Ph.D.
 CIRMMT
 Schulich School of Music, McGill University
 555 Sherbrooke Street West
 Montréal, QC H3A 1E3
 Canada
 http://www.music.mcgill.ca/~bruno/

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



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

 
 
 


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

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


[R] Error in X11(): Font Path?

2006-11-03 Thread Marc Seil
Hy, 

I had the some problem. In my case an adjustment of the X11 font path,
in the xorg.conf file did solve the problem. The fonts on my system were
located in /usr/share/fonts and not in /usr/share/X11/fonts. 


Cheers 

Marc

__
R-help@stat.math.ethz.ch 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] Rank transformation and the linear mixed model

2006-11-03 Thread Dieter Menne
Bruno L. Giordano bruno.giordano at music.mcgill.ca writes:

 
 I am looking for references about mixed models built on rank transformed 
 data.


To complement Frank H: Try lrm in package Design.

Dieter

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


Re: [R] Using a deriv function in nlme

2006-11-03 Thread Dieter Menne
Lisa Avery lisa_avery at sympatico.ca writes:

 
 Hello,
 
 I have a deriv function that I am feeding to nlme. It works, and I can use
 it in nls, but when I try to use it in nlme I get Error: subscript out of
 bounds.  I can fit the model using SSasympOrig, instead of the deriv

It might by a similar problem as in 

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

Dieter Menne

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


[R] read file problem

2006-11-03 Thread Luis Ridao Cruz
R-help,

I have the following file I want to import to R (some lines
removed)


Calibrated CTD data for station:00280001
Calibrated:23/8  2001, Salinity Unsmoothed,  Fluorescence Uncalibrated
Maximum observed depth:36 m   
QUAL has one digit for each of pressure, temp., sal. and fluor.   
QUAL=1:Uncal.,  QUAL=2:OK,  QUAL=6:Interp.,  QUAL=9:No data   
  
DEPTH  CTDPRS  CTDTMP  CTDSAL  RAWFLU NUMB. QUAL
MDBAR IPTS-68  PSS-78  OBS.
  *** *** *** ***
1 1.0   2999
2 2.0  5.9793 35.1629.10717 2221
3 3.0  5.9797 35.1631.10117 2221
4 4.0  5.9809 35.1631.11812 2221
5 5.1  5.9811 35.1629.11542 2221
6 6.1  5.9810 35.1631.11618 2221
7 7.1  5.9797 35.1631.11615 2221
8 8.1  5.9798 35.1630.10213 2221
9 9.1  5.9792 35.1629.11311 2221
...

.


If I use :

read.table(file, skip = 10)

it works fine but sometimes the missing data are not only
in line number 1 ( 1 1.0   2999)
but in lines 1,2,3,,, and therefore R fails to import the data file

How can I fix it?
I have tried with the arguments 
strip.white = TRUE
, fill = TRUE
, blank.lines.skip = TRUE

but still not get what I want


Thanks in advance

 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)

__
R-help@stat.math.ethz.ch 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] identify extremes positions of values into matrix

2006-11-03 Thread Milton Cezar Ribeiro
Hi R-friends around world!
  I have a matrix that looks like bellow one.
Each cell are filled with values 0, 1 or 2.
In fact I have a lot of 512x512 matrices, with
values varying from 0 to 999.
  I need to retrieve the left and right columns
and the top and botton lines of the matrix
where occours for example the value 2. 
Column and row labels are included at the example.
   
1234567890
1 00
2 011100
3 011100
4 00
5 002220
6 000222
7 002200
8 00
   
  At this example, the right answer are:
  collumns 3 and 8
  lines 5 and 7
  Any idea of how can I solve this?
  Kind regards,
  Miltinho


-

 Música para ver e ouvir: You're Beautiful, do James Blunt
[[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] identify extremes positions of values into matrix

2006-11-03 Thread Dimitris Rizopoulos
try this:

# `mat'  is your matrix
apply(which(mat == 2, arr.ind = TRUE), 2, range)


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: Milton Cezar Ribeiro [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Friday, November 03, 2006 3:25 PM
Subject: [R] identify extremes positions of values into matrix


 Hi R-friends around world!
  I have a matrix that looks like bellow one.
 Each cell are filled with values 0, 1 or 2.
 In fact I have a lot of 512x512 matrices, with
 values varying from 0 to 999.
  I need to retrieve the left and right columns
 and the top and botton lines of the matrix
 where occours for example the value 2.
 Column and row labels are included at the example.

1234567890
 1 00
 2 011100
 3 011100
 4 00
 5 002220
 6 000222
 7 002200
 8 00

  At this example, the right answer are:
  collumns 3 and 8
  lines 5 and 7
  Any idea of how can I solve this?
  Kind regards,
  Miltinho


 -

 Música para ver e ouvir: You're Beautiful, do James Blunt
 [[alternative HTML version deleted]]







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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


[R] R CMD BATCH: unable to start device PNG

2006-11-03 Thread ryszard . czerminski
Dear r-helpers:

Any ideas how to avoid problem described below?
I am having the same problem when I run R remotly (not from cgi script);
somehow png device wants to talk to X11 and X11 complains...

Best regards,
Ryszard

error msg from batch R process (Linux/R-2.4.0) (executed on Apache server 
from cgi script):

Error in X11(paste(png::, filename, sep = ), width, height, pointsize, 
 :
unable to start device PNG
In addition: Warning message:
unable to open connection to X11 display ''
Execution halted
[[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] help went away from top emacs window :-(

2006-11-03 Thread Duncan Murdoch
On 11/3/2006 12:02 AM, Spencer Graves wrote:
   This change has created problems for me using XEmacs 21.4.19 with 
 ESS 5.3.1
 
   ?help
 
 Error in 
 print.help_files_with_topic(c:/progra~1/R/R-2.4.0/library/utils/chm/help) 
 :
 CHM file could not be displayed
 
   sessionInfo()
 R version 2.4.0 (2006-10-03)
 i386-pc-mingw32

Can one of you ESS users track down what's going wrong?  When I run 
Rterm at a command prompt with the --ess option, I have no trouble 
displaying CHMHELP.  It looks to me like an Emacs bug, but I can't 
really see how it could cause that particular error message.

Duncan Murdoch

 locale:
 LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
 States.1252;LC_MONETARY=English_United 
 States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
 
 attached base packages:
 [1] methods   stats graphics  grDevices utils datasets
 [7] base
 
   Restoring the previous default with options(chmhelp=FALSE) 
 eliminates this problem.  From the time I first noticed this problem 
 until just prior to reading this thread, I used RGui to get help.  (It 
 wasn't hard to think of this, because 'install.packages' under ESS goes 
 waits for me to select a mirror -- but without asking me to select 
 such!  Result:  I used RGui instead of Rterm under XEmacs to 
 install.packages.) 
 
   FYI. 
   Thanks for all your great efforts on R.  It has definitely made me 
 much more productive, and I believe it is making substantive 
 contributions to the improvement of people's quality of life all over 
 the world. 
 
   Best Wishes,
   Spencer Graves
 
 Richard M. Heiberger wrote:
 I agree with both Duncan and Martin.  With Duncan, that this is not
 a Windows FAQ.  With Martin, that it is an FAQ.  I recommend that it
 go on the R FAQ page, prior to the current 7.24.  Here is a draft of the
 question and an outline of the answer.

 7.24 Why does the help information, for example when I type ?lm,
   show up in (a browser window, an emacs buffer in its own frame, an
   emacs buffer in the same frame as *R*, in a Windows-style help window,
   in a new frame inside the Rgui window, in a new frame on the computer
   screen)?  I really want it in the (choose from the same list).

 The answer includes at least the following:
 On Windows, set options(chmhelp=TRUE/FALSE).
 With Java, use help.start()
 In emacs, set the emacs variable ess-help-frame
 





 On the correct default for ESS, I am not sure for myself.
 I can see a case both for help in emacs buffers and in the
 chmhelp window.  This week I am tending to the chmhelp window,
 even when on emacs.

 Rich

 __
 R-help@stat.math.ethz.ch 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 went away from top emacs window :-(

2006-11-03 Thread Richard M. Heiberger
I located what might be the problem.  There is a different misbehavior
with Gnu emacs.  I don't have Xemacs.  I have an idea how to fix it but
haven't worked out the details.


ess-inf.el in the lines
(defconst inferior-R-1-input-help (format ^ *help *(%s) ess-help-arg-regexp))
(defconst inferior-R-2-input-help (format ^ *\\? *%s ess-help-arg-regexp))
(defconst inferior-R-page (format ^ *page *(%s) ess-help-arg-regexp))

detects help requests from the commandline in the *R* buffer and redirects
their output to an emacs *help[R] (whatever)* buffer.

In gnu emacs on windows, with options(chmhelp=TRUE), the effect is an empty
*help[R] (whatever)* buffer.  What I think happened is that ESS trapped the
request and created the buffer, then R never got the right content to send
to that buffer because R thinks that chm is handling it.

The fix probably requires ESS to check the value of the chmhelp option
and suppress the interception of help requests if the option has the value
TRUE.  ESS also needs to monitor if that option has been changed.  This might
mean that ESS always intercepts help requests and checks the value of the option
each time.

Rich

__
R-help@stat.math.ethz.ch 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 went away from top emacs window :-(

2006-11-03 Thread Spencer Graves
  This change has created problems for me using XEmacs 21.4.19 with 
ESS 5.3.1

  ?help

Error in 
print.help_files_with_topic(c:/progra~1/R/R-2.4.0/library/utils/chm/help) 
:
CHM file could not be displayed

  sessionInfo()
R version 2.4.0 (2006-10-03)
i386-pc-mingw32

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

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

  Restoring the previous default with options(chmhelp=FALSE) 
eliminates this problem.  From the time I first noticed this problem 
until just prior to reading this thread, I used RGui to get help.  (It 
wasn't hard to think of this, because 'install.packages' under ESS goes 
waits for me to select a mirror -- but without asking me to select 
such!  Result:  I used RGui instead of Rterm under XEmacs to 
install.packages.) 

  FYI. 
  Thanks for all your great efforts on R.  It has definitely made me 
much more productive, and I believe it is making substantive 
contributions to the improvement of people's quality of life all over 
the world. 

  Best Wishes,
  Spencer Graves

Richard M. Heiberger wrote:
 I agree with both Duncan and Martin.  With Duncan, that this is not
 a Windows FAQ.  With Martin, that it is an FAQ.  I recommend that it
 go on the R FAQ page, prior to the current 7.24.  Here is a draft of the
 question and an outline of the answer.

 7.24 Why does the help information, for example when I type ?lm,
   show up in (a browser window, an emacs buffer in its own frame, an
   emacs buffer in the same frame as *R*, in a Windows-style help window,
   in a new frame inside the Rgui window, in a new frame on the computer
   screen)?  I really want it in the (choose from the same list).

 The answer includes at least the following:
 On Windows, set options(chmhelp=TRUE/FALSE).
 With Java, use help.start()
 In emacs, set the emacs variable ess-help-frame
 





 On the correct default for ESS, I am not sure for myself.
 I can see a case both for help in emacs buffers and in the
 chmhelp window.  This week I am tending to the chmhelp window,
 even when on emacs.

 Rich

 __
 R-help@stat.math.ethz.ch 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 went away from top emacs window :-(

2006-11-03 Thread Richard M. Heiberger
I located what might be the problem.  There is a different misbehavior
with Gnu emacs.  I don't have Xemacs.  I have an idea how to fix it but
haven't worked out the details.


ess-inf.el in the lines
(defconst inferior-R-1-input-help (format ^ *help *(%s) ess-help-arg-regexp))
(defconst inferior-R-2-input-help (format ^ *\\? *%s ess-help-arg-regexp))
(defconst inferior-R-page (format ^ *page *(%s) ess-help-arg-regexp))

detects help requests from the commandline in the *R* buffer and redirects
their output to an emacs *help[R] (whatever)* buffer.

In gnu emacs on windows, with options(chmhelp=TRUE), the effect is an empty
*help[R] (whatever)* buffer.  What I think happened is that ESS trapped the
request and created the buffer, then R never got the right content to send
to that buffer because R thinks that chm is handling it.

The fix probably requires ESS to check the value of the chmhelp option
and suppress the interception of help requests if the option has the value
TRUE.  ESS also needs to monitor if that option has been changed.  This might
mean that ESS always intercepts help requests and checks the value of the option
each time.

Rich

__
R-help@stat.math.ethz.ch 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] R CMD BATCH: unable to start device PNG

2006-11-03 Thread Jeffrey Horner
[EMAIL PROTECTED] wrote:
 Dear r-helpers:
 
 Any ideas how to avoid problem described below?
 I am having the same problem when I run R remotly (not from cgi script);
 somehow png device wants to talk to X11 and X11 complains...
 
 Best regards,
 Ryszard
 
 error msg from batch R process (Linux/R-2.4.0) (executed on Apache server 
 from cgi script):
 
 Error in X11(paste(png::, filename, sep = ), width, height, pointsize, 
  :
 unable to start device PNG
 In addition: Warning message:
 unable to open connection to X11 display ''
 Execution halted

Here's a snippet from the png help page:


  'bitmap' provides an alternative way to generate PNG and JPEG
  plots that does not depend on accessing the X11 display but does
  depend on having GhostScript installed.  (Device 'GDD' in 'GDD' is
  another alternative using several other additional pieces of
  software.)

You can find GDD and another alternative Cairo here:

http://www.rosuda.org/R

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

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

2006-11-03 Thread john seers \(IFR\)




Hi

If the file is tab delimited you could try something like this:

 a-read.delim(file, skip = 9, header=F, na.strings=NA)


Are you sure you want to skip 10 lines? (Is there a blank line
somewhere?)



J


 
---
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Luis Ridao Cruz
Sent: 03 November 2006 14:03
To: r-help@stat.math.ethz.ch
Subject: [R] read file problem


R-help,

I have the following file I want to import to R (some lines
removed)


Calibrated CTD data for station:00280001
Calibrated:23/8  2001, Salinity Unsmoothed,  Fluorescence Uncalibrated
Maximum observed depth:36 m   
QUAL has one digit for each of pressure, temp., sal. and fluor.   
QUAL=1:Uncal.,  QUAL=2:OK,  QUAL=6:Interp.,  QUAL=9:No data   
  
DEPTH  CTDPRS  CTDTMP  CTDSAL  RAWFLU NUMB. QUAL
MDBAR IPTS-68  PSS-78  OBS.
  *** *** *** ***
1 1.0   2999
2 2.0  5.9793 35.1629.10717 2221
3 3.0  5.9797 35.1631.10117 2221
4 4.0  5.9809 35.1631.11812 2221
5 5.1  5.9811 35.1629.11542 2221
6 6.1  5.9810 35.1631.11618 2221
7 7.1  5.9797 35.1631.11615 2221
8 8.1  5.9798 35.1630.10213 2221
9 9.1  5.9792 35.1629.11311 2221
...

.


If I use :

read.table(file, skip = 10)

it works fine but sometimes the missing data are not only
in line number 1 ( 1 1.0   2999)
but in lines 1,2,3,,, and therefore R fails to import the data file

How can I fix it?
I have tried with the arguments 
strip.white = TRUE
, fill = TRUE
, blank.lines.skip = TRUE

but still not get what I want


Thanks in advance

 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)

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

2006-11-03 Thread ronggui

You should pay attention to the argument na.string.

na.strings: a character vector of strings which are to be interpreted
 as 'NA' values.  Blank fields are also considered to be
 missing values in logical, integer, numeric and complex
 fields.


On 11/3/06, Luis Ridao Cruz [EMAIL PROTECTED] wrote:

R-help,

I have the following file I want to import to R (some lines
removed)


Calibrated CTD data for station:00280001
Calibrated:23/8  2001, Salinity Unsmoothed,  Fluorescence Uncalibrated
Maximum observed depth:36 m
QUAL has one digit for each of pressure, temp., sal. and fluor.
QUAL=1:Uncal.,  QUAL=2:OK,  QUAL=6:Interp.,  QUAL=9:No data

DEPTH  CTDPRS  CTDTMP  CTDSAL  RAWFLU NUMB. QUAL
MDBAR IPTS-68  PSS-78  OBS.
  *** *** *** ***
1 1.0   2999
2 2.0  5.9793 35.1629.10717 2221
3 3.0  5.9797 35.1631.10117 2221
4 4.0  5.9809 35.1631.11812 2221
5 5.1  5.9811 35.1629.11542 2221
6 6.1  5.9810 35.1631.11618 2221
7 7.1  5.9797 35.1631.11615 2221
8 8.1  5.9798 35.1630.10213 2221
9 9.1  5.9792 35.1629.11311 2221
...

.


If I use :

read.table(file, skip = 10)

it works fine but sometimes the missing data are not only
in line number 1 ( 1 1.0   2999)
but in lines 1,2,3,,, and therefore R fails to import the data file

How can I fix it?
I have tried with the arguments
strip.white = TRUE
, fill = TRUE
, blank.lines.skip = TRUE

but still not get what I want


Thanks in advance

 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)

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




--
Ronggui Huang
Department of Sociology
Fudan University, Shanghai, China
黄荣贵
复旦大学社会学系

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

2006-11-03 Thread Philipp Pagel
On Fri, Nov 03, 2006 at 02:02:35PM +, Luis Ridao Cruz wrote:

 DEPTH  CTDPRS  CTDTMP  CTDSAL  RAWFLU NUMB. QUAL
 MDBAR IPTS-68  PSS-78  OBS.
   *** *** *** ***
 1 1.0   2999
 2 2.0  5.9793 35.1629.10717 2221
 3 3.0  5.9797 35.1631.10117 2221
 4 4.0  5.9809 35.1631.11812 2221
 5 5.1  5.9811 35.1629.11542 2221
 6 6.1  5.9810 35.1631.11618 2221
 7 7.1  5.9797 35.1631.11615 2221
 8 8.1  5.9798 35.1630.10213 2221
 9 9.1  5.9792 35.1629.11311 2221

 read.table(file, skip = 10)

To me it looks like your data is in a fixed-width format. If that is the
case you should use read.fwf() instead of read.table().

cu
Philipp

-- 
Dr. Philipp PagelTel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics  Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

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

2006-11-03 Thread Jeff Newmiller
Luis Ridao Cruz wrote:
 R-help,
 
 I have the following file I want to import to R (some lines
 removed)
 
 
 Calibrated CTD data for station:00280001
 Calibrated:23/8  2001, Salinity Unsmoothed,  Fluorescence Uncalibrated
 Maximum observed depth:36 m   
 QUAL has one digit for each of pressure, temp., sal. and fluor.   
 QUAL=1:Uncal.,  QUAL=2:OK,  QUAL=6:Interp.,  QUAL=9:No data   
   
 DEPTH  CTDPRS  CTDTMP  CTDSAL  RAWFLU NUMB. QUAL
 MDBAR IPTS-68  PSS-78  OBS.
   *** *** *** ***
 1 1.0   2999
 2 2.0  5.9793 35.1629.10717 2221
 3 3.0  5.9797 35.1631.10117 2221
 4 4.0  5.9809 35.1631.11812 2221
 5 5.1  5.9811 35.1629.11542 2221
 6 6.1  5.9810 35.1631.11618 2221
 7 7.1  5.9797 35.1631.11615 2221
 8 8.1  5.9798 35.1630.10213 2221
 9 9.1  5.9792 35.1629.11311 2221
 ...
 
 .
 
 
 If I use :
 
 read.table(file, skip = 10)
 
 it works fine but sometimes the missing data are not only
 in line number 1 ( 1 1.0   2999)
 but in lines 1,2,3,,, and therefore R fails to import the data file
 
 How can I fix it?
 I have tried with the arguments 
 strip.white = TRUE
 , fill = TRUE
 , blank.lines.skip = TRUE
 
 but still not get what I want

This looks like a job for read.fwf...

?read.fwf

-- 
---
Jeff NewmillerThe .   .  Go Live...
DCN:[EMAIL PROTECTED]Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@stat.math.ethz.ch 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] maps. display hierararchical cluster analysis results on a map?

2006-11-03 Thread Marshall Feldman
Besides symbols, size and color ramps come to mind

Marsh Feldman

-Original Message-
From: David Farrar [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 02, 2006 9:37 PM
To: R-help@stat.math.ethz.ch
Subject: [R] maps. display hierararchical cluster analysis results on a map?

All,
   
  I have done a cluster analysis analysis of some spatial locations, 
  based on variables other than lat-long, and want to show the results
  on a map to see if my clusters have some geographic meaning.  
   
  For kmeans (etc.) I would just use different symbols (etc.)
  to distinguish the clusters, but I am doing hierarchical CA.  I am looking
  for ideas or (better) code.  
   
  One idea would be to display the convex hull of each cluster on the map.
Another would be to place some graph on the map, connecting the locations, 
  with the same topology as my dendrogram.  
   
  It seems like something useful would have been developed by biologists 
  studying geographic variation of a species.  
   
  Any ideas will be greatly appreciated.
  regards,
  Farrar
   
   
   
   

[[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] generic arrays in R

2006-11-03 Thread Tamas K Papp
On Fri, Nov 03, 2006 at 07:20:34AM +, Prof Brian Ripley wrote:

 but
 
 a - array(list(f),c(2,2))
 a[[2,1]]

Thank you very much.  Can you please tell me how to make apply
generate arrays like this?  Eg if

a - array(1:16,rep(2,4))

then a

apply(a,c(1,2,4), polynomial)

will just give me a regular array of numbers, and

apply(a,c(1,2,4),function(x) list(polynomial(x)))

give me a generic array, but the polynomials I want are inside lists:
I need constructs like [[1,1,1]][[1]] to access them.  I would like to
get a 3-way array with polynomials in it.  It seems to work with
function(x) splinefun(c(0,1),x) instead of polynomial, but array just
converts polynomials into vectors...  How can I protect them?

Thank you,

Tamas

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

2006-11-03 Thread Joseph Mbekulu

Attn. 

Geschäftsvorschlag. 

Zuerst muß ich um Ihre Zuversicht in dieser verhandlung bitten. Das ist 
auf Grund seiner lage, als das sein total VERTRAULICH und 
Geheimnisvoll. 

Aber ich weiss, dass eine verhandlung dieses Ausmaßes irgendeinen 
Ängstlich und besorgt machen wird,aber ich versichre Ihnen, dass alles 
am Ende des tages in ordnung sein wird. 
Wir haben uns entschieden Sie durch eine E-mail sendung,wegen der 
Dringlichkeit diese verhandlung zu erreichen, als wir davon zuverlassig 
von seiner schnelligkeit und vertraulichkeit Überzeugt worden sind. 


Ich möchte mich nun vorstellen. Ich bin Herr Joseph Mbekulu 
(Rechnungprüfer bei der Chartered Bank von Süd Afrika). 
Ich kam zu ihrem kontakt in meiner persönlichen suche nach einer 
zuverlassigen und anstandige person, um eine sehr vertrauliche 
verhandlung zu erledigen, die Übertragung von einem fremden Konto das 
maximale zuversicht erfordert. 
Der vorschlag:Ein Ausländische,verstorbener Ingenieur Jurgen Rosenthal, 
ein Diamante-Handler/unternehmer mit der Republik Süd Afrika. 

Er war bis seinem Tod vor drei jahren in einem Flugzeug absturz,als 
unternehmer bei der Regierung tatig. Herr Rosenthal war unser kunde 
hier bei der Chartered Bank von Süd Afrika Johannesburg und hatte ein 
Konto guthaben von US$14.3 million (Vierzehnmilliondreihunderttausend 
United States Dollar). welches die Bank jetzt fraglos erwartet durch 
seine Verwandten das Sie sich melden, wenn Sie sich nicht melden wird 
alles 
zu einem Afrikanischen vertrauens fond für waffen und munitions 
besorgungen bei einer freiheitsbewegung hier in Africa gespendet. 

Leidenschaftliche wertvolle Anstrengungen werden durch die Chartered 
Bank gemacht,um einen kontakt mit jemanden von der Rosenthal familie 
oder 
Verwandten zu bekommen.Es hat aber bis jetzt keinen Erfolg gegeben. 

Es ist wegen der wahrgenommen moglichkeit keinen verwandten der 
Rosenthal zu finden (er hatte keine frau und kinder) dass eine 
Anordnung für den fond als nicht zubehaupten deklariert werden,sollte, 
und dann 
zum vertrauens-fond für waffen und munition bersorgung ausgeben,die dem 
kurs 
vom krieg in Afrika gespendet wird. 

Um dieser negative Entwicklung abzuwenden, haben ich und einige meiner 
bewährten kollegen in der Bank beschlossen das Geld nach Ihre 
zustimmung zu Überweisen und suchen jetzt Ihre Erlaubnis das Sie sich 
als verwandter des verstorbenen Ing.Jurgen Rosenthal deklarieren,damit 
der 
Fond in der höhe von USD$14.3m infolgen dessen als der 
Nutznießer(Verwandter 
des Rosenthal)auf Ihr Bank Konto Überwiesen werden. 

Alle beurkundungen und Beweist die Ihnen ermöglichen diese Fonds zu 
behaupten werden wir zu Ihrer verfügung stellen,damit alles gut 
verläuft und wir versicheren Ihnen ein 100% Risiko freie Verwicklung. 
Ihr Anteil wäre 30% von der totalen Gange, während die restlichen 
70% ist für mich und meine kollege. 

Wenn dieser vorschlag für Sie OK ist und Sie Wünschen das vertrauen 
auszunutzen, das wir hoffen auf Ihnen und Ihrer Gesellschaft zu 
verleihen,dann senden sie mir netterweise sofort per meine personal 
E-mail Adresse, Ihre Voll Namen, Adresse, Telefonnummer, fax-nummer und 
Ihre vertraulicher E-mail adresse, damit ich Ihnen die relevanten details 
dieser verhandlung senden kann. 

Danke in voraus. 

Mit freundlichen Grüße. 
Joseph Mbekublu. 

Bitte schicken Sie Ihre Antwort auf meine Vertraulichen Email Adresse: [EMAIL 
PROTECTED]

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


Re: [R] R CMD BATCH: unable to start device PNG

2006-11-03 Thread Kuhn, Max
Whoops. I hit the wrong button! Here's the whole message:


And on that note, here is a function that I use to get around it:

startPNG - function(filename,  width = 680, height = 990, ...)
{
   nativePNG - capabilities(png)
   
   if(nativePNG)
   {
  png(file = filename, width = width, height = height, ...)   
   } else {
  bitmap(file = filename, width = width/72,  height = height/72,
...)  
   }
   invisible(NULL)
} 


Max


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey Horner
Sent: Friday, November 03, 2006 10:01 AM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] R CMD BATCH: unable to start device PNG

[EMAIL PROTECTED] wrote:
 Dear r-helpers:
 
 Any ideas how to avoid problem described below?
 I am having the same problem when I run R remotly (not from cgi
script);
 somehow png device wants to talk to X11 and X11 complains...
 
 Best regards,
 Ryszard
 
 error msg from batch R process (Linux/R-2.4.0) (executed on Apache
server 
 from cgi script):
 
 Error in X11(paste(png::, filename, sep = ), width, height,
pointsize, 
  :
 unable to start device PNG
 In addition: Warning message:
 unable to open connection to X11 display ''
 Execution halted

Here's a snippet from the png help page:


  'bitmap' provides an alternative way to generate PNG and JPEG
  plots that does not depend on accessing the X11 display but does
  depend on having GhostScript installed.  (Device 'GDD' in 'GDD' is
  another alternative using several other additional pieces of
  software.)

You can find GDD and another alternative Cairo here:

http://www.rosuda.org/R

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


Re: [R] R CMD BATCH: unable to start device PNG

2006-11-03 Thread Kuhn, Max
And on that note, here is a function that I use to get around it:
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey Horner
Sent: Friday, November 03, 2006 10:01 AM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] R CMD BATCH: unable to start device PNG

[EMAIL PROTECTED] wrote:
 Dear r-helpers:
 
 Any ideas how to avoid problem described below?
 I am having the same problem when I run R remotly (not from cgi
script);
 somehow png device wants to talk to X11 and X11 complains...
 
 Best regards,
 Ryszard
 
 error msg from batch R process (Linux/R-2.4.0) (executed on Apache
server 
 from cgi script):
 
 Error in X11(paste(png::, filename, sep = ), width, height,
pointsize, 
  :
 unable to start device PNG
 In addition: Warning message:
 unable to open connection to X11 display ''
 Execution halted

Here's a snippet from the png help page:


  'bitmap' provides an alternative way to generate PNG and JPEG
  plots that does not depend on accessing the X11 display but does
  depend on having GhostScript installed.  (Device 'GDD' in 'GDD' is
  another alternative using several other additional pieces of
  software.)

You can find GDD and another alternative Cairo here:

http://www.rosuda.org/R

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


[R] CI -- fixed effects -- response -- mixed models

2006-11-03 Thread Michael Kubovy
Dear Friends,

I have been following the discussions of mixed-effects models with  
some confusion, and I realize that much of this is work in progress,  
and that much of the discussion is beyond my knowledge of statistics.

My question is simple, though: Is there a set of commands that will  
produce an output equivalent to the exceedingly useful
predict(bl.lm, newdata = bl.new, type = 'response', interval =  
'confidence')
for (at least) gaussian mixed-effects model (but preferably for glmm  
models)? I have looked at
predict.glmmPQL {MASS}
predict.lme {nlme}
and neither of them offer exactly what I need, and I just don't know  
enough to go from what they do offer to what I need. I have Pinheiro  
 Bates as well as MASS, and both come tantalizingly close to what I  
need, but I can't figure out the next step.

AFAIK, there's nothing of the sort for aov(. ~ ., Error(...) ...)  
either.

In order to publish results of designed psychological experiments  
(most of which are of the classic anova variety, with all the  
predictors being factors), we need to plot error bars on our  
interaction plots. I suspect (from the discussion on this list) that  
my colleagues are using SPSS or SAS, and reporting incorrect CIs.

Not being a statistician I have hit a wall here. I'm not sure if the  
transition to the results I need is staring me in the face, and I  
don't know enough to take the next step, or if the tools aren't yet  
available. In any event, I would be very grateful to you for guidance  
on how to proceed.
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

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


[R] R-help in Newsreader?

2006-11-03 Thread Matthias Voigt
Dear list,

I am new to this all and therefore have following Newbie question:

How can I receive and read R-help mailings in a newsreader like thunderbird?

Thanks
Matthias
_



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

2006-11-03 Thread Marc Schwartz
On Fri, 2006-11-03 at 17:36 +0100, Matthias Voigt wrote:
 Dear list,
 
 I am new to this all and therefore have following Newbie question:
 
 How can I receive and read R-help mailings in a newsreader like thunderbird?
 
 Thanks
 Matthias

If you go to the main R web site (http://www.r-project.org/) and click
on the Mailing Lists link, then scroll down to Archives and Search
Facilities, the second bullet indicates that the lists are available
via Gmane, which mirrors the R lists (and many others) to an NNTP
server.

HTH,

Marc Schwartz

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


[R] Import problem with S-Plus 7.0 dataset

2006-11-03 Thread Inman, Brant A. M.D.

I am running R 2.3.1 on a Windows XP machine.  I am trying to import
some data into R that is stored as an S-Plus 7.0 .sdd file.

When I run the following command, I get this error:

 library(foreign)
 d - read.S(file='H:\\Research\\data.sdd')

Error in read.S(file = H:\\Research\\data.sdd) : 
not an S object


The dataset is fairly large, roughly 13000 rows and 100 columns, but
within S-Plus 7.0 it is stored as a normal dataframe (not a bd
dataframe).

Any ideas?

Brant Inman



[[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] correaltion equal 1

2006-11-03 Thread Douglas Bates
On 11/3/06, Doran, Harold [EMAIL PROTECTED] wrote:
 or, it could mean you need to recenter your time variable.


 -Original Message-
 From: [EMAIL PROTECTED] on behalf of Marc Bernard
 Sent: Fri 11/3/2006 7:24 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] correaltion equal 1

 Dear All,

   I wonder if this is a technical or an interpretation problem. I fitted an 
 lme model including a random intercept  and a random slope. The estimated 
 correlation, from the lme,  between the random intercept and the random slope 
 is equal to 1. Does it mean that I should suppress  one of the random effect 
 from the model?

It probably indicates that the estimate of the variance-covariance
matrix for the random effects is singular.  If you refit the model
using lmer from the lme4 package and the estimate of the
variance-covariance matrix is singular, you will get a warning to that
effect.

As Harold mentioned, you may be able to avoid the problem by
re-centering the covariate.  However, this may also be a
characteristic of your data.

__
R-help@stat.math.ethz.ch 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] Translation of R code required

2006-11-03 Thread Sarah White

Dear All

I am a complete novice when it comes to R.  I have been sent some code 
which I need to run on a dataset.  I have downloaded  and installed R 
but I dont seem to be able to get the code to run.

I was hoping someone on the list would be able to give me a 
'translation' of what the code is trying to do and if there appears to 
be any errors in it.

The code is;

mental - read.csv(dataextract.csv)

mental$Rx - factor(mental$Rx, levels=c(VS,IPS))

library(MASS)

model.effect - glmmPQL(p~Benefit/Rx, ~1|Centre, data=mental, 
family=quasi(link=identity, variance=mu(1-mu)), weight=n)

model.combined - glmmPQL(p~ Rx, ~1|Centre, data=mental, 
family=quasi(link=identity, variance=mu(1-mu)), weight=n)

summary(model.effect)
summary(model.combined)




model.overall -  glmmPQL(p~-1+Benefit, ~1|Centre, data=mental, family=quasi( 
link=identity,variance=mu(1-mu)), weight=n)
model.overall.combined - glmmPQL(p~1, ~1|Centre, data=mental, family=quasi( 
link=identity,variance=mu(1-mu)), weight=n)

summary(model.overall)


summary(model.overall.combined)

The dataset being read in has six variables, Centre, p, r, n, Rx and 
Benefit.

I would really appreciate help with this.  I am an experienced, SAS, 
SPSS, Stata user but never tried R before and I dont have the luxury of 
lots of time with which to master it currently.

Sarah

-- 
-
Sarah White
Biostatistician

Research Resource Unit
Division of Mental Health
St George's, University of London
Cranmer Terrace
Tooting
LONDON SW17 0RE

Direct Line; 020 8725 3615
Fax; 020 8725 3538
Email; [EMAIL PROTECTED]



-- 

believed to be clean.

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


Re: [R] Translation of R code required

2006-11-03 Thread Sarah Goslee
 I am a complete novice when it comes to R.  I have been sent some code
 which I need to run on a dataset.  I have downloaded  and installed R
 but I dont seem to be able to get the code to run.

It would be very helpful if you would tell us your OS, version of R, and
if you would copy and paste the errors into your email so we can see
what went wrong.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@stat.math.ethz.ch 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] Translation of R code required

2006-11-03 Thread Sarah White

I am using Windows XP, R version 2.4.

The code works until I get to the fourth line starting

model.effect

and I receive the following Error message.

Error in eval(expr, envir, enclos) : object Centre not found

When I say it works until the fourth line I mean I dont get an error 
message until then. It doesn't necessarily mean it has done what it 
should have done before then.

Thanks for the help.

Sarah


Sarah Goslee wrote:

 I am a complete novice when it comes to R.  I have been sent some code
 which I need to run on a dataset.  I have downloaded  and installed R
 but I dont seem to be able to get the code to run.


 It would be very helpful if you would tell us your OS, version of R, and
 if you would copy and paste the errors into your email so we can see
 what went wrong.

 Sarah


-- 
-
Sarah White
Biostatistician

Research Resource Unit
Division of Mental Health
St George's, University of London
Cranmer Terrace
Tooting
LONDON SW17 0RE

Direct Line; 020 8725 3615
Fax; 020 8725 3538
Email; [EMAIL PROTECTED]



-- 

believed to be clean.

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


Re: [R] Translation of R code required

2006-11-03 Thread Sarah Goslee
On 11/3/06, Sarah White [EMAIL PROTECTED] wrote:

 I am using Windows XP, R version 2.4.

 The code works until I get to the fourth line starting

 model.effect

 and I receive the following Error message.

 Error in eval(expr, envir, enclos) : object Centre not found



It sounds like the variable names aren't what you think they are.
Try this:

mental - read.csv(dataextract.csv)
colnames(mental)

If the names don't match exactly, R won't know what you mean.

Since this step works,

mental$Rx - factor(mental$Rx, levels=c(VS,IPS))

I think that some of the names are right, but perhaps that
one is spelled differently (Centre vs centre, maybe, since
R is case-sensitive?).

The easiest thing to do with no R knowledge is probably
to change the name in the csv file to match your code,
if that turns out to be the problem.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@stat.math.ethz.ch 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] Import problem with S-Plus 7.0 dataset

2006-11-03 Thread Brian Ripley
From ?read.S

 'read.S' can read the binary files produced in most recent
  versions of S-PLUS on either Windows (versions 3.x, 4.x, 2000) or
  Unix (version 3.x with 4 byte integers).  It automatically detects
  whether the file was produced on a big- or little-endian machine
  and adapts itself accordingly.
   'data.restore' can read a similar range of files produced by
  'data.dump', for newer versions of S-PLUS, those from
  'data.dump(., oldStyle=TRUE)'.

Note: not S-PLUS 7.0.  You need to dump with 'data.dump(., 
oldStyle=TRUE)' to have a chance of reading it.

On Fri, 3 Nov 2006, Inman, Brant A.   M.D. wrote:


 I am running R 2.3.1 on a Windows XP machine.  I am trying to import
 some data into R that is stored as an S-Plus 7.0 .sdd file.

 When I run the following command, I get this error:

 library(foreign)
 d - read.S(file='H:\\Research\\data.sdd')

 Error in read.S(file = H:\\Research\\data.sdd) :
not an S object


 The dataset is fairly large, roughly 13000 rows and 100 columns, but
 within S-Plus 7.0 it is stored as a normal dataframe (not a bd
 dataframe).

 Any ideas?

 Brant Inman



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


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

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


Re: [R] Translation of R code required

2006-11-03 Thread Sarah White


Thank you for your help.  Yes, it was a case-sensitive problem.  I have 
run all the code now and have the requred output.

Sarah

Sarah Goslee wrote:

 On 11/3/06, Sarah White [EMAIL PROTECTED] wrote:


 I am using Windows XP, R version 2.4.

 The code works until I get to the fourth line starting

 model.effect

 and I receive the following Error message.

 Error in eval(expr, envir, enclos) : object Centre not found



 It sounds like the variable names aren't what you think they are.
 Try this:

 mental - read.csv(dataextract.csv)
 colnames(mental)

 If the names don't match exactly, R won't know what you mean.

 Since this step works,

 mental$Rx - factor(mental$Rx, levels=c(VS,IPS))

 I think that some of the names are right, but perhaps that
 one is spelled differently (Centre vs centre, maybe, since
 R is case-sensitive?).

 The easiest thing to do with no R knowledge is probably
 to change the name in the csv file to match your code,
 if that turns out to be the problem.

 Sarah


-- 
-
Sarah White
Biostatistician

Research Resource Unit
Division of Mental Health
St George's, University of London
Cranmer Terrace
Tooting
LONDON SW17 0RE

Direct Line; 020 8725 3615
Fax; 020 8725 3538
Email; [EMAIL PROTECTED]



-- 

believed to be clean.

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


Re: [R] Import problem with S-Plus 7.0 dataset

2006-11-03 Thread Richard M. Heiberger
read.S is used to read S3 files (S-Plus 4 and older,
not S-Plus 6 or newer) from the binary in the _Data directory.
For example

y - read.S(c:/HOME/rmh/503.f99/_Data/y)


data.restore is used to read S3 .sdd data.dump files.
The S3 part means that S-Plus 7 users must force the oldStyle
data.dump.

## S-Plus 7
data.dump(y, oldStyle=TRUE)

## R
data.restore(c:/HOME/hh-user/dumpdata)

__
R-help@stat.math.ethz.ch 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] Translation of R code required

2006-11-03 Thread Barry Rowlingson
Sarah Goslee wrote:

 Since this step works,
 
 mental$Rx - factor(mental$Rx, levels=c(VS,IPS))
 
 I think that some of the names are right, but perhaps that
 one is spelled differently (Centre vs centre, maybe, since
 R is case-sensitive?).

  How do you know that step works? If the dataframe 'mental' doesnt have 
an 'Rx' column then mental$Rx will be 'NULL', and the factor() function 
will make a factor out of that...

   x=data.frame(foo=1:10)

  so x is a data frame with one column, called 'foo'. Now lets make 
levels from a non-existent column, 'bar':

   x$bar=factor(x$bar,levels=c('x','y'))

  No complaints... But try printing 'x' now (by typing x at the command 
line)... Ick!

  Try things one line at a time and check the objects created or 
modified are sensible.

Barry

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


Re: [R] ssh and X11 forwarding

2006-11-03 Thread Vladimir Eremeev
 Everything is enabled, but still doesn't work.
 xeyes and xclock give errors (Error: Can't open display: localhost:10.0),
 R produces Rplots.ps
 
 I also have a windows box, and go to chena using PuTTY.
 I have cygwin with X server installed on it.
 If I enable X11 forwarding in PuTTY, start cygwin's X11 server on Windows and 
 try to run xeyes or xclock, I see their windows on my local MS Windows 
desktop,
 R still produces Rplots.ps.

Got it!
It was long time ago, R (2.3.0) was compiled without X support, because 
development headers and libraries were not installed on that computer.

__
R-help@stat.math.ethz.ch 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] Translation of R code required

2006-11-03 Thread Sarah Goslee
On 11/3/06, Barry Rowlingson [EMAIL PROTECTED] wrote:

   How do you know that step works? If the dataframe 'mental' doesnt have
 an 'Rx' column then mental$Rx will be 'NULL', and the factor() function
 will make a factor out of that...

Good point. I rarely use factors and missed that one.

Happily, my inaccurate solution turned out to solve the problem anyway.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@stat.math.ethz.ch 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] identify extremes positions of values into matrix

2006-11-03 Thread Francisco J. Zagmutt

Oi Milton,

Is this what you are after?

x=read.table(miltondat.txt)

x

 V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1  0  0  0  0  0  0  0  0  0   0
2  0  0  0  0  0  1  1  1  0   0
3  0  0  0  0  0  1  1  1  0   0
4  0  0  0  0  0  0  0  0  0   0
5  0  0  2  2  2  0  0  0  0   0
6  0  0  0  2  2  2  0  0  0   0
7  0  0  2  2  2  2  2  2  0   0
8  0  0  0  0  0  0  0  0  0   0

idx=which(x==2,arr.ind=T) #Index of observations with values == 2 .  Notice 
the use of arr.ind=t to get the rows and columns of the observations



idx

 row col
5   5   3
7   7   3
5   5   4
6   6   4
7   7   4
5   5   5
6   6   5
7   7   5
6   6   6
7   7   6
7   7   7
7   7   8


range(idx[,row]) #gives you the min and max of the rows with x==2

[1] 5 7

range(idx[,col])#gives you the min and max of the columns with x==2

[1] 3 8


You can refine this and wrap it in a function to make reports in a more 
suitable form


Regards

Francisco

Dr. Francisco J. Zagmutt
College of Veterinary Medicine and Biomedical Sciences
Colorado State University





From: Milton Cezar Ribeiro [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] identify extremes positions of values into matrix
Date: Fri, 3 Nov 2006 11:25:32 -0300 (ART)

Hi R-friends around world!
  I have a matrix that looks like bellow one.
Each cell are filled with values 0, 1 or 2.
In fact I have a lot of 512x512 matrices, with
values varying from 0 to 999.
  I need to retrieve the left and right columns
and the top and botton lines of the matrix
where occours for example the value 2.
Column and row labels are included at the example.

1234567890
1 00
2 011100
3 011100
4 00
5 002220
6 000222
7 002200
8 00

  At this example, the right answer are:
  collumns 3 and 8
  lines 5 and 7
  Any idea of how can I solve this?
  Kind regards,
  Miltinho


-

 Música para ver e ouvir: You're Beautiful, do James Blunt
[[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.


_
Try Search Survival Kits: Fix up your home and better handle your cash with 
Live Search!


__
R-help@stat.math.ethz.ch 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] How to convert an existing package?

2006-11-03 Thread rasti matus
Dears,

how could I convert an existing package to be able to modify it?

Let s say, if I want to change the way how the results of the package are
display (to see the oroginal code of the code).

Thanks

[[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] identify extremes positions of values into matrix

2006-11-03 Thread Milton Cezar Ribeiro
Francisco, 
  Thank you so much. It´s more than I need. 
  You help was of great value.
   
  Kind regards,
   
  Miltinho

Francisco J. Zagmutt [EMAIL PROTECTED] escreveu:
  Oi Milton,

Is this what you are after?

x=read.table(miltondat.txt)
x
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 1 1 1 0 0
3 0 0 0 0 0 1 1 1 0 0
4 0 0 0 0 0 0 0 0 0 0
5 0 0 2 2 2 0 0 0 0 0
6 0 0 0 2 2 2 0 0 0 0
7 0 0 2 2 2 2 2 2 0 0
8 0 0 0 0 0 0 0 0 0 0

idx=which(x==2,arr.ind=T) #Index of observations with values == 2 . Notice 
the use of arr.ind=t to get the rows and columns of the observations

idx
row col
5 5 3
7 7 3
5 5 4
6 6 4
7 7 4
5 5 5
6 6 5
7 7 5
6 6 6
7 7 6
7 7 7
7 7 8

range(idx[,row]) #gives you the min and max of the rows with x==2
[1] 5 7
range(idx[,col])#gives you the min and max of the columns with x==2
[1] 3 8


You can refine this and wrap it in a function to make reports in a more 
suitable form

Regards

Francisco

Dr. Francisco J. Zagmutt
College of Veterinary Medicine and Biomedical Sciences
Colorado State University




From: Milton Cezar Ribeiro 
To: r-help@stat.math.ethz.ch
Subject: [R] identify extremes positions of values into matrix
Date: Fri, 3 Nov 2006 11:25:32 -0300 (ART)

Hi R-friends around world!
 I have a matrix that looks like bellow one.
Each cell are filled with values 0, 1 or 2.
In fact I have a lot of 512x512 matrices, with
values varying from 0 to 999.
 I need to retrieve the left and right columns
and the top and botton lines of the matrix
where occours for example the value 2.
Column and row labels are included at the example.

 1234567890
1 00
2 011100
3 011100
4 00
5 002220
6 000222
7 002200
8 00

 At this example, the right answer are:
 collumns 3 and 8
 lines 5 and 7
 Any idea of how can I solve this?
 Kind regards,
 Miltinho


-

 Música para ver e ouvir: You're Beautiful, do James Blunt
 [[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.

_
Try Search Survival Kits: Fix up your home and better handle your cash with 
Live Search! 
http://imagine-windowslive.com/search/kits/default.aspx?kit=improvelocale=en-USsource=hmtagline




-

 Música para ver e ouvir: You're Beautiful, do James Blunt
[[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] microarray analysis

2006-11-03 Thread Friederike Barthel

__
R-help@stat.math.ethz.ch 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] identify extremes positions of values into matrix

2006-11-03 Thread Francisco Zagmutt
I am glad to help ;-)

Cheers,

Francisco



Milton Cezar Ribeiro wrote:
 Francisco, 
   Thank you so much. It´s more than I need. 
   You help was of great value.

   Kind regards,

   Miltinho
 
 Francisco J. Zagmutt [EMAIL PROTECTED] escreveu:
   Oi Milton,
 
 Is this what you are after?
 
 x=read.table(miltondat.txt)
 x
 V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
 1 0 0 0 0 0 0 0 0 0 0
 2 0 0 0 0 0 1 1 1 0 0
 3 0 0 0 0 0 1 1 1 0 0
 4 0 0 0 0 0 0 0 0 0 0
 5 0 0 2 2 2 0 0 0 0 0
 6 0 0 0 2 2 2 0 0 0 0
 7 0 0 2 2 2 2 2 2 0 0
 8 0 0 0 0 0 0 0 0 0 0
 
 idx=which(x==2,arr.ind=T) #Index of observations with values == 2 . Notice 
 the use of arr.ind=t to get the rows and columns of the observations
 
 idx
 row col
 5 5 3
 7 7 3
 5 5 4
 6 6 4
 7 7 4
 5 5 5
 6 6 5
 7 7 5
 6 6 6
 7 7 6
 7 7 7
 7 7 8
 
 range(idx[,row]) #gives you the min and max of the rows with x==2
 [1] 5 7
 range(idx[,col])#gives you the min and max of the columns with x==2
 [1] 3 8
 
 
 You can refine this and wrap it in a function to make reports in a more 
 suitable form
 
 Regards
 
 Francisco
 
 Dr. Francisco J. Zagmutt
 College of Veterinary Medicine and Biomedical Sciences
 Colorado State University
 
 
 
 
 From: Milton Cezar Ribeiro 
 To: r-help@stat.math.ethz.ch
 Subject: [R] identify extremes positions of values into matrix
 Date: Fri, 3 Nov 2006 11:25:32 -0300 (ART)

 Hi R-friends around world!
 I have a matrix that looks like bellow one.
 Each cell are filled with values 0, 1 or 2.
 In fact I have a lot of 512x512 matrices, with
 values varying from 0 to 999.
 I need to retrieve the left and right columns
 and the top and botton lines of the matrix
 where occours for example the value 2.
 Column and row labels are included at the example.

 1234567890
 1 00
 2 011100
 3 011100
 4 00
 5 002220
 6 000222
 7 002200
 8 00

 At this example, the right answer are:
 collumns 3 and 8
 lines 5 and 7
 Any idea of how can I solve this?
 Kind regards,
 Miltinho


 -

 Música para ver e ouvir: You're Beautiful, do James Blunt
 [[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.
 
 _
 Try Search Survival Kits: Fix up your home and better handle your cash with 
 Live Search! 
 http://imagine-windowslive.com/search/kits/default.aspx?kit=improvelocale=en-USsource=hmtagline
 
 
 
   
 -
 
  Música para ver e ouvir: You're Beautiful, do James Blunt
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] Microarray analysis

2006-11-03 Thread Friederike Barthel
Dear List

I am currently running a microarray analysis on the dataset schizo and would 
like to filter out all genes with a low variance. However, when running the 
code detailed below, I end up with 12,500 genes in my final set rather than 
the 10,000 I was looking for. Can anyone pinpoint where I am going wrong?

***reading in data**

schizo-read.table(octassign_data.txt,header=T, sep=\t)

dim(schizo)

head(schizo)

attach(schizo)

***creating matrix and calculating variance across probesets

x-c(1:2)

y-c(2:151)

schizo.matrix-data.matrix(schizo[,y])

varprobe-c(var(schizo.matrix[x,]))

hist(varprobe)

**filter out low variance*

top1 - which(rank(varprobe)1)

schizo.sub-schizo[top1,]
dim(schizo.sub)
[1] 12500   151

__
R-help@stat.math.ethz.ch 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] Import problem with S-Plus 7.0 dataset

2006-11-03 Thread Inman, Brant A. M.D.

As recommended, I have tried the following code to solve my problem
importing data to R from S-Plus 7.0. Unfortunately, I have not had
success.

In S-Plus:

 data.dump('data', file='C:\\temp\\ddump.sdd', oldStyle=T)

This resulted in the production of a file called ddump.sdd that I can
import into S-Plus without any problem.  However, when I use the
following code in R ...

In R:

 d - data.restore(file='C:\\temp\\ddump.sdd')
 d
[1] C:\\temp\\ddump.sdd

 d - data.restore('C:\\temp\\ddump.sdd')
 d
[1] C:\\temp\\ddump.sdd
 

I also tried the following:

 d - read.S(file='C:\\temp\\ddump.sdd')
Error in read.S(file = C:\\temp\\ddump.sdd) : 
not an S object

I thought that S-Plus might be doing something funny when I save as a
.sdd file, so I tried saving as ddump.dat but got exactly the same
results.

I have been able to save my original datafile as a csv and import it,
but I had hoped that it would be possible to keep my variable formats by
importing the S dataframe into R directly.

Brant Inman

[[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] Microarray analysis

2006-11-03 Thread Phil Spector
Friederike -
The program is doing exactly what you asked it to do, but please
notice that

varprobe-c(var(schizo.matrix[x,]))

creates a vector containing all the elements of the variance-covariance 
matrix of schizo.matrix[x,], which is a 2x150 matrix, giving a 
variance-covariance matrix of 150x150 or 22500 elements.  You then rank all
of the elements of this variance-covariance matrix, and ask for the
ones that are ranked higher than 1, leaving 22500-1=12500
elements.  So now we should probably look at what you wanted to do:

x - 1:2
y - 2:151
schizo.matrix-data.matrix(schizo[,y])
varprobe-apply(schizo.matrix[x,],1,var)  # calculate the variance of each row
# reorder the rows of schizo.matrix to correspond to varprobe and 
# select the top 1
schizo.sub = schizo.matrix[order(varprobe,decreasing=TRUE),][1:1,]

There are other ways of extracting the top 1, but I think that this
shows how to calculate what you really want.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 [EMAIL PROTECTED]



On Fri, 3 Nov 2006, Friederike Barthel wrote:

 Dear List

 I am currently running a microarray analysis on the dataset schizo and would
 like to filter out all genes with a low variance. However, when running the
 code detailed below, I end up with 12,500 genes in my final set rather than
 the 10,000 I was looking for. Can anyone pinpoint where I am going wrong?

 ***reading in data**

 schizo-read.table(octassign_data.txt,header=T, sep=\t)

 dim(schizo)

 head(schizo)

 attach(schizo)

 ***creating matrix and calculating variance across probesets

 x-c(1:2)

 y-c(2:151)

 schizo.matrix-data.matrix(schizo[,y])

 varprobe-c(var(schizo.matrix[x,]))

 hist(varprobe)

 **filter out low variance*

 top1 - which(rank(varprobe)1)

 schizo.sub-schizo[top1,]
 dim(schizo.sub)
 [1] 12500   151

 __
 R-help@stat.math.ethz.ch 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] Import problem with S-Plus 7.0 dataset

2006-11-03 Thread Richard M. Heiberger
It looks like it works.  The result you printed is
the name of the file that data.store read.  The name of the
variable is the same as the name you called it in S-Plus.

type
   data[1:5,]
and you should see your data.frame.

__
R-help@stat.math.ethz.ch 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 went away from top emacs window :-(

2006-11-03 Thread Spencer Graves
I concur:  Thanks very much for looking into this.  Spencer Graves

Duncan Murdoch wrote:
 Thanks for looking into this.

 On 11/3/2006 9:53 AM, Richard M. Heiberger wrote:
 I located what might be the problem.  There is a different misbehavior
 with Gnu emacs.  I don't have Xemacs.  I have an idea how to fix it but
 haven't worked out the details.


 ess-inf.el in the lines
 (defconst inferior-R-1-input-help (format ^ *help *(%s) 
 ess-help-arg-regexp))
 (defconst inferior-R-2-input-help (format ^ *\\? *%s 
 ess-help-arg-regexp))
 (defconst inferior-R-page  (format ^ *page *(%s) 
 ess-help-arg-regexp))

 detects help requests from the commandline in the *R* buffer and 
 redirects
 their output to an emacs *help[R] (whatever)* buffer.

 In gnu emacs on windows, with options(chmhelp=TRUE), the effect is an 
 empty
 *help[R] (whatever)* buffer.  What I think happened is that ESS 
 trapped the
 request and created the buffer, then R never got the right content to 
 send
 to that buffer because R thinks that chm is handling it.

 The fix probably requires ESS to check the value of the chmhelp option
 and suppress the interception of help requests if the option has the 
 value
 TRUE.  ESS also needs to monitor if that option has been changed.  
 This might
 mean that ESS always intercepts help requests and checks the value of 
 the option
 each time.

 You should also look at options(htmlhelp) - a user might have chosen 
 that style.

 Duncan

__
R-help@stat.math.ethz.ch 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 went away from top emacs window :-(

2006-11-03 Thread Duncan Murdoch
Thanks for looking into this.

On 11/3/2006 9:53 AM, Richard M. Heiberger wrote:
 I located what might be the problem.  There is a different misbehavior
 with Gnu emacs.  I don't have Xemacs.  I have an idea how to fix it but
 haven't worked out the details.
 
 
 ess-inf.el in the lines
 (defconst inferior-R-1-input-help (format ^ *help *(%s) 
 ess-help-arg-regexp))
 (defconst inferior-R-2-input-help (format ^ *\\? *%s ess-help-arg-regexp))
 (defconst inferior-R-page   (format ^ *page *(%s) ess-help-arg-regexp))
 
 detects help requests from the commandline in the *R* buffer and redirects
 their output to an emacs *help[R] (whatever)* buffer.
 
 In gnu emacs on windows, with options(chmhelp=TRUE), the effect is an empty
 *help[R] (whatever)* buffer.  What I think happened is that ESS trapped the
 request and created the buffer, then R never got the right content to send
 to that buffer because R thinks that chm is handling it.
 
 The fix probably requires ESS to check the value of the chmhelp option
 and suppress the interception of help requests if the option has the value
 TRUE.  ESS also needs to monitor if that option has been changed.  This might
 mean that ESS always intercepts help requests and checks the value of the 
 option
 each time.

You should also look at options(htmlhelp) - a user might have chosen 
that style.

Duncan

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

2006-11-03 Thread Martin Maechler
From: Martin Maechler [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: [EMAIL PROTECTED]
Date: Fri, 3 Nov 2006 22:26:20 +0100
To: Barry Rowlingson [EMAIL PROTECTED]
Cc: Sarah Goslee [EMAIL PROTECTED],
r-help@stat.math.ethz.ch,
Sarah White [EMAIL PROTECTED]
Subject: Re: [R] Translation of R code required
In-Reply-To: [EMAIL PROTECTED]
References: [EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
X-Mailer: VM 7.19 under Emacs 21.4.1
Reply-To: Martin Maechler [EMAIL PROTECTED]

 BaRow == Barry Rowlingson [EMAIL PROTECTED]
 on Fri, 03 Nov 2006 18:38:38 + writes:

BaRow Sarah Goslee wrote:
 Since this step works,
 
 mental$Rx - factor(mental$Rx, levels=c(VS,IPS))
 
 I think that some of the names are right, but perhaps
 that one is spelled differently (Centre vs centre, maybe,
 since R is case-sensitive?).

BaRow   How do you know that step works? If the dataframe
BaRow 'mental' doesnt have an 'Rx' column then mental$Rx
BaRow will be 'NULL', and the factor() function will make a
BaRow factor out of that...

 x=data.frame(foo=1:10)

BaRow   so x is a data frame with one column, called
BaRow 'foo'. Now lets make levels from a non-existent
BaRow column, 'bar':

 x$bar=factor(x$bar,levels=c('x','y'))

BaRow   No complaints... But try printing 'x' now (by
BaRow typing x at the command line)... Ick!

Hmm, what version of R would that be?

In any recent versions,
I get

   x - data.frame(foo = 1:10)
   x$bar - factor(x$bar,levels=c('x','y'))
  Error in as.vector(x, mode) : invalid argument 'mode'

But I want to make another point:

For about a year now, for serious data-analysis using data frames,
I've been advocating to use the slightly more clumsy but much
more error-prone ``column indexing by name'' instead of the quick-and-dirty
$ selection :

   x$bar
  NULL

   x[,bar]
  Error in [.data.frame(x, , bar) : undefined columns selected


BaRow   Try things one line at a time and check the objects
BaRow created or modified are sensible.

Indeed!

__
R-help@stat.math.ethz.ch 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] Import problem with S-Plus 7.0 dataset

2006-11-03 Thread Inman, Brant A. M.D.

Thanks to Brian Ripley and Richard Heiberger for the solution to my
problem.  I will spell it out below in steps so that (hopefully) nobody
else will need to ask the same question in the future (if they search
the R help archive).

HOW TO GET S-PLUS 7.0 DATA into R
__

STEP 0  (in S-Plus 7.0): Generation of a fake dataframe:

 x - c(1:10)
 y - rep(c(0,1),5)
 mydata - data.frame(cbind(x,y))
 mydata
x y
1   1 0
2   2 1
3   3 0
4   4 1
5   5 0
6   6 1
7   7 0
8   8 1
9   9 0
10 10 1

STEP 1 (in S-Plus 7.0): Save the dataframe as earlier versions of S-Plus
did
(note: I called the output file ddump.sdd instead of mydata.sdd to
demonstrate a point later on)

data.dump('mydata', file='C:\\temp\\ddump.sdd', oldStyle=T)

STEP 2 (In R): Restore the saved dataframe

data.restore('C:\\temp\\ddump.sdd')
[1] C:\\temp\\ddump.sdd

STEP 3 (In R): View/use the first few cases of dataset)

 head(mydata)
  x y
1 1 0
2 2 1
3 3 0
4 4 1
5 5 0
6 6 1


There are 2 important points to note:
1) The dataframe keeps the name it had in S-Plus, not the name of the
file you saved it in. Using the example above, R never creates an object
called ddump:

 data.restore('C:\\temp\\ddump.sdd')
[1] C:\\temp\\ddump.sdd
 ddump
Error: object ddump not found

2) Saving the data.restore result into a new variable is not that useful
because it will NOT contain your dataframe, only the name of the file
that contained your dataframe:

test - data.restore('C:\\temp\\ddump.sdd')
test
[1] C:\\temp\\ddump.sdd


Brant Inman



-Original Message-
From: Richard M. Heiberger [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 03, 2006 3:07 PM
To: Inman, Brant A. M.D.; Brian Ripley
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Import problem with S-Plus 7.0 dataset

It looks like it works.  The result you printed is
the name of the file that data.store read.  The name of the
variable is the same as the name you called it in S-Plus.

type
   data[1:5,]
and you should see your data.frame.

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

2006-11-03 Thread Waverley
Hi,

when I assign a one row matrix to another variable, then somehow R
automatically convert that varaible into  a list.

For example:

 a = matrix (12, 3, 4)
 b = a[1,]
 b
[1] 12 12 12 12

Is there a way to enable R automatically make b as a one row matrix , rather
than explicitly assign like matrix (b, ncol=1).   I have come across a
couple of time, that when I try to check how many rows of the computed
result matrix - nrow(,,,), because there is only one row, the program failed
as R tried to interpret it as a list.

Can some one help?

-- 
Waverley @ Palo Alto

[[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] one row matrix

2006-11-03 Thread Marc Schwartz
On Fri, 2006-11-03 at 14:12 -0800, Waverley wrote:
 Hi,
 
 when I assign a one row matrix to another variable, then somehow R
 automatically convert that varaible into  a list.

A 'vector', not a 'list'

 For example:
 
  a = matrix (12, 3, 4)
  b = a[1,]
  b
 [1] 12 12 12 12
 
 Is there a way to enable R automatically make b as a one row matrix , rather
 than explicitly assign like matrix (b, ncol=1).   I have come across a
 couple of time, that when I try to check how many rows of the computed
 result matrix - nrow(,,,), because there is only one row, the program failed
 as R tried to interpret it as a list.
 
 Can some one help?

This is actually a FAQ:

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

HTH,

Marc Schwartz

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


Re: [R] one row matrix

2006-11-03 Thread Sarah Goslee
On 11/3/06, Waverley [EMAIL PROTECTED] wrote:
 Hi,

 For example:

  a = matrix (12, 3, 4)
  b = a[1,]
  b
 [1] 12 12 12 12


It doesn't have anything to do with one-row matrices, at least in your example,
since that isn't what you made. Instead, you created a matrix with 3 rows,
4 columns, and all values equal to 12.

 a - matrix(12, 3, 4)
 a
 [,1] [,2] [,3] [,4]
[1,]   12   12   12   12
[2,]   12   12   12   12
[3,]   12   12   12   12

 a[1,]
[1] 12 12 12 12

You probably intended
 a - matrix(c(12, 3, 4), nrow=1)

 a
 [,1] [,2] [,3]
[1,]   1234

But to solve what I think you were actually asking, even though it
wasn't reflected in your example... By default, R drops unused
dimensions when subsetting. You can override this behavior

 b - a[1, ,drop=FALSE]

 b
 [,1] [,2] [,3]
[1,]   1234

See:
?subset
help('[')
?matrix

Sarah
-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@stat.math.ethz.ch 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] question of one matrix column being treated as list rather than vector

2006-11-03 Thread Waverley
Hi,

I have one matrix derived from my function.  It is as following:


Browse[1] each.uaa.data
  [,1] [,2]
 [1,] 33   152.3530
 [2,] 33   264.7059
 [3,] 51   583.
 [4,] 33   323.
 [5,] 50   292.549
 [6,] 33   300
 [7,] 56   104.1176
 [8,] 52   246.6667
 [9,] 53   242.5490
[10,] 33   212.9412

when I tried to get each.uaa.data[,2], it gave me a list, when I expect a
vector so that I can find the max(each.uaa.data[,2]), this max() failed.
I have checked is.matrix (each.uaa.data) and it is TRUE.  I have a created a
= matrix (12, 12, 2), a[,2] give me a vector of 12 of 12s which is what I
have expected.  Can someone help as how to prevent it becomes a list?  I am
new and thanks much for the help.

Browse[1] (each.uaa.data[,2])
[[1]]
[1] 152.3530

[[2]]
[1] 264.7059

[[3]]
[1] 583.

[[4]]
[1] 323.

[[5]]
[1] 292.549

[[6]]
[1] 300

[[7]]
[1] 104.1176

[[8]]
[1] 246.6667

[[9]]
[1] 242.5490

[[10]]
[1] 212.9412


-- 
Waverley @ Palo Alto

[[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] finding significant change points after fitting GAM using TPRS

2006-11-03 Thread Deahn DonnerWright

Does anybody know if code or functions exist for determining significant
change points after fitting GAM in 'mgcv' using thin plate regression
spline and 'ts' bases?  I would like to identify years where the curvature
or change in trajectory of a longterm annual population curve is
significant.  Thank you.

Deahn DonnerWright
email: [EMAIL PROTECTED]

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


[R] as.zoo behavior (

2006-11-03 Thread Mark . Leeds

hi all : the code pasted below runs but then, a dput on
rollmeandifflogbidask gives me what is below the code. the structure of
rollmeandifflogbidask is a zoo object but with a frequency
so it's not the same structure as the original actual diff and this
really causes things to blow up in later code. i'm sure gabor and achim
know what to do but in the case that they
are not around, would someone else know ? the code for ewma is below the
structure of rollmeandifflogbidask in the case that someone wants
to run it themselves. thanks a lot.

#---
---

actualdiff-structure(c(-1.45571955822987e-06, -7.27862957994319e-06,
-0.000109185801586698,
-0.000134158878632995, -9.98463614099165e-06, 0.000128544569886202,
5.33190241842618e-05, 1.5881826502806e-06, -2.23230209073222e-05,
-6.66190921299048e-05, -5.95638733376092e-05, -3.5740027046316e-05,
-0.000211818969710897, 0.000241006754088779, 5.89686385294996e-05,
-9.88290397652136e-05, 2.45716680487007e-05, -2.18414528943001e-05,
2.18414528943001e-05, 0, -2.18414528943001e-05, 1.45610216018000e-05,
-8.55490383084856e-05, -1.63825656738226e-05, 0.000101931603982308,
-1.45610216018000e-05, 2.18414528943001e-05, 0, -2.18414528943001e-05,
-6.5527221122963e-05), index = structure(c(1151884920, 1151884980,
1151885040, 1151885100, 1151885160, 1151885220, 1151885280, 1151885340,
1151885400, 1151885460, 1151885520, 1151885580, 1151885640, 1151885700,
1151885760, 1151885820, 1151885880, 1151885940, 1151886060, 1151886120,
1151886180, 1151886240, 1151886300, 1151886360, 1151886420, 1151886480,
1151886540, 1151886600, 1151886660, 1151886720), class = c(POSIXt,
POSIXct)), class = zoo)

temp-ewma(actualdiff,.05),
rollmeandifflogbidask-as.zoo(temp,index(actualdiff))

resulting structure of rollmeandifflogbidask

#---

-

structure(c(-7.27859779114937e-08, -4.33078158013078e-07,
-5.8707143294473e-06,
-1.22851225446247e-05, -1.21700982244430e-05, -5.13436481891078e-06,
-2.21169536875215e-06, -2.02170146780051e-06, -3.0367674397766e-06,
-6.21588367428301e-06, -8.88328315744932e-06, -1.02261203518926e-05,
-2.03057628198429e-05, -7.24013697441177e-06, -3.9296981992162e-06,
-8.67466527751607e-06, -7.01234861120523e-06, -7.75380382535997e-06,
NA, 0, 0, -1.09207264471500e-06, -3.09417932389255e-07,
-4.57139895119407e-06,
-5.1619572873255e-06, 1.92720776156187e-07, -5.4496634274162e-07,
5.74354619110464e-07, 5.45636888154941e-07, -5.73717600967809e-07,
-3.82139277706757e-06), index = c(1151884920, 1151884980, 1151885040,
1151885100, 1151885160, 1151885220, 1151885280, 1151885340, 1151885400,
1151885460, 1151885520, 1151885580, 1151885640, 1151885700, 1151885760,
1151885820, 1151885880, 1151885940, 1151886000, 1151886060, 1151886120,
1151886180, 1151886240, 1151886300, 1151886360, 1151886420, 1151886480,
1151886540, 1151886600, 1151886660, 1151886720), frequency =
0.0167, class = c(zooreg,
zoo))

it seems to be a zoo object but with a frequency that i think comes from
the fact that the ewma function produces a series of class ts.
I need the structure to be the EXACT same structure as the original
actual diff so i must be doing something wrong.

EWMA function

#---



ewma-function(x,lambda = 1, init = 0) {

filter(lambda*x,filter=(1-lambda),method=recursive,init=init)

}

__
R-help@stat.math.ethz.ch 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] How to obtain the estimate of baseline survival function?

2006-11-03 Thread Zheng Yuan
Hi,

If I fit a Cox model using coxph, is there a R function so that I 
could obtain the estimate of baseline survival function? Thank you.

Zheng
-- 
Zheng Yuan
Ph.D student
Department of Biostatistics
University of Michigan
Ann Arbor, MI 48109

__
R-help@stat.math.ethz.ch 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] question of one matrix column being treated as list rather than vector

2006-11-03 Thread Tamas K Papp
On Fri, Nov 03, 2006 at 02:47:37PM -0800, Waverley wrote:

Hi,

You probably created that matrix from a list.  Eg

 a - matrix(list(1,2,3,4),2,2)
 a
 [,1] [,2]
[1,] 13   
[2,] 24   
 a[,2]
[[1]]
[1] 3

[[2]]
[1] 4

 b - matrix(1:4,2,2)
 b[,2]
[1] 3 4

Both a and b are matrices, but note:

 is.recursive(a)
[1] TRUE
 is.recursive(b)
[1] FALSE

Possible solutions: generate the matrix like b above, or use as.vector
before calling max.  Read ?[ and ?[[.

HTH,

Tamas


 Browse[1] each.uaa.data
   [,1] [,2]
  [1,] 33   152.3530
  [2,] 33   264.7059
  [3,] 51   583.
  [4,] 33   323.
  [5,] 50   292.549
  [6,] 33   300
  [7,] 56   104.1176
  [8,] 52   246.6667
  [9,] 53   242.5490
 [10,] 33   212.9412
 
 when I tried to get each.uaa.data[,2], it gave me a list, when I expect a
 vector so that I can find the max(each.uaa.data[,2]), this max() failed.
 I have checked is.matrix (each.uaa.data) and it is TRUE.  I have a created a
 = matrix (12, 12, 2), a[,2] give me a vector of 12 of 12s which is what I
 have expected.  Can someone help as how to prevent it becomes a list?  I am
 new and thanks much for the help.
 
 Browse[1] (each.uaa.data[,2])
 [[1]]
 [1] 152.3530
 
 [[2]]
 [1] 264.7059
 
 [[3]]
 [1] 583.
 
 [[4]]
 [1] 323.
 
 [[5]]
 [1] 292.549
 
 [[6]]
 [1] 300
 
 [[7]]
 [1] 104.1176
 
 [[8]]
 [1] 246.6667
 
 [[9]]
 [1] 242.5490
 
 [[10]]
 [1] 212.9412
 
 
 -- 
 Waverley @ Palo Alto
 
   [[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] How to convert an existing package?

2006-11-03 Thread Tamas K Papp
On Fri, Nov 03, 2006 at 07:59:37PM +0100, rasti matus wrote:
 Dears,
 
 how could I convert an existing package to be able to modify it?
 
 Let s say, if I want to change the way how the results of the package are
 display (to see the oroginal code of the code).

Hi,

Could you be more specific about what you are trying to achieve?  To
see the source, just type the name of the function, or if that doesn't
work,

getAnywhere(functionname)

Then you can modify that (copy into your editor, or
edit(functionname)).  You can also look at the package sources.

Tamas

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

2006-11-03 Thread Jeff Miller
Does anyone know how to obtain a plot of residuals by predicted values for a
main-effects aov?

 

I want to check that the residuals are distributed equally across treatment
means.

 

Thanks,

Jeff

 

 

 


[[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] Chronbach's Alpha

2006-11-03 Thread Ralf Finne
Dear all experts,

Can anyone help me to find information on
how to calculate the Chronbach's Alpha Coefficient
(sometimes called Crombach or even just  Alpha coefficient)


Thanks in advance

Ralf Finne
SYH
University of Applied Science
Wolffskavägen 33
P.O.Box 6 FIN-65201 VASA, Finland

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

2006-11-03 Thread Ted Harding
On 03-Nov-06 Martin Maechler wrote:
 [...]
 But I want to make another point:
 
 For about a year now, for serious data-analysis using
 data frames, I've been advocating to use the slightly more
 clumsy but much more error-prone ``column indexing by name''
 instead of the quick-and-dirty $ selection :
 
x$bar
   NULL
 
x[,bar]
   Error in [.data.frame(x, , bar) : undefined columns selected

Your point is well made, Martin, but I'd like to present a
different view of the same issue.

Suppose you are working on a somewhat flexibly structured
computation in which columns get adjoined to a dataframe
(by name) according (e.g.) as they become available at
some (unforeseeable) point in the pathway through the
computation. This could also arise in real time if bar
is the output from some measuring device, not yet available,
yet the computation can get on with other things until it
is available.

Then a test based on

  is.null(x$bar)

could divert the computation round some path suitable for
a case where x$bar has not yet been defined and adjoined,
as opposed to a case where x$bar has already been adjoined.

The use of x[,bar], however, would generate an error and
cause the computation to slide through a hole in the floor.

Horses for courses, I suppose!

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 04-Nov-06   Time: 00:29:03
-- XFMail --

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


Re: [R] Chronbach's Alpha

2006-11-03 Thread Jonathan Baron
On 11/04/06 02:25, Ralf Finne wrote:
 Dear all experts,
 
 Can anyone help me to find information on
 how to calculate the Chronbach's Alpha Coefficient
 (sometimes called Crombach or even just  Alpha coefficient)

And even more often called Cronbach.

It is in the psy package.  And there is some discussion of it in
http://www.psych.upenn.edu/~baron/rpsych/rpsych.html

Jon

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


[R] Ridge for logistic regression

2006-11-03 Thread Zheng Yuan
Dear all experts,

Does anyone know if there is a R function which can perform Ridge 
regression for logistic models?

Thank in advance.
Ying Yuan

__
R-help@stat.math.ethz.ch 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] as.zoo behavior (

2006-11-03 Thread Achim Zeileis
Mark:

 temp-ewma(actualdiff,.05),

ok, because ewma() is a wrapper for filter() this returns an object of
class ts. Therefore you want to add the index again, but:

 rollmeandifflogbidask-as.zoo(temp,index(actualdiff))

is not the right thing to do. as.zoo() is a coercion generic and its ts
method ignores all arguments except the first. Thus, index(actualdiff) is
*not* added and a zooreg object created (which is appropriate because
you supply an object of class ts, a regular series. See
  zoo:::as.zoo.ts
for the actual code).

You want to create a zoo series from scratch using the data from temp
and the index from actualdiff. Hence, the appropriate command is
  zoo(coredata(temp), index(actualdiff))

But let's go back to the ewma() function. The NA in temp looks suspicious
(and stems from another implicit coercion from zoo to ts). I guess you
want:

  ewma - function(x, lambda = 1, init = 0) {
rval - filter(lambda * coredata(x),
   filter = (1-lambda),
   method = recursive,
   init = init)
rval - zoo(coredata(rval), index(x))
rval
  }

And then you can do
  ewma(actualdiff, 0.05)
and already get a nicely formatted zoo object back.

Z

__
R-help@stat.math.ethz.ch 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] multiple plots in the same graph

2006-11-03 Thread Li Zhang
I'd like to plot y vs x according to the third
variable group which has three levels. I am
wondering how can I put the three plots in one graph?

Thank you 


 


(http://groups.yahoo.com)

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


Re: [R] nlme Error: Subscript out of bounds

2006-11-03 Thread Spencer Graves
  I can't begin to guess.  If your example were self contained (and 
preferably simple), it would be easier to diagnose. 

  When I have problems like this, I often try to find a simple 
example that produced the same error message.  That process often leads 
me to a solution.  If it doesn't it often produces a sufficiently simple 
example that I can describe it easily in a few lines of a question to 
r-help.  I might also use the 'debug' function (in the 'base' package.  
I have not used the 'debug' package, which may be more powerful but 
possibly harder to use.).  To access a chain of earlier recommendations 
on debug, I tried 'RSiteSearch(graves debug), then 
'RSiteSearch(graves debug lme)'.  The fifth hit from the latter is 
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77298.html;. 

  Hope this helps. 
  Spencer Graves

Lisa Avery wrote:
 Hello, I am new to non-linear growth modelling in R and I am trying to
 reproduce an analysis that was done (successfully) in S-Plus.  

  

 I have a simple non-linear growth model, with no nesting. I have attempted
 to simplify the call as much as possible (by creating another grouped
 object, instead of using subset= and compacting the fixed and random
 expressions.)

  

 This is a what the grouped data object looks like:

  

 levelI.data[1:2,]

 Grouped Data: GMAE ~ AGE | STUDYID

STUDYID TIMESCORE   INCURVES  MOST FIRST  AGE

 1910051 ACTUAL (unaided) in JAMA curves Level I   Level I   49.11301

 2010052 ACTUAL (unaided) in JAMA curves Level I   Level I   56.53745

GMFM GMFCS  GMAE  YRS

 19 91.03394 1 74.16 4.092751

 20 95.35018 1 84.05 4.711454

  

 Here is the nlme model:

  

 cp.grad-deriv(~ (100/(1+exp(-L)))*(1-exp(-exp(logR)*x)), c(L, logR),
 function(x=0:100,L,logR) NULL)

 levelI.nlme-nlme(GMAE~cp.grad(AGE,limit,lograte), 

 data=levelI.data, 

 fixed = limit+lograte~1, 

 random = limit+lograte~1, 

 start = c(2.0, -3.0))

  

 I get a subscript out of bounds error  - which I am not finding very helpful
 because I don't know where things are going wrong.

  

 Bill Shipley posted a similar problem with nlme called with a self-starting
 function - but here I don't use a self-starting function and I give the
 starting values explicitly so I assume that this is not the same problem he
 is having.

  

 What am I doing wrong?  Any insights would be very much appreciated.

  

 Kind Regards, Lisa Avery


   [[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] multiple plots in the same graph

2006-11-03 Thread Christos Hatzis
See ?points and ?lines for adding new groups of points or lines to an
existing graph created by plot. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Li Zhang
Sent: Friday, November 03, 2006 9:55 PM
To: R-help@stat.math.ethz.ch
Subject: [R] multiple plots in the same graph

I'd like to plot y vs x according to the third variable group which has
three levels. I am wondering how can I put the three plots in one graph?

Thank you 


 



(http://groups.yahoo.com)

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

__
R-help@stat.math.ethz.ch 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] How to obtain the estimate of baseline survival function?

2006-11-03 Thread Christos Hatzis
See ?basehaz in 'survival' package.

-Christos 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zheng Yuan
Sent: Friday, November 03, 2006 6:20 PM
To: r-help@stat.math.ethz.ch
Subject: [R] How to obtain the estimate of baseline survival function?

Hi,

If I fit a Cox model using coxph, is there a R function so that I could
obtain the estimate of baseline survival function? Thank you.

Zheng
--
Zheng Yuan
Ph.D student
Department of Biostatistics
University of Michigan
Ann Arbor, MI 48109

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