Re: [R] Proba( Ut+2=1 / ((Ut+1==1) (Ut==1))) ? Thanks

2005-04-26 Thread vincent
Thank you all for all your answers.
I see than there are many ways to solve my question !
Thank you very much.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to override coerion error in 'scan'

2005-04-26 Thread Uwe Ligges
Kittler, Richard wrote:
Uwe,
Thanks. I did find something in the archives about using a custom
colClass of 'num' with read.csv and using setAs to define a character -
num function. From the read.table code this appears to force 'scan' to
read it as character and then convert it later using 'as'.  I'm not sure
if there is any advantage in this approach to just reading it using a
colClass of 'character' and then converting it myself afterward (?)

No, I think you are looking for something fuzzy that does not exist, 
AFAIK. Sorry, I was too short, here.

I mean read it in as character. Then use some function (e.g. using 
regular expressions) to detect what is numeric and what not (e.g. 
03/15/200523:56:03), replace the latter by NA and convert to numeric.

Uwe

--Rich
Richard Kittler 
AMD TDG
408-749-4099

-Original Message-
From: Uwe Ligges [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 23, 2005 6:50 AM
To: Kittler, Richard
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to override coerion error in 'scan'

Kittler, Richard wrote:

I am using 'read.csv' in V2.0.1 to read in a CSV file with the 
colClasses option and am getting an error from 'scan' when it 
encounters a non-numeric value for a 'numeric' column, i.e.

 ds - read.csv(in_file, nrows=irow, row.names=NULL, 
colClasses=zclass,
comment.char=)
 Error in scan(file = file, what = what, sep = sep, quote = quote, 
dec = dec, :
scan expected a real, got 03/15/200523:56:03

Is there a way to override this and just have it convert those values 
to NA? The dataset is large so I would prefer not to have to import 
the columns as character and convert them to numeric afterward.

I think you have to read it in as character - or write your own C-level 
facility...

Uwe Ligges

--Rich
Richard Kittler
AMD TDG
408-749-4099
__
R-help@stat.math.ethz.ch mailing list 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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


[R] Garbled plot label

2005-04-26 Thread John Maindonald
Marc Schwartz (MSchwartz at MedAnalytics.com) wrote
Here is another option. One issue is that given the way in which 
plot.lm
() is coded, some of the axis labels are hard coded when passed to the
four underlying plot functions and as far as I can tell, there is no 
way
to use a 'par' and just blank out the x axis labels only. Thus, both x
and y axis labels need to be blanked and then separately created using
title().

Thus, here is a plot.lm2() function. It's a bit kludgy, but it seems to
work, though other eyes should look at it for any errors.
What it effectively does is to do each of the four plots in plot.lm()
individually without labels (ann = FALSE) and then adds them, generally
based upon the way it is done in plot.lm(). The x axis labels are paste
()'d to the wrapped model expression to create a multi-line sub.title
for each plot.
The wrap.len argument is the 'width' argument for strwrap indicating 
the
target line wrapping length. Note that if you get to around 3 lines, 
you
will likely need to modify the margins in the plot for side 1 to 
provide
for more room.
I cannot see how to set this up so that it works in every situation.
The only clean and simple way that I can see to handle the problem
is to set a default that tests whether the formula is broken into 
multiple
text elements, and if it is then omit it.  Users can then use their own
imaginative skills, and such suggestions as have been made on
r-help, to construct whatever form of labeling best suits their case,
their imaginative skills and their coding skills.

The web page http://wwwmaths.anu.edu.au/~johnm/r/plot-lm/
has image files plot.lm.RData and plot6.lm.RData that are proposals
for a revised version of plot.lm(). The changes made so far do not
deal with the long formula issue, but if nothing better turns up my
proposal will be to proceed as I have just indicated.
John Maindonald email: [EMAIL PROTECTED]
phone : +61 2 (6125)3473fax  : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problems installing and updating packages for 2.1.0 on Windows 2000

2005-04-26 Thread Duncan Murdoch
Greg Blevins wrote:
Hello,
I am running R 2.1.0 on Windows 2000.
When I attempt to install or update packages, regardless of whether I use the 
menu or command line, I get the following error.

utils:::chooseCRANmirror()
utils:::menuInstallPkgs()
Warning message:
unable to connect to 'cran.cnr.Berkeley.edu' on port 80. 
Warning: unable to access index for repository http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.1
Warning message:
unable to connect to 'www.stats.ox.ac.uk' on port 80. 
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1
Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE, type = type) : 
no packages were specified

I have uninstalled and reinstalled R 2.1.0 to no avail.  I read through the recent treads on similar problems, but if an answer to my problem we given, I missed it.
It sounds as though you need to configure a proxy for Internet access. 
See the discussion in the R for Windows FAQ (which gives other 
possibilities too).

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


Re: [R] writing a data frame in excel format

2005-04-26 Thread Arne Henningsen
I save my data(frames) in csv format, which can be opened by any spreadsheet 
application:

R write.table( myData, myFile.csv, col.names = NA, sep = , )

Arne

On Tuesday 26 April 2005 04:28, Mario Morales wrote:
 Hello

 I know how read a file in excel format into a R data frame using the
 RODBC library, but I don't know how write a R data frame in excel
 format. I don't understand the instructions from RODBC user manual.

 To read an excel file I use.

 library(RODBC);

 conex-odbcConnectExcel(fis_quim.xls);

 sqlTables(conex);

 data-sqlFetch(conex,hoja1);

 Suppose I modify data and I want to save it as an excel file, How do
 I do that?

 Thanks for your help

 Mario Alfonso Morales Rivera
 Profesor Auxiliar.
 Departamento de Matemáticas y Estadistica.
 Universidad de Córdoba.

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

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
[EMAIL PROTECTED]
http://www.uni-kiel.de/agrarpol/ahenningsen/

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


Re: [R] Index matrix to pick elements from 3-dimensional matrix

2005-04-26 Thread Robin Hankin
Hello Juhana
try this (but there must be a better way!)

stratified.select - function(A,J){
  out - sapply(J,function(i){sample(A[,,i],1)})
  attributes(out) - attributes(J)
  return(out)
}
A - array(letters[1:12],c(2,2,3))
J - matrix(c(1,2,3,3),2,2)
R  stratified.select(A,J)
 [,1] [,2]
[1,] b  i
[2,] g  k
R   stratified.select(A,J)
 [,1] [,2]
[1,] d  j
[2,] f  l
R
best wishes
Robin

On Apr 26, 2005, at 05:16 am, juhana vartiainen wrote:
Hi all
Suppose I have a dim=c(2,2,3) matrix A, say:
A[,,1]=
a b
c d
A[,,2]=
e f
g h
A[,,3]=
i j
k l
Suppose that I want to create a 2x2 matrix X, which picks elements 
from the above-mentioned submatrices according to an index matrix J 
referring to the depth dimension:
J=
1 3
2 3

In other words, I want X to be
X=
a j
g l
since the matrix J says that the (1,1)-element should be picked from 
A[,,1], the (1,2)-element should be picked from A[,,3], etc.

I have A and I have J. Is there an expression in A and J that creates 
X?

Thanks
Juhana
[EMAIL PROTECTED]
--
Juhana Vartiainen
docent in economics
Director, FIEF (Trade Union Foundation for Economic Research, 
Stockholm), http://www.fief.se
gsm +46 70 360 9915
office +46 8 696 9915
email [EMAIL PROTECTED]
homepage http://www.fief.se/staff/Juhana/index.html

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


--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
 tel  023-8059-7743
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] writing a data frame in excel format

2005-04-26 Thread Petr Pikal
Hi Arne

On 26 Apr 2005 at 9:29, Arne Henningsen wrote:

 I save my data(frames) in csv format, which can be opened by any
 spreadsheet application:
 
 R write.table( myData, myFile.csv, col.names = NA, sep = , )

Or you can write it as

write.table(r.data.frame, excel.file.xls, sep=\t, na=, 
row.names=F)

which I can usually open in Excel just by clicking on it.

Cheers
Petr

 
 Arne
 
 On Tuesday 26 April 2005 04:28, Mario Morales wrote:
  Hello
 
  I know how read a file in excel format into a R data frame using the
  RODBC library, but I don't know how write a R data frame in excel
  format. I don't understand the instructions from RODBC user manual.
 
  To read an excel file I use.
 
  library(RODBC);
 
  conex-odbcConnectExcel(fis_quim.xls);
 
  sqlTables(conex);
 
  data-sqlFetch(conex,hoja1);
 
  Suppose I modify data and I want to save it as an excel file, How do
  I do that?
 
  Thanks for your help
 
  Mario Alfonso Morales Rivera
  Profesor Auxiliar.
  Departamento de Matemticas y Estadistica.
  Universidad de Crdoba.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 -- 
 Arne Henningsen
 Department of Agricultural Economics
 University of Kiel
 Olshausenstr. 40
 D-24098 Kiel (Germany)
 Tel: +49-431-880 4445
 Fax: +49-431-880 1397
 [EMAIL PROTECTED]
 http://www.uni-kiel.de/agrarpol/ahenningsen/
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


[R] R - C programm. calling load() from within C code

2005-04-26 Thread javier garcia - CEBAS
Hi!
This is the first time I'm trying to write a C program to be linked with R by 
my own and I've got one (main) problem

1) I've got a stack of big matrixes, so to manage them I' using save() in the 
 preparation process to save workspace (they are about 1000 matrixes and each 
one occupies 4.2 MB in my hard disk):

 for ( i in 1:1000) {
...
save(temp, file=paste(temp_matrix,i,R.sav,sep=))
}


Later on, I would need to be able to use something like 
load(paste(temp_matrix,i,R.sav,sep=))

to reload the corresponding matrix in each of the loops running within the C 
code, and to be able to load this matrix, (called temp) into the C code.

I've tried to load the vector into the R workspace using load(a[i]) where a 
is a vector with names of the maps, and also passing a list a in the call to 
the C code, where each element of the list a[[i]] is the name of each map, 
and tried to extract this names in the list to be used along with the 
expresion, but nothing works.

With the html R-extensions help I've been able to load existing R objects in 
run time into C, but I'm not able to use load() to put saved R object into 
the R workspace and load them in C afterwards. Please, have anyone tried to 
use this succesfully? Or you have any clue?


Thanks a lot for your help

Best regards,

Javier

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


Re: [R] panel ordering in nlme and augPred plots

2005-04-26 Thread Petr Pikal
Hi

So FYI attached is source file limity.txt which, with the code

limity.1 - dget(limity.txt)
limity.gr - groupedData(konverze~tepl|spol.f, limity.1, 
order.groups=F)
plot(limity.gr) # panel order is OK
fit.nlsList1 - nlsList(SSfpl,limity.gr)
fit.nlme1 - nlme(fit.nlsList1, random=xmid+scal~1)
plot(augPred(fit.nlme1, level=0:1)) # panel order is mismatched

gives me different ordering of these two plots. After

ooo - order(limity.gr$zdrzeni,  limity.gr$mvykon.c)
limity.gr - update(limity.gr[ooo,])

both plots are in the same (correct) order. The key is probably in 
order of limity.gr file, which is different after updating.

Cheers
Petr

On 25 Apr 2005 at 18:25, Deepayan Sarkar [EMAIL PROTECTED] wrote:

 Thank you.
 
 On 25 Apr 2005 at 10:29, Deepayan Sarkar wrote:
 
  On Monday 25 April 2005 09:40, Petr Pikal wrote:
   Dear all
  
   I am trying nlme together with Pinheiro/Bates book. I constructed
   grouped data object with suitable plotting layout (according to
   some common factor, panels from bottom to top are in increasing
   order).
  
   When I do nlme(... some stuff...) I get fitted object which I can
   plot with
  
   plot(augPred(fit.nlme6, level=0:1))
  
   but it results in completely different ordering. Is there any way
   how I can plot panels in some defined order e.g.
  
  Could you give us a reproducible example? Following the example on
  the help page
  
 
 Not yet, I try.
 
 I made my grouped.data with ooo ordering
 
 limity.gr-groupedData(konverze~tepl|spol.f, limity[ooo,], 
 order.groups=F)
 
 which led to correct ordering in
 
 plot(limity.gr)
 
 but it probably left limity.gr in the same order as limity
 
  head(limity[,1:2])
   pokus vzorek
 1 1  6
 2 1  7
 3 1  8
 4 1  9
 5 1 10
 6 2  8
  head(limity.gr[,1:2])
   pokus vzorek
 1 1  6
 2 1  7
 3 1  8
 4 1  9
 5 1 10
 6 2  8
  head(limity.gr[ooo,1:2])
pokus vzorek
 3310  3
 3410  4
 3510  5
 3610  7
 3710  8
 3810  9
  head(limity[ooo,1:2])
pokus vzorek
 26 7  5
 27 7  6
 28 7  7
 7815  9
 7915 10
 8015 11
 
 When I reordered the limity.gr file in desired order and I made the
 nlme analysis based on this newly ordered data, augPred plot was OK.
 
 snip
 
  
  Possibly. plot.augPred produces a Trellis plot, and usually
  arguments to the underlying plotting function can be passed on
  through the top-level call. e.g., with the Orthodont data
  
  plot(augPred(fm1, level = 0:1), skip = rep(c(F,T), c(16, 2)))
 
 That's it! Together with suitable layout I got what I wanted. 
 
 Great.
 Thanks a lot
 
 Best regards
 Petr
 
  
  or 
  
  p - plot(augPred(fm1, level = 0:1))
  update(p, skip = rep(c(F,T), c(16, 2)))
  
  You would of course have to know what valid arguments are; for that
  see ?xyplot and ?update.trellis (in the lattice package).
  
  Deepayan
 
 

Petr Pikal
[EMAIL PROTECTED]


structure(list(pokus = c(1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 
4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 9, 9, 10, 
10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 
12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 
14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 
15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 
16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 
17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 
18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21), vzorek = c(6, 7, 
8, 9, 10, 8, 9, 10, 7, 8, 7, 8, 9, 10, 7, 8, 9, 10, 5, 6, 7, 
10, 11, 3, 4, 5, 6, 7, 10, 11, 3, 4, 3, 4, 5, 7, 8, 9, 10, 2, 
3, 4, 7, 8, 9, 3, 4, 5, 9, 10, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 
7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 
11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 
12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16), cas = c(150, 180, 210, 240, 270, 210, 240, 270, 180, 210, 
180, 210, 240, 270, 180, 210, 240, 270, 120, 150, 180, 60, 90, 
60, 90, 120, 150, 180, 60, 90, 60, 90, 60, 90, 120, 30, 60, 90, 
120, 30, 60, 90, 30, 60, 90, 60, 90, 120, 90, 120, 60, 90, 120, 
150, 0, 20, 40, 60, 80, 0, 20, 40, 60, 80, 0, 20, 40, 60, 80, 
0, 10, 20, 30, 0, 20, 40, 60, 0, 10, 20, 30, 0, 10, 20, 30, 0, 
10, 20, 0, 10, 20, 30, 0, 10, 20, 30, 0, 10, 20, 30, 0, 10, 20, 
30, 0, 20, 40, 60, 0, 20, 40, 60, 80, 0, 20, 40, 60, 0, 10, 20, 
30, 0, 10, 20, 30, 0, 10, 20, 30, 0, 10, 20, 30, 0, 10, 20, 30, 
0, 20, 40, 0, 10, 20, 20, 0, 20, 40, 60, 0, 20, 40, 60, 0, 20, 
40, 60, 0, 20, 40, 60, 0, 20, 40, 60, 0, 10, 20, 30, 0, 

[R] Flip rows and columns of a table?

2005-04-26 Thread Dan Bolser

Any simple way to take a (2D) table and 'rotate' it so all the rows become
columns and the columns rows?

I'll wager there is a simple way ;) - but I can't find it :(

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


RE: [R] Flip rows and columns of a table?

2005-04-26 Thread BXC (Bendix Carstensen)

t( my.table )

--
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
[EMAIL PROTECTED]
www.biostat.ku.dk/~bxc
--



 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bolser
 Sent: Tuesday, April 26, 2005 11:18 AM
 To: R mailing list
 Subject: [R] Flip rows and columns of a table?
 
 
 
 Any simple way to take a (2D) table and 'rotate' it so all 
 the rows become columns and the columns rows?
 
 I'll wager there is a simple way ;) - but I can't find it :(
 
 __
 R-help@stat.math.ethz.ch mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read 
 the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Flip rows and columns of a table?

2005-04-26 Thread Romain Francois
Le 26.04.2005 11:18, Dan Bolser a écrit :
Any simple way to take a (2D) table and 'rotate' it so all the rows become
columns and the columns rows?
I'll wager there is a simple way ;) - but I can't find it :(
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

?t
--
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.html~~
 ~ 
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [R-pkgs] psy version 0.65 released

2005-04-26 Thread falissard
Dear R users,

 

psy version 0.65 is on CRAN now.

psy provides several methods used in psychometry (kappa, icc, cronbach,
screeplot (with simulations), non linear mapping, etc.)

A bug has been fixed in function wkappa (weighted kappa): in particular
circumstances, the 2*2 table presented levels in an order different to what
was suggested in the help file.

The fpca function (PCA plot with pvalues and compatible with
dependant/independant variables dichotomy) has been extended.

As usual, any kind of feedback is the most welcome…

 

Bruno

 



Bruno Falissard

Département de santé publique

Hôpital Paul Brousse

14 Avenue Paul Vaillant Couturier

94804 Villejuif cedex, France

tel : (+33) 6 81 82 70 76

fax : (+33) 1 45 59 34 18

web site :  http://perso.wanadoo.fr/bruno.falissard/
http://perso.wanadoo.fr/bruno.falissard/



 


[[alternative HTML version deleted]]

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

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


[R] simple question on graphics window

2005-04-26 Thread Dom Peters
Dear All,
This is a rather simple question.
How do I open more than 1 graphics window?
Dom
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] simple question on graphics window

2005-04-26 Thread Uwe Ligges
Dom Peters wrote:
Dear All,
This is a rather simple question.
How do I open more than 1 graphics window?
See ?x11
Uwe Ligges

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


Re: [R] simple question on graphics window

2005-04-26 Thread Romain Francois
Le 26.04.2005 11:36, Dom Peters a écrit :
Dear All,
This is a rather simple question.
How do I open more than 1 graphics window?
Dom
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html  
*REALLY DO IT **
?x11
?windows
--
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.html~~
 ~ 
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] missing values

2005-04-26 Thread Giordano Sanchez
Hello,
Thanks for the instructive responses. But two questions arise.
Firstable I can't manage to load the library mice.
I'm using R 2.0.1 on my Debian
  I try just copying the package in my library /usr/lib/R/library .
but when i do library()
   ...
   mice   ** No title available (pre-2.0.0 
install?) **
   ...
and when i do  library(mice)
  Error in library(mice) : 'mice' is not a valid 
package --installed  2.0.0?
  

The second question is more statistical:
aregImpute() seems to give good results but i would like to compare the 
different methods not just graphically. It'is possible?
I also have other meteorological stations that have correleted data with the 
data station I'm using? Can I use those data to improve my imputation 
method.

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


RE: [R] missing values

2005-04-26 Thread falissard
Hello,
On my experience, mice works fine with R 1.9 but not necessarily for newer
versions...
Bruno


Bruno Falissard
INSERM U669, PSIGIAM
Paris Sud Innovation Group in Adolescent Mental Health
Maison de Solenn
97 Boulevard de Port Royal
75679 Paris cedex 14, France
tel : (+33) 6 81 82 70 76
fax : (+33) 1 45 59 34 18
web site : http://perso.wanadoo.fr/bruno.falissard/

 
-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Giordano Sanchez
Envoyé : mardi 26 avril 2005 11:58
À : r-help@stat.math.ethz.ch
Objet : Re: [R] missing values

Hello,

Thanks for the instructive responses. But two questions arise.
Firstable I can't manage to load the library mice.
I'm using R 2.0.1 on my Debian
   I try just copying the package in my library /usr/lib/R/library .
but when i do library()
...
mice   ** No title available (pre-2.0.0 
install?) **
...
and when i do  library(mice)
   Error in library(mice) : 'mice' is not a valid 
package --installed  2.0.0?
   

The second question is more statistical:
aregImpute() seems to give good results but i would like to compare the 
different methods not just graphically. It'is possible?
I also have other meteorological stations that have correleted data with the

data station I'm using? Can I use those data to improve my imputation 
method.

Regards,

Giordano

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

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


Re: [R] missing values

2005-04-26 Thread Jonathan Baron
On 04/26/05 09:58, Giordano Sanchez wrote:
 Hello,
 
 Thanks for the instructive responses. But two questions arise.
 Firstable I can't manage to load the library mice.
 I'm using R 2.0.1 on my Debian

The package called norm also has functions for missing data.
When I tried it, the values it gave were not sensible for my
problem, but I may have done something wrong.  (This was a simple 
problem that did not involve multiple imputation.)
 
 The second question is more statistical:
 aregImpute() seems to give good results but i would like to compare the
 different methods not just graphically. It'is possible?

What different methods?  Compare how?  Are you assuming that we
remember your last post?

 I also have other meteorological stations that have correleted data with the
 data station I'm using? Can I use those data to improve my imputation
 method.

This sounds like exactly what aregImput() is good for, or
transcan(), depending on whether you need to make inferences (and 
hence do multiple imputation).

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

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


Re: [R] missing values

2005-04-26 Thread Frank E Harrell Jr
Jonathan Baron wrote:
On 04/26/05 09:58, Giordano Sanchez wrote:
 Hello,
 
 Thanks for the instructive responses. But two questions arise.
 Firstable I can't manage to load the library mice.
 I'm using R 2.0.1 on my Debian

The package called norm also has functions for missing data.
When I tried it, the values it gave were not sensible for my
problem, but I may have done something wrong.  (This was a simple 
problem that did not involve multiple imputation.)
 
 The second question is more statistical:
 aregImpute() seems to give good results but i would like to compare the
 different methods not just graphically. It'is possible?

What different methods?  Compare how?  Are you assuming that we
remember your last post?
 I also have other meteorological stations that have correleted data with the
 data station I'm using? Can I use those data to improve my imputation
 method.
This sounds like exactly what aregImput() is good for, or
transcan(), depending on whether you need to make inferences (and 
hence do multiple imputation).

Jon
For those interested I have preprints of a paper comparing MICE, 
aregImpute, and transcan on the basis of simulations.

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


Re: [R] Problem with R-2.1.0: install.packages() doesn't work

2005-04-26 Thread Prof Brian Ripley
On Fri, 22 Apr 2005, Uwe Ligges wrote:
Roger D. Peng wrote:
What happens if you don't set the 'CRAN' option via 'options()' first and 
just run 'install.packages()'?
Should be the same as long as no CRAN mirror has been choosen and X11 is not 
accessible (see my other message). The code needs to be a bit more defensive 
here - or present a better error message.
It was a bug, already (by last Friday) corrected in R-patched:
o   Typo in menu(graphics=TRUE) meant it failed on Unix if tcltk
was not available.
--
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


Where to find out about fixed bugs (Re: [R] Problem with R-2.1.0: install.packages() doesn't work)

2005-04-26 Thread Prof Brian Ripley
On Sat, 23 Apr 2005, Marc Schwartz wrote:
On Sat, 2005-04-23 at 16:14 +0200, Uwe Ligges wrote:
Thanks for your work on this topic, Marc, but the bug has already been
fixed by Brian 4 days ago (see below).
Uwe


r33976 | ripley | 2005-04-19 05:38:51 -0400 (Tue, 19 Apr 2005) | 1 line
Changed paths:
M /trunk/NEWS
M /trunk/src/library/utils/R/menu.R
missing braces

Thanks Uwe.
It was a nice workout for these aging neurons...  ;-)
Did I miss a bug report on this? I don't recall seeing a report come
through and a quick review of r-devel and the bug tracking system does
not turn up anything.
The vast majority of the bug fixes are not from formal bug reports but 
from things spotted by R-core members either when using R (as here) or 
from reading the code (normally to find something else).  (90% of those
documented for 2.1.0.)

In either case, glad to see that it is fixed.
I have also downloaded a copy of the 2.1.0 patched tarball and noted
that it is fixed there (Version 2.1.0 Patched (2005-04-20)), so for
anyone compiling from source get a copy of:
ftp://ftp.stat.math.ethz.ch/Software/R/R-patched.tar.gz
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] missing values

2005-04-26 Thread Ted Harding
On 26-Apr-05 Jonathan Baron wrote:
 On 04/26/05 09:58, Giordano Sanchez wrote:
  Hello,
  
  Thanks for the instructive responses. But two questions arise.
  Firstable I can't manage to load the library mice.
  I'm using R 2.0.1 on my Debian
 
 The package called norm also has functions for missing data.
 When I tried it, the values it gave were not sensible for my
 problem, but I may have done something wrong.  (This was a simple 
 problem that did not involve multiple imputation.)

Hi Jonathan,
Would you be kind enough to give sufficient detail to reproduce
such a case? I've used 'norm' (and 'cat' and 'mix') quite
extensively, without encountering non-sensible results (at any
rate in situations where the packages were not being abused,
which one can do in certain circumstances -- imputing missing
values can depend quite strongly on supplying realistic constraints,
and on not expecting too much when the proportion of missing data
is substantial: this methodology does not have magical powers!).

best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Apr-05   Time: 12:47:42
-- 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


Re: [R] shared library configuration; Gnome GUI

2005-04-26 Thread Prof Brian Ripley
This seems to have gone unanswered.
The difference in building R as a shared library is in the R-admin manual.
Quick summary: you slowed R down by ca 15%.
Both my FC3 systems build gnomeGUI.  In any case, the information about 
gnome version is also in the R-admin manual, and FC3 has

gnome-libs-1.4.1.2.90-44
gnome-libs-devel-1.4.1.2.90-44
More likely you do not have these at all than you have `2.0X'
On Fri, 22 Apr 2005, Paul Johnson wrote:
Hello, everybody:
On a Fedora Core 3 Linux system, I built R-2.1 using an updated version of 
the spec file that was used to make the RPMs for version 2.0.1 on the CRAN 
system.  The build was fine, and packages updates perfectly.  Thanks!

Then I got curious about the package gnomeGUI. While trying to build that, I 
see errors
=
* Installing *Frontend* package 'gnomeGUI' ...
Using R Installation in R_HOME=/usr/lib/R
R was not built as a shared library
Need a shared R library
ERROR: configuration failed for package 'gnomeGUI'
===

So then I look back at re-building R, and see
./configure --help
I see these two items that seem to contradict each other.  Why is the first 
defaulted to no and the second one yes?  What's the difference?

--enable-R-shlibbuild R as a shared library [no]
[...snip...]
 --enable-shared[=PKGS]
 build shared libraries [default=yes]
I built with --enable-R-shlib and all seemed fine.
Anyway, it turns out it was all for nothing, because the Gnome package wants 
the Gnome-1.4 libraries, whereas I have 2.0X. So, I'm going to forget about 
gnomeGUI, but I wonder: did I do any harm by building R with the non-default 
--enable-R-shared?  Can it potentially break something?

As far as I can see, new R runs great.
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] installing R-2.1.0 from source on Fedora Core 3 with tclt k

2005-04-26 Thread Prof Brian Ripley
On Sun, 24 Apr 2005, Liaw, Andy wrote:
On my FC3 for x86_64 (Athlon64 3000+) at home, R-patched from today compiled
just fine, and tcltk works.  The version of tcl, tcl-devel, tk and tk-devel
are all 8.4.7-2.
Indeed.  Since FC3 is the platform used by two (at least) of R-core and 
both have 64-bit machines, it would be surprising if there were a problem 
there.

From: Jonathan Baron
I installed from source on Fedora Core 3 starting with the
command
./configure --prefix=/usr --with-tcltk
(The --with-tcltk may not be necessary, but there seems to be
some correlation between using it and getting it to work.)
It would not compile with tcltk, even though I had both tcl and
tk rpms installed.
Various fooling around let me to get
http://www.murdoch-sutherland.com/Rtools/R_Tcl.zip
(even though it is supposedly for Windows), unzip it in the
R-2.0.0/ directory (where the tar file put itself), and also
install rpms for tcl-devel and tk-devel, which I did not have.
When I did both of these things, it worked.  Either one of them
alone (the ..devel rpms or the R_Tcl.zip) did not suffice.
You need the non-devel rpms as well, and that is what I think you are 
picking up from the R_Tcl.zip (which is Tcl pre-compiled for Windows).

(However, it isn't clear that a single trial experiment is
sufficient to determine what works.)
My own problem is solved for the moment.  But others may benefit
from this report, and it may be that the installation
documentation needs minor tweaking.  (Or it may be that I did
something else wrong, but right now I doubt that.)
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] installing R-2.1.0 from source on Fedora Core 3 with tclt k

2005-04-26 Thread Jonathan Baron
I was able to compile R-2.0.0 successfully on another fc3
computer, theoretically identical to the first three.  I'm sorry
for starting this thread.

It does seem that I had a problem that resulted from having only
tk and tcl, but not tk-devel and tcl-devel.  Perhaps after I
installed these I forgot to log out and log in again, so they
weren't found.

When I did it successfully, I installed the devel versions first, 
then logged in as root and did everything as root.  (Initially I
had done only the very last step - make install - as root.)
Probably this doesn't matter either.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

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


[R] Construction of a mean contengency table

2005-04-26 Thread Pascal Boisson
Hi List,

Say I have a data.frame DF with 6 columns, 3 factors and 3 variables,
with different number of repetitions for each combination of factors.
I would like to build, for two given factors, a matrix per variable,
containing in each cell the mean or sd for a given couple of factors. 

I have managed to get to the result I wanted step by step, but I would
like to have it in a function. I have not found what I was looking for
so I decided to try to write my own function, using aggregate( ) to
generate the mean values as a dataframe, and then display this as a
matrix. 
I'd like it to be general enough so that I could use it in many cases.

From what I have tried and understood, table( ) cannot do what I want
(no mean or sd ...) neither does xtabs( ), i.e. asking for a formula not
a function to passed as an argument ...

My final aim would be to plot this with persp( ), and it seems that
persp( ) must be fed with 2 dimensional arrays ...

Below is what I have tried to write, but it is not working.
It might be awkward, but I think it can work ... I think it is a problem
about correctly receiving and passing arguments in the different
function calls. 
Do you think there would be a smarter way of doing this ? Or can you see
what is going wrong with this ?

Any advice will be welcome

Pascal Boisson


matrixation-function(DF, var, factorlist, FUN, condition) 

## DF is the original dataframe with raw results from my experiments
## var is the var that I want to print
## eg. DF$var1
## factorlist is a list of the two factor I want to mean against (but
I'm noot sure List is the best form for this argument), 
## eg. list(DF$fact1, DF$fact2)
## FUN would be the function I want to use during aggregation, 
## eg. Mean( )
## condition would be a condition for building a subset
## eg. DF$fact3==1

{ 

sDF - subset(DF, condition)
A - aggregate(sDF, factorlist, FUN)

M - matrix(data=NA, nrow = length(levels(factorlist[[1]])),
   ncol = length(levels(factorlist[[2]])),
   dimnames =
list(levels(factorlist[[1]]),levels(factorlist[[2]]) )
) 



for (i in 1:length(A[,1])) 
{
tPhii - A$Group.1[i]
tAppari - A$Group.2[i]
M[tPhii, tAppari] - A$pest_max_number[i]
}
return(M)
}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

DISCLAIMER:\ 
\ This email is from the Scottish Crop Researc...{{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


RE: [R] multiple autocorrelation coefficients in spdep?

2005-04-26 Thread Ignacio Colonna
Thanks for the reply. I will look into the suggestions you have given.
Indeed, I have used an lme model with direct covariance representation via
geostatistical models, where I was able to fit separate terms for different
groups, but part of my point is to compare the outcome from both approaches.

Ignacio


-Original Message-
From: Roger Bivand [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 26, 2005 3:00 AM
To: Ignacio Colonna
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] multiple autocorrelation coefficients in spdep?

On Mon, 25 Apr 2005, Ignacio Colonna wrote:

 Hello,
 
 Has anyone modified the errorsarlm in the R package spdep to
 allow for more than a single spatial autocorrelation coefficient (i.e.
 'lambda')? 
 
 Or, if not, any initial suggestions on how to make that
 modification? I have looked at the source code for the function and
realize
 that any attempt to do it on my own would require much dedication, so
would
 like to check whether someone has done it already. My R programming skills
 are very elementary.
 
  
 
 Specifically I would need to specify 2 different lambdas in a dataset, one
 for each group. I am performing a regression of grain yield against a
number
 of soil variables, for 2 different years, where the regression includes
 terms for year*soil variables interaction. The spatial structure of the
 error is clearly different between these years, and I would thus like to
fit
 different lambdas to them, if possible. Of course one option is to just
run
 2 separate regressions, but if the possibility of fitting more than 1
lambda
 does not seem too remote, I think fitting a single model offers some
 advantages.
 

As far as I am aware, as package maintainer, this has not been done, and 
is not easy to do, as you have noted. It might be possible to use the 
lm.gls() function in the MASS package once the compound weights matrix 
(including the coefficients) has been fixed, perhaps using optim(). Have 
you considered other options perhaps including some lme variant, and/or 
spatial panel variants?

 Thanks in advance,
 
 Ignacio

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

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


Re: [R] installing R-2.1.0 from source on Fedora Core 3 with tclt k

2005-04-26 Thread Marc Schwartz
On Tue, 2005-04-26 at 09:05 -0400, Jonathan Baron wrote:
 I was able to compile R-2.0.0 successfully on another fc3
 computer, theoretically identical to the first three.  I'm sorry
 for starting this thread.
 
 It does seem that I had a problem that resulted from having only
 tk and tcl, but not tk-devel and tcl-devel.  Perhaps after I
 installed these I forgot to log out and log in again, so they
 weren't found.
 
 When I did it successfully, I installed the devel versions first, 
 then logged in as root and did everything as root.  (Initially I
 had done only the very last step - make install - as root.)
 Probably this doesn't matter either.

Logging in and out should not be needed. The header files (installed
from the 'devel' RPMS) are installed in standard locations on Linux
(ie. /usr/include) as are the libraries (ie. /usr/lib) and these are
usually picked up by the configure script.

There is really nothing in terms of environment variables for example,
that would need to get updated via a logout/login cycle. Unlike Windows,
which for example can require a full re-boot when certain components get
installed, about the only time Linux needs a re-boot is to utilize a new
kernel. Otherwise the majority of system updates are done hot.

When building from source, I do it all as a regular user and as you
reference above, then 'su' to root for the installation.

Best regards,

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


[R] postscript (eps) / latex / par(mfg=...) / problem!

2005-04-26 Thread Dan Bolser

The same problem I am having has been reported here 

http://tolstoy.newcastle.edu.au/R/devel/04a/0344.html


Namely that using par(mfg=...) with a postscript (eps) for inclusion with
latex makes the figure appear upside down and back to front (flipped)!

Converting the dvi to ps makes matters worse (the eps seems to be broken),
however, it appears fine with gv.

Here is (basically) the code I am using...

dat - read.table(x.dmp, header=1)
t(dat)
t(dat)
1   2   3   4  5  6 7  8 9 10 11 12 13 14 15 16 17 18 19 20
CHAINS  1   2   3   4  5  6 7  8 9 10 11 12 13 14 16 20 23 24 26 28
FREQUENCY 886 792 136 201 16 58 6 21 3  9  3  9  1  4  3  1  1  1  1  1

postscript(
+   x.eps,
+   width = 6.0,
+   height = 6.0,
+   horizontal = FALSE,
+   onefile = FALSE,
+   paper = special,
+   )

par(mfg=c(1,1))
par(mar=c(3,4,1,2))
plot(dat,type='b')

par(mfg=c(2,1))
par(mar=c(4,4,0,2))
plot(dat,type='b', log='y')

dev.off()


Including the resulting file in a latex document like this...

begin{figure}
\centering
\includegraphics[width=\textwidth]{x.eps}
\caption[X]
{
Hello!
}
\label{xFig}
\end{figure}

The result is an upside down (flipped) version of my plot. I tried
rotating 180 degrees (based on similar problems people were having on the
list), but then it just gets worse (most of the plot is off the page). If
I convert the dvi to ps (dvips -Ppdf my.tex.dvi -o my.tex.ps) it gets
worse (a tiny speck where the image should be).

After removing the two mfg commands (which I use to add grid lines (not
shown for clarity)) everything is fine! Some how mfg is snarling things
up.

OK, I just had a brain wave (dont laugh). Here is a diff of the working
eps vs the broken eps...

diff broken working

78a79,80
 %%Page: 1 1
 bp
229c231
 57.60 43.20 403.20 201.60 cl
---
 57.60 57.60 403.20 216.00 cl
417c419
 %%Pages: 0
---
 %%Pages: 1


Does that help anyone debug my problem? Like I said, both look identical
via gv, and are 'conceptually' identical in R.

Here are my vitals 

Linux 2.4.20-31.9 i686 athlon i386 GNU/Linux
R 2.0.0 (2004-10-04).
GNU Ghostscript 7.05 (2002-04-22)

Anything else you need?

Please help!

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


[R] .libPaths()

2005-04-26 Thread Sebastian Leuzinger
Hello
I use the function .libPaths() 

 .libPaths()
[1] /usr/local/lib/R/library
 .libPaths(c(/usr/local/lib/myRlib,/usr/local/lib/library))
 .libPaths()
[1] /usr/local/lib/R/library

but it simply does not pick up the new path. Can anybody help?
(The problem originates from the inability to install packages 
into /usr/local/lib/R/library, running R under linux suse 9.3)


Sebastian Leuzinger

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


Re: [R] .libPaths()

2005-04-26 Thread Thomas Lumley
On Tue, 26 Apr 2005, Sebastian Leuzinger wrote:
Hello
I use the function .libPaths()
.libPaths()
[1] /usr/local/lib/R/library
.libPaths(c(/usr/local/lib/myRlib,/usr/local/lib/library))
.libPaths()
[1] /usr/local/lib/R/library
but it simply does not pick up the new path. Can anybody help?
(The problem originates from the inability to install packages
into /usr/local/lib/R/library, running R under linux suse 9.3)
It works for me as long as the paths actually exist -- it didn't work with 
your example because I don't have /usr/local/lib/myRlib or 
/usr/local/lib/library.

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


Re: [R] .libPaths()

2005-04-26 Thread Roger D. Peng
Did you check to make sure the new path exists?
-roger
Sebastian Leuzinger wrote:
Hello
I use the function .libPaths() 


.libPaths()
[1] /usr/local/lib/R/library
.libPaths(c(/usr/local/lib/myRlib,/usr/local/lib/library))
.libPaths()
[1] /usr/local/lib/R/library
but it simply does not pick up the new path. Can anybody help?
(The problem originates from the inability to install packages 
into /usr/local/lib/R/library, running R under linux suse 9.3)


Sebastian Leuzinger
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] missing values

2005-04-26 Thread Ramon Diaz-Uriarte
Dear Giordano,

Library Hmisc, by Frank Harrell, contains several functions for imputation 
which I have found extremely useful.

Best,

R.



On Tuesday 26 April 2005 11:58, Giordano Sanchez wrote:
 Hello,

 Thanks for the instructive responses. But two questions arise.
 Firstable I can't manage to load the library mice.
 I'm using R 2.0.1 on my Debian
I try just copying the package in my library /usr/lib/R/library .
 but when i do library()
 ...
 mice   ** No title available (pre-2.0.0
 install?) **
 ...
 and when i do  library(mice)
Error in library(mice) : 'mice' is not a valid
 package --installed  2.0.0?


 The second question is more statistical:
 aregImpute() seems to give good results but i would like to compare the
 different methods not just graphically. It'is possible?
 I also have other meteorological stations that have correleted data with
 the data station I'm using? Can I use those data to improve my imputation
 method.

 Regards,

 Giordano

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

-- 
Ramón Díaz-Uriarte
Bioinformatics Unit
Centro Nacional de Investigaciones Oncológicas (CNIO)
(Spanish National Cancer Center)
Melchor Fernández Almagro, 3
28029 Madrid (Spain)
Fax: +-34-91-224-6972
Phone: +-34-91-224-6900

http://ligarto.org/rdiaz
PGP KeyID: 0xE89B3462
(http://ligarto.org/rdiaz/0xE89B3462.asc)




**NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en su caso los ficheros 
adjuntos, pueden contener información protegida para el uso exclusivo de su 
destinatario. Se prohíbe la distribución, reproducción o cualquier otro tipo de 
transmisión por parte de otra persona que no sea el destinatario. Si usted 
recibe por error este correo, se ruega comunicarlo al remitente y borrar el 
mensaje recibido. 
**CONFIDENTIALITY NOTICE** This email communication and any attachments may 
contain confidential and privileged information for the sole use of the 
designated recipient named above. Distribution, reproduction or any other use 
of this transmission by any party other than the intended recipient is 
prohibited. If you are not the intended recipient please contact the sender and 
delete all copies.

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


[R] Error using e1071 svm: NA/NaN/Inf in foreign function call

2005-04-26 Thread João Mendes Moreira
Hello,

As far I saw in archive mailing list, I am not the first person with this 
problem. Anyway I was not able to pass this error once the information I got 
from the archive it is not very conclusive for this case. I have used linear, 
radial and sigmoid kernels for the same data in the same conditions and 
everything is ok.  This problem just happens with the polynomial kernel. I send 
the debuging result from a reproducible example. The error message is at the 
end.

Thanks in advance

Joao
_
FEUP - Engineering Faculty, Porto University - Portugal
DEMEGI/GEIN
Tel.: +351 22 508 1639
Fax: +351 22 508 1538


Example:

debugging in: svm(Fim ~ ., data = list(Inicio = c(25056, 28554, 32074, 
33266, 39116, 40466, 41684, 42919, 46233, 47772, 48857, 50613, 
52626, 56210, 58817, 62476, 25471, 27619, 28342, 29093, 29814, 
31971, 32861, 34861, 35757, 36386, 38455, 42566, 43368, 46749, 
47879, 48993, 49759, 50234, 51477, 51552, 51835, 52747, 53219, 
54654, 55038, 56458, 58147, 58588, 59297, 60246, 61078, 61766, 
62252, 64219, 64609, 66020, 67155, 67866, 71006, 71771, 72851, 
73689, 24464, 25808, 29370, 34246, 37772, 38930, 42631, 46039, 
47247, 49797, 50887, 54400, 58090, 59284, 62835, 69276, 75084, 
27295, 31077, 32004, 33357, 34505, 35210, 39278, 40773, 48925, 
51568, 52623, 54216, 59771, 60759, 64410, 67766, 71363, 23238, 
23981, 24647, 26498, 29248, 29837, 30372, 31583, 33680, 35404, 
35913, 37145, 39135, 39381, 41374, 42626, 44911, 48595, 49161, 
50376, 50983, 51562, 51995, 53856, 57033, 57706, 57983, 58692, 
59346, 60522, 64186, 69265, 70944, 72866, 73804, 25704, 27485, 
29070, 29244, 30025, 34286, 35797, 36534, 37194, 38188, 39018, 
39829, 42681, 43212, 46788, 47142, 49024, 51016, 52888, 53416, 
54579, 55023, 56971, 58974, 65278, 66524, 73780, 23432, 24009, 
24576, 25382, 26446, 28081, 28815, 29382, 30545, 31001, 32360, 
32897, 33620, 34824, 35231, 36854, 39980, 40601, 43810, 47241, 
50895, 52016, 52781, 53893, 55148, 57066, 57463, 60234, 60539, 
62271, 63602, 63898, 67163, 25705, 26312, 27191, 29796, 31031, 
32947, 34245, 35416, 42399, 43585, 45441, 47346, 49180, 51126, 
52209, 52807, 53777, 55100, 56960, 57600, 58153, 59776, 60726, 
61665, 62252, 63579, 65315, 67087, 69278, 71865, 74845, 23457, 
27725, 28387, 29070, 29324, 30527, 32308, 33018, 33555, 34086, 
36698, 37812, 38424, 43138, 44917, 47252, 47749, 48371, 49173, 
49529, 50079, 50831, 52817, 54515, 56300, 56841, 59390, 60488, 
61676, 63473, 66798, 68636, 69266, 69996, 72289, 73708, 25981, 
28212, 31749, 32981, 34046, 36499, 37762, 40061, 41523, 45147, 
46265, 48704, 49840, 52050, 53554, 54447, 55765, 58446, 60424, 
61964, 62823, 65211, 66269, 67818, 69051, 70375, 30865, 35662, 
36956, 40381, 41567, 42838, 44156, 45250, 47778, 48956, 51925, 
52634, 58047, 59131, 60439, 60793, 63402, 68843, 73788, 29262, 
30645, 31228, 32648, 35312, 36440, 37077, 38279, 40234, 41266, 
44311, 46614, 47303, 47849, 48443, 49146, 49551, 50602, 52085, 
57448, 59759, 61350, 70081, 23412, 24078, 25157, 25813, 26845, 
27522, 28035, 29885, 33453, 34823, 36470, 38876, 43025, 45422, 
46674, 48547, 49026, 51011, 52661, 55224, 56155, 56881, 58671, 
59214, 60475, 61110, 61691, 68951, 70135, 73754, 23349, 24817, 
25505, 26846, 29162, 31760, 32979, 33497, 34661, 35836, 40191, 
44880, 45457, 46079, 47357, 48374, 49093, 50187, 51892, 54524, 
55210, 55810, 56243, 57605, 58565, 59249, 60339, 62345, 65299, 
66304, 67782, 71822, 23275, 24132, 24592, 25057, 28456, 32484, 
32961, 33442, 34287, 34864, 35334, 37177, 48274, 49067, 50791, 
52114, 52728, 54547, 56413, 56826, 59311, 60416, 61196, 61850, 
63257, 67009, 69268, 70260, 73661, 23479, 23929, 24592, 25223, 
25806, 26370, 27576, 29322, 30067, 31670, 32224, 33184, 33535, 
34792, 35242, 36615, 37709, 39014, 40690, 43199, 45041, 46178, 
46717, 47277, 47810, 50404, 50956, 52215, 52788, 53241, 54447, 
55675, 56210, 57100, 58765, 63026, 63679, 68971, 71276, 72867, 
73799, 24590, 29347, 30606, 34185, 37677, 39006, 40041, 43744, 
46158, 48638, 49874, 52021, 55689, 58049, 60456, 62896, 63977, 
65408, 67863, 69060, 73589, 30936, 33051, 34518, 38084, 39214, 
40288, 41716, 45256, 46364, 47792, 48765, 49956, 54435, 55466, 
58190, 62216, 63318, 70175, 71250, 74837, 25274, 26921, 27596, 
28962, 29314, 29891, 33652, 37706, 39515, 40221, 40742, 44280, 
44754, 46095, 47423, 49651, 51428, 57608, 58045, 60667, 61588, 
62560, 68305, 71095, 72804, 23225, 26405, 26912, 28682, 29291, 
32259, 34827, 35375, 38231, 40118, 44419, 45055, 45542, 46669, 
47317, 47903, 48558, 49082, 49314, 50926, 51564, 52772, 53939, 
56079, 57392, 58776, 59301, 61751, 63511, 66226, 70126, 73799, 
24632, 26950, 27431, 31036, 31775, 32411, 33520, 34676, 36510, 
37164, 40126, 40747, 41441, 42627, 44878, 46147, 47375, 49268, 
49646, 50215, 56825, 59737, 62569, 69224, 70171, 24576, 27596, 
29243, 29855, 30506, 31750, 32915, 34695, 35328, 36482, 37218, 
38307, 39061, 44248, 44999, 46774, 47275, 48561, 49719, 50318, 
50920, 51417, 53241, 

[R] Advice for calling a C function

2005-04-26 Thread Tyler Smith
Hi,
I'm having some trouble with a bit of combined C  R code. I'm trying to 
write a C function to handle the for loops in a function I'm working on 
to calculate a similarity matrix. Jari Oksanen has kindly added the 
necessary changes to the vegan package so that I can use the vegdist 
function, so this isn't absolutely necessary. However, I'm stubborn and 
want to know why Jari's code works and mine doesn't! Other than, of 
course, the obvious - one of us knows what their doing and the other 
doesn't. I would appreciate any help. What I've done is:

pass a matrix x to my C function, as a double:
.C(gowsim, as.double(mat), as.integer(nrow(mat)), as.integer(ncol(mat)))
Then I try and reconstruct the matrix, in the form of a C array:
#include R.h
#include Rmath.h
#include math.h
void gowsim ( double *mat, int *OBJ, int *MATDESC)
{
   double x [*MATDESC][*OBJ];
   int i, j, nrow, ncol;
   nrow = *OBJ;
   ncol = *MATDESC;
  
   /* Rebuild Matrix */
   for (j=0; j  ncol; j++) {
   for (i=0; i  nrow; i++) {
   x[i][j] = *mat;
   Rprintf(row %d col %d value %f\n, i, j, x[i][j]);
   mat++;
   }
   }
   for (i=0; i nrow; i++) {
   Rprintf(%f %f %f %f\n, x[i][0], x[i][1], x[i][2], x[i][3]);
   }
}

The Rprintf statements display what's going on at each step. It looks 
for all the world as if the assignments are working properly, but when I 
try and print the matrix I get very strange results. If mat is 3x3 or 
4x4 everything seems ok. But if mat is not symetrical the resulting x 
matrix is very strange. In the case of a 5x4 mat only the first column 
works out, and for 3x4 mat the second and third positions in the first 
column are replaced by the first and second positions of the last 
column. I'm guessing that I've messed up something in my use of 
pointers, or perhaps the for loop, but I can't for the life of me figure 
out what!! Once I sort this out I'll be calculating the differences 
between rows in the x array en route to producing a similarity matrix. I 
looked at the vegdist code, which is fancier than this, and  manages to 
avoid rebuilding the matrix entirely, but it's a bit beyond me.

I'm using WindowsXP, R 2.1.0  (2005-04-18), and the MinGW compiler.
Thanks for your continued patience,
Tyler
--
Tyler Smith
PhD Candidate
Department of Plant Science
McGill University
21,111 Lakeshore Road
Ste. Anne de Bellevue, Quebec
H9X 3V9
CANADA
Tel: 514 398-7851 ext. 8726
Fax: 514 398-7897
[EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] missing values

2005-04-26 Thread Jonathan Baron

On 04/26/05 12:54, Ted Harding wrote:
 Would you be kind enough to give sufficient detail to reproduce
 such a case? I've used 'norm' (and 'cat' and 'mix') quite
 extensively, without encountering non-sensible results (at any
 rate in situations where the packages were not being abused,
 which one can do in certain circumstances -- imputing missing
 values can depend quite strongly on supplying realistic constraints,
 and on not expecting too much when the proportion of missing data
 is substantial: this methodology does not have magical powers!).

OK.  Here you go.  First the data without any names:

41,43,41,43,44
43,40,40,42,41
43,44,NA,43,44
42,43,NA,44,44
41,44,42,42,42
43,43,41,42,42
47,48,46,47,46
39,35,35,39,38
40,39,36,40,38
40,40,40,40,40
48,46,46,48,46
45,45,42,44,45
41,40,40,41,41
40,39,37,40,38
41,42,40,41,41
41,42,41,43,43
46,46,45,46,46
40,40,41,40,41
39,41,40,41,41
40,43,38,40,39
37,36,37,36,39
45,46,45,46,46
43,44,42,43,44
42,42,48,42,43
45,46,45,46,45
37,36,36,36,38
37,34,39,37,39
NA,43,41,44,43
45,44,45,44,45
38,38,37,39,38
45,44,44,44,45
NA,42,43,43,43
45,45,44,44,45
40,35,37,40,38
43,43,43,43,43
39,34,37,36,39
38,38,38,39,39
43,41,40,42,43
46,43,42,45,45
46,45,41,44,44
40,40,38,39,40
39,37,39,38,39

Now the commands I used in norm, and the result:

m1 - as.matrix(read.csv(test.data))
s1 - prelim.norm(m1)
thetahat - em.norm(s1)
rngseed(1234564)
ximp - imp.norm(s1,thetahat,m1)
ximp

1  41.0 43 41.0 43 44
2  43.0 40 40.0 42 41
3  43.0 44 43.72409 43 44
4  42.0 43 43.36864 44 44
5  41.0 44 42.0 42 42
6  43.0 43 41.0 42 42
7  47.0 48 46.0 47 46
8  39.0 35 35.0 39 38
9  40.0 39 36.0 40 38
10 40.0 40 40.0 40 40
11 48.0 46 46.0 48 46
12 45.0 45 42.0 44 45
13 41.0 40 40.0 41 41
14 40.0 39 37.0 40 38
15 41.0 42 40.0 41 41
16 41.0 42 41.0 43 43
17 46.0 46 45.0 46 46
18 40.0 40 41.0 40 41
19 39.0 41 40.0 41 41
20 40.0 43 38.0 40 39
21 37.0 36 37.0 36 39
22 45.0 46 45.0 46 46
23 43.0 44 42.0 43 44
24 42.0 42 48.0 42 43
25 45.0 46 45.0 46 45
26 37.0 36 36.0 36 38
27 37.0 34 39.0 37 39
28 44.13337 43 41.0 44 43
29 45.0 44 45.0 44 45
30 38.0 38 37.0 39 38
31 45.0 44 44.0 44 45
32 41.25152 42 43.0 43 43
33 45.0 45 44.0 44 45
34 40.0 35 37.0 40 38
35 43.0 43 43.0 43 43
36 39.0 34 37.0 36 39
37 38.0 38 38.0 39 39
38 43.0 41 40.0 42 43
39 46.0 43 42.0 45 45
40 46.0 45 41.0 44 44
41 40.0 40 38.0 39 40
42 39.0 37 39.0 38 39

What seemed odd to me, and maybe they aren't, were the imputed
values in rows 3 and 4.  They seemed high, knowing the rater in
question and the students.  Here is the output of transcan, for
the same cases, which looks more in line with what I expected:

1  41.0 43 41.0 43 44
2  43.0 40 40.0 42 41
3  43.0 44 43.09469 43 44
4  42.0 43 43.39897 44 44
5  41.0 44 42.0 42 42
6  43.0 43 41.0 42 42
7  47.0 48 46.0 47 46
8  39.0 35 35.0 39 38
9  40.0 39 36.0 40 38
10 40.0 40 40.0 40 40
11 48.0 46 46.0 48 46
12 45.0 45 42.0 44 45
13 41.0 40 40.0 41 41
14 40.0 39 37.0 40 38
15 41.0 42 40.0 41 41
16 41.0 42 41.0 43 43
17 46.0 46 45.0 46 46
18 40.0 40 41.0 40 41
19 39.0 41 40.0 41 41
20 40.0 43 38.0 40 39
21 37.0 36 37.0 36 39
22 45.0 46 45.0 46 46
23 43.0 44 42.0 43 44
24 42.0 42 48.0 42 43
25 45.0 46 45.0 46 45
26 37.0 36 36.0 36 38
27 37.0 34 39.0 37 39
28 43.80165 43 41.0 44 43
29 45.0 44 45.0 44 45
30 38.0 38 37.0 39 38
31 45.0 44 44.0 44 45
32 42.91116 42 43.0 43 43
33 45.0 45 44.0 44 45
34 40.0 35 37.0 40 38
35 43.0 43 43.0 43 43
36 39.0 34 37.0 36 39
37 38.0 38 38.0 39 39
38 43.0 41 40.0 42 43
39 46.0 43 42.0 45 45
40 46.0 45 41.0 44 44
41 40.0 40 38.0 39 40
42 39.0 37 39.0 38 39

The commands here were

s.imp - transcan(m1,asis=*,data=m1,imputed=T,long=T,pl=F)
s.na - is.na(m1) # which ratings are imputed
m1[which(s.na)] - unlist(s.imp$imputed)

(I wish I could find a more elegant way to replace the NAs.)

Jon
- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

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


Re: [R] Error using e1071 svm: NA/NaN/Inf in foreign function call

2005-04-26 Thread Achim Zeileis
On Tue, 26 Apr 2005 15:46:20 +0100 João Mendes Moreira wrote:

 Hello,
 
 As far I saw in archive mailing list, I am not the first person with
 this problem. Anyway I was not able to pass this error once the
 information I got from the archive it is not very conclusive for this
 case. I have used linear, radial and sigmoid kernels for the same data
 in the same conditions and everything is ok.  This problem just
 happens with the polynomial kernel. I send the debuging result from a
 reproducible example. The error message is at the end.

I receive a different error message:
  Error in eval(expr, envir, enclos) : Object Fim not found
So much for the reproducibility... Wouldn't it be possible to simply use
a data set that is already available in R, *please*?

Anyways, it seems that your specification of `nu' causes the
problem: 0 might be a little bit too small.
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


[R] Finding 'ncp' for t

2005-04-26 Thread Ted Harding
Hi Folks,

I'm looking for a neat procedure for the following:

Given t0 such that

  pt(t0,df,ncp=0) = alpha (given)

find ncp0 such that for given beta

  pt(t0,df,ncp=ncp0) = (1 - beta)

(In other words, what's the ncp such that you get power (1-beta)
to detect it, using a 1-sided test with size alpha when ncp = 0?)

In the past I've done the groping by hand, but this time it
needs to be done many times over, so a good solver for ncp0
in this situation would be handy.

With thanks,
Ted.




E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Apr-05   Time: 15:02:24
-- 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


Re: [R] Finding 'ncp' for t

2005-04-26 Thread Peter Dalgaard
(Ted Harding) [EMAIL PROTECTED] writes:

 Hi Folks,
 
 I'm looking for a neat procedure for the following:
 
 Given t0 such that
 
   pt(t0,df,ncp=0) = alpha (given)
 
 find ncp0 such that for given beta
 
   pt(t0,df,ncp=ncp0) = (1 - beta)
 
 (In other words, what's the ncp such that you get power (1-beta)
 to detect it, using a 1-sided test with size alpha when ncp = 0?)
 
 In the past I've done the groping by hand, but this time it
 needs to be done many times over, so a good solver for ncp0
 in this situation would be handy.

You might want to peek inside power.t.test(). Or just use it...

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


[R] Extending time series

2005-04-26 Thread Fernando Saldanha
I noticed that when one tries to extend a time series (ts) object by a
single period using window() actually two observations (NAs) are
added. See below for an example. Does anyone know the reason for this
behavior and how to avoid it?

Thanks.

FS

 x-ts(c(1,2,3))
 x1- window(x, start(x), end(x) + 1, extend = TRUE)
 x1
Time Series:
Start = 1 
End = 5 
Frequency = 1 
[1]  1  2  3 NA NA

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


[R] Error in nonlinear mixed-effects model

2005-04-26 Thread Revilla,AJ (pgt)
Dear all,

I am trying to fit a mixed-effects non linear regression, but I have some 
trouble with it. My data are a balanced panel of 904 subjects with 8 
observations (at regular periods) per subject.
The functional form of my model is Y=Aexp(-BX1)X2 +e. I want to allow 
parameters A and B to vary among subjects and also include an autocorrelation 
term. I have already fitted a standard nonlinear regression to the data, but I 
keep having problems with NLME.

I have defined my data as a groupedData object, and when I try to fit the model 
I get this error message:

dat-groupedData(V~VAC|ID,data=dat)
attach(dat)
mod-nlme(V~A*exp(B*YEAR)*VAC, fixed=A+B~1, random=A+B~1, 
correlation=corCAR1(), start=c(A=1.2,B=0.2))
Error in getGroups.data.frame(dataMix, eval(parse(text = paste(~1, 
deparse(groups[[2]]),  : 
Invalid formula for groups

Do you have any clue of whats happening? Its the first time I fit a model 
like this in R, so the problem is probably pretty obvious, but I cannot see it.

Thank you very much,

Antonio

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


[R] mantelhaen.test for more than two groups?

2005-04-26 Thread Katrin Schweitzer
Dear All,
I'd like to perform the generalized Cochran-Mantel-Haenszel-Test (as 
described in Agresti (1990), Categorical Data Analysis) for my nominal data.

My problem is that I have more than two groups. In fact I think I'd need 
an 5-dimensional array for the response variable, the control variable 
and three group variables.
Could you please tell me if this is possible in R - and if yes how I am 
supposed to do this?

By now I get an error message:
MyData-array(c(21,6,0,18,8,1,46,9,2,12,8,1,35,3,7,9,2,8,58,5,11,3,2,4,14,0,0,21,0,0,26,0,0,12,0,0,32,0,0,25,0,0,62,0,0,16,0,0),dim=c(3,2,2,2,2))
mantelhaen.test(MyData)
Error in mantelhaen.test(MyData) : x must be a 3-dimensional array

I'm using R Version 1.9.1 on a Linux machine.
I apologize in case I am completely wrong by choosing this test, which 
might be the fact as this is my very first struggle with statistics... :)

In the hope of not losing it,
thank you very much for any help,
:) Kati
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] mantelhaen.test for more than two groups?

2005-04-26 Thread Thomas Lumley
On Tue, 26 Apr 2005, Katrin Schweitzer wrote:
Dear All,
I'd like to perform the generalized Cochran-Mantel-Haenszel-Test (as 
described in Agresti (1990), Categorical Data Analysis) for my nominal data.

My problem is that I have more than two groups. In fact I think I'd need an 
5-dimensional array for the response variable, the control variable and three 
group variables.
Could you please tell me if this is possible in R - and if yes how I am 
supposed to do this?
You're supposed to have a three-dimensional array: exposure x response x 
group.

This means turning your three group variables into one variable.  One way 
to do this is with the interaction() function.

-thomas
Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Extending time series

2005-04-26 Thread Achim Zeileis
On Tue, 26 Apr 2005 11:52:00 -0400 Fernando Saldanha wrote:

 I noticed that when one tries to extend a time series (ts) object by a
 single period using window() actually two observations (NAs) are
 added. See below for an example. Does anyone know the reason for this
 behavior and how to avoid it?

Yes:
  end(x) + 1
is not what you expect it to be. You can set equivalently
  end = 4
  end = c(4, 1)
to achieve what you want and you can compute one of those
representations in various ways, e.g., tsp(x)[2] + 1.
Z

 
 Thanks.
 
 FS
 
  x-ts(c(1,2,3))
  x1- window(x, start(x), end(x) + 1, extend = TRUE)
  x1
 Time Series:
 Start = 1 
 End = 5 
 Frequency = 1 
 [1]  1  2  3 NA NA
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


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


[R] good editor for R sources ?

2005-04-26 Thread vincent
Dear all,
(Sorry if the question has already been answered.)
Could someone please suggest a good text editor for
writing R sources ?
(I know emacs exists ... but I find it a bit heavy).
I use crimson (http://www.crimsoneditor.com) which is
small and simple, but the R syntax seems not to be supported.
Thanks for any advice
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] mantelhaen.test for more than two groups?

2005-04-26 Thread Peter Dalgaard
Thomas Lumley [EMAIL PROTECTED] writes:

 On Tue, 26 Apr 2005, Katrin Schweitzer wrote:
 
  Dear All,
 
  I'd like to perform the generalized Cochran-Mantel-Haenszel-Test (as
  described in Agresti (1990), Categorical Data Analysis) for my
  nominal data.
 
  My problem is that I have more than two groups. In fact I think I'd
  need an 5-dimensional array for the response variable, the control
  variable and three group variables.
  Could you please tell me if this is possible in R - and if yes how I
  am supposed to do this?
 
 You're supposed to have a three-dimensional array: exposure x response
 x group.
 
 This means turning your three group variables into one variable.  One
 way to do this is with the interaction() function.

Or, if data are already counts, change the dimensions (as in dim(x) -
c(2,3,8)), possibly after using aperm() to get the indices in the
right order.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


Re: [R] Extending time series

2005-04-26 Thread Gabor Grothendieck
On 4/26/05, Fernando Saldanha [EMAIL PROTECTED] wrote: 
 
 I noticed that when one tries to extend a time series (ts) object by a
 single period using window() actually two observations (NAs) are
 added. See below for an example. Does anyone know the reason for this
 behavior and how to avoid it?
 
 Thanks.
 
 FS
 
  x-ts(c(1,2,3))
  x1- window(x, start(x), end(x) + 1, extend = TRUE)
  x1
 Time Series:
 Start = 1
 End = 5
 Frequency = 1
 [1] 1 2 3 NA NA

  Another way to do it is:
 ts(c(x, NA), start = start(x), freq = frequency(x))

[[alternative HTML version deleted]]

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


RE: [R] good editor for R sources ?

2005-04-26 Thread Rau, Roland
Hi,


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of vincent
 (Sorry if the question has already been answered.)
 Could someone please suggest a good text editor for
 writing R sources ?
 (I know emacs exists ... but I find it a bit heavy).
 I use crimson (http://www.crimsoneditor.com) which is
 small and simple, but the R syntax seems not to be supported.
 Thanks for any advice

although I prefer myself (X)Emacs, I suggest to people Tinn-R, it is
GPLed, has syntax highlighting, and something I haven't seen with any
other editor before:
You write for example:
mydata - read.table(.csv, header=TRUE, )
and while you are writing your code, a line pops up below the line you
are writing giving you the arguments and their default values for the
current function (I was impressed, I have to admit).

The homepage of this project is:
http://www.sciviews.org/Tinn-R/

Best,
Roland


+
This mail has been sent through the MPI for Demographic Rese...{{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


Re: [R] good editor for R sources ?

2005-04-26 Thread Uwe Ligges
vincent wrote:
Dear all,
(Sorry if the question has already been answered.)
Could someone please suggest a good text editor for
writing R sources ?
(I know emacs exists ... but I find it a bit heavy).
I use crimson (http://www.crimsoneditor.com) which is
small and simple, but the R syntax seems not to be supported.
See http://www.sciviews.org/_rgui/projects/Editors.html
The page tells us that there is support for Crimson editor.
Uwe Ligges

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


Re: [R] good editor for R sources ?

2005-04-26 Thread Cuvelier Etienne

At 18:22 26/04/2005 +0200, vincent wrote:
Dear all,
(Sorry if the question has already been answered.)
Could someone please suggest a good text editor for
writing R sources ?
(I know emacs exists ... but I find it a bit heavy).
I use crimson (http://www.crimsoneditor.com) which is
small and simple, but the R syntax seems not to be supported.
Thanks for any advice

Tinn-R with Sciviews :

http://www.sciviews.org/Tinn-R/index.html




Cuvelier Etienne
Assistant
FUNDP - Institut d'Informatique
rue Grandgagnage, 21   B-5000 Namur (Belgique)
tel: 32.81.72.49.93fax: 32.81.72.49.67

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


RE: [R] random interactions in lme

2005-04-26 Thread Ignacio Colonna
The code below gives almost identical results for a split-block analysis in
lme and SAS proc mixed, in terms of variance components and F statistics. It
just extends the example in Pinheiro  Bates (p.162) to a split block
design. 

I am including below the SAS code and the data in case you want to try it.
The only difference between both is in the df for the F denominator, which I
wasn't able to compute correctly in lme, but this may be my ignorance on how
to correctly specify the model. It is not a big issue though, as the F
values are identical, so you can compute the p-values if you know how to
obtain the correct DenDF. 

# a split block design
spbl.an1-lme(yield~rowspace*ordered(tpop),random=list(rep=pdBlocked(list(pd
Ident(~1),
pdIdent(~rowspace-1),pdIdent(~ordered(tpop)-1,data=spblock)

* SAS code
proc mixed data=splitblock method=reml;
class rep rowspace tpop;
model yield=rowspace tpop rowspace*tpop;
random rep rep*rowspace rep*tpop;
run;


# data

rowspacetpoprep plotyield
9   60  1   133 19
9   120 1   101 19.5
9   180 1   117 22
9   240 1   132 19.4
9   300 1   116 23.9
18  60  1   134 15.8
18  120 1   102 26.2
18  180 1   118 21.9
18  240 1   131 20
18  300 1   115 23.3
9   60  2   216 20.6
9   120 2   233 22
9   180 2   201 23.4
9   240 2   217 28.2
9   300 2   232 25.9
18  60  2   215 19.7
18  120 2   234 30.3
18  180 2   202 22.4
18  240 2   218 27.9
18  300 2   231 28.5
9   60  3   309 20.8
9   120 3   308 21.6
9   180 3   324 24.6
9   240 3   340 25.3
9   300 3   325 35.3
18  60  3   310 17.2
18  120 3   307 23.6
18  180 3   323 24.9
18  240 3   339 30.7
18  300 3   326 33
9   60  4   435 15.6
9   120 4   403 20.4
9   180 4   430 24.4
9   240 4   414 21
9   300 4   419 23.2
18  60  4   436 17.7
18  120 4   404 23.6
18  180 4   429 21.7
18  240 4   413 24.4
18  300 4   420 26.2


Ignacio


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas Bates
Sent: Monday, April 25, 2005 6:40 PM
To: Jacob Michaelson
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] random interactions in lme

Jacob Michaelson wrote:
 
 On Apr 24, 2005, at 8:52 AM, Douglas Bates wrote:
 
 Jacob Michaelson wrote:

 Hi All,
 I'm taking an Experimental Design course this semester, and have 
 spent many long hours trying to coax the professor's SAS examples 
 into something that will work in R (I'd prefer that the things I 
 learn not be tied to a license).  It's been a long semester in that 
 regard.
 One thing that has really frustrated me is that lme has an extremely 
 counterintuitive way for specifying random terms.  I can usually 
 figure out how to express a single random term, but if there are 
 multiple terms or random interactions, the documentation available 
 just doesn't hold up.
 Here's an example: a split block (strip plot) design evaluated in SAS 
 with PROC MIXED (an excerpt of the model and random statements):
 model DryMatter = Compacting|Variety / outp = residuals ddfm = 
 satterthwaite;
 random Rep Rep*Compacting Rep*Variety;
 Now the fixed part of that model is easy enough in lme: 
 DryMatter~Compacting*Variety
 But I can't find anything that adequately explains how to simply add 
 the random terms to the model, ie rep + rep:compacting + 
 rep:variety; anything to do with random terms in lme seems to go off 
 about grouping factors, which just isn't intuitive for me.


 The grouping factor is rep because the random effects are associated 
 with the levels of rep.

 I don't always understand the SAS notation so you may need to help me 
 out here.  Do you expect to get a single variance component estimate 
 for Rep*Compacting and a single variance component for Rep*Variety?  
 If so, you would specify the model in lmer by first creating factors 
 for the interaction of Rep and Compacting and the interaction of Rep 
 and Variety.

 dat$RepC - with(dat, Rep:Compacting)[drop=TRUE]
 dat$RepV - with(dat, Rep:Variety)[drop=TRUE]
 fm - lmer(DryMatter ~ Compacting*Variety+(1|Rep)+(1|RepC)+(1|RepV), dat)



 
 Thanks for the prompt reply.  I tried what you suggested, here's what I 
 got:
 
   turf.lme=lmer(dry_matter~compacting*variety+(1|rep)+(1|rc)+(1|rv), 
 turf.data)
 Error in lmer(dry_matter ~ compacting * variety + (1 | rep) + (1 | rc) +
:
 entry 3 in matrix[9,2] has row 3 and column 2
 
 Just to see what the 

Re: [R] postscript (eps) / latex / par(mfg=...) / problem!

2005-04-26 Thread Dan Bolser

Should I post this to 'bugs'?

On Tue, 26 Apr 2005, Dan Bolser wrote:


The same problem I am having has been reported here 

http://tolstoy.newcastle.edu.au/R/devel/04a/0344.html


Namely that using par(mfg=...) with a postscript (eps) for inclusion with
latex makes the figure appear upside down and back to front (flipped)!

Converting the dvi to ps makes matters worse (the eps seems to be broken),
however, it appears fine with gv.

Here is (basically) the code I am using...

dat - read.table(x.dmp, header=1)
t(dat)
t(dat)
1   2   3   4  5  6 7  8 9 10 11 12 13 14 15 16 17 18 19 20
CHAINS  1   2   3   4  5  6 7  8 9 10 11 12 13 14 16 20 23 24 26 28
FREQUENCY 886 792 136 201 16 58 6 21 3  9  3  9  1  4  3  1  1  1  1  1

postscript(
+   x.eps,
+   width = 6.0,
+   height = 6.0,
+   horizontal = FALSE,
+   onefile = FALSE,
+   paper = special,
+   )

par(mfg=c(1,1))
par(mar=c(3,4,1,2))
plot(dat,type='b')

par(mfg=c(2,1))
par(mar=c(4,4,0,2))
plot(dat,type='b', log='y')

dev.off()


Including the resulting file in a latex document like this...

begin{figure}
\centering
\includegraphics[width=\textwidth]{x.eps}
\caption[X]
{
Hello!
}
\label{xFig}
\end{figure}

The result is an upside down (flipped) version of my plot. I tried
rotating 180 degrees (based on similar problems people were having on the
list), but then it just gets worse (most of the plot is off the page). If
I convert the dvi to ps (dvips -Ppdf my.tex.dvi -o my.tex.ps) it gets
worse (a tiny speck where the image should be).

After removing the two mfg commands (which I use to add grid lines (not
shown for clarity)) everything is fine! Some how mfg is snarling things
up.

OK, I just had a brain wave (dont laugh). Here is a diff of the working
eps vs the broken eps...

diff broken working

78a79,80
 %%Page: 1 1
 bp
229c231
 57.60 43.20 403.20 201.60 cl
---
 57.60 57.60 403.20 216.00 cl
417c419
 %%Pages: 0
---
 %%Pages: 1


Does that help anyone debug my problem? Like I said, both look identical
via gv, and are 'conceptually' identical in R.

Here are my vitals 

Linux 2.4.20-31.9 i686 athlon i386 GNU/Linux
R 2.0.0 (2004-10-04).
GNU Ghostscript 7.05 (2002-04-22)

Anything else you need?

Please help!

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


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


[R] Multiple periodicities

2005-04-26 Thread Miguel A. Arranz
Derar all,

This is a problem that I am unable to solve. I am interested in analyzing some 
high-frequency data which show two periodicities (periods 5 and 260), It is 
clear how to estimate models with one periodicity with arima() but I have not 
been able to include both periodicities. Is there some good way to handle tis 
kind of problem?

Thanks in advane,

Miguel A.

-- 
*
Miguel A. Arranz
Tol-Project
[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


FW: [R] Advice for calling a C function

2005-04-26 Thread Tuszynski, Jaroslaw W.

I think it is a problem with matrices in R and C being stored in different
row/column order

 void gowsim ( double *mat, int *OBJ, int *MATDESC)  {
double x [*MATDESC][*OBJ];
int i, j, nrow, ncol;
nrow = *OBJ;
ncol = *MATDESC;
 
/* Rebuild Matrix */
for (j=0; j  ncol; j++) {
for (i=0; i  nrow; i++) {
x[i][j] = *mat;

Swapping x[i][j] to x[j][i] should fix the problem. Sorry, I did not test
it.

Rprintf(row %d col %d value %f\n, i, j, x[i][j]);
mat++;
}
}
for (i=0; i nrow; i++) {
Rprintf(%f %f %f %f\n, x[i][0], x[i][1], x[i][2], x[i][3]);
}
}

Jarek
\===

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

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


Re: [R] Index matrix to pick elements from 3-dimensional matrix

2005-04-26 Thread Tony Plate
I'm assuming what you want to do is randomly sample from slices of A 
selected on the 3-rd dimension, as specified by J.  Here's a way that 
uses indexing by a matrix.  The cbind() builds a three column matrix of 
indices, the first two of which are randomly selected.  The use of 
replace() is to make the result have the same attributes, e.g., dim and 
dimnames, as J.

 A - array(letters[1:12],c(2,2,3))
 J - matrix(c(1,2,3,3),2,2)
 replace(J, TRUE, A[cbind(sample(dim(A)[1], length(J), rep=T), 
sample(dim(A)[2], length(J), rep=T), as.vector(J))])
 [,1] [,2]
[1,] b  l
[2,] f  k
 replace(J, TRUE, A[cbind(sample(dim(A)[1], length(J), rep=T), 
sample(dim(A)[2], length(J), rep=T), as.vector(J))])
 [,1] [,2]
[1,] b  l
[2,] h  i
 replace(J, TRUE, A[cbind(sample(dim(A)[1], length(J), rep=T), 
sample(dim(A)[2], length(J), rep=T), as.vector(J))])
 [,1] [,2]
[1,] c  l
[2,] h  k


-- Tony Plate
Robin Hankin wrote:
Hello Juhana
try this (but there must be a better way!)

stratified.select - function(A,J){
  out - sapply(J,function(i){sample(A[,,i],1)})
  attributes(out) - attributes(J)
  return(out)
}
A - array(letters[1:12],c(2,2,3))
J - matrix(c(1,2,3,3),2,2)
R  stratified.select(A,J)
 [,1] [,2]
[1,] b  i
[2,] g  k
R   stratified.select(A,J)
 [,1] [,2]
[1,] d  j
[2,] f  l
R
best wishes
Robin

On Apr 26, 2005, at 05:16 am, juhana vartiainen wrote:
Hi all
Suppose I have a dim=c(2,2,3) matrix A, say:
A[,,1]=
a b
c d
A[,,2]=
e f
g h
A[,,3]=
i j
k l
Suppose that I want to create a 2x2 matrix X, which picks elements 
from the above-mentioned submatrices according to an index matrix J 
referring to the depth dimension:
J=
1 3
2 3

In other words, I want X to be
X=
a j
g l
since the matrix J says that the (1,1)-element should be picked from 
A[,,1], the (1,2)-element should be picked from A[,,3], etc.

I have A and I have J. Is there an expression in A and J that creates X?
Thanks
Juhana
[EMAIL PROTECTED]
--
Juhana Vartiainen
docent in economics
Director, FIEF (Trade Union Foundation for Economic Research, 
Stockholm), http://www.fief.se
gsm +46 70 360 9915
office +46 8 696 9915
email [EMAIL PROTECTED]
homepage http://www.fief.se/staff/Juhana/index.html

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


--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
 tel  023-8059-7743
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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


[R] Summarizing factor data in table?

2005-04-26 Thread Andy Bunn
I have a very simple query with regard to summarizing the number of factors
present in a certain snippet of a data frame.
Given the following data frame:

foo - data.frame(yr = c(rep(1998,4), rep(1999,4), rep(2000,2)), div =
factor(c(rep(NA,4),A,B,C,D,A,C)),
org = factor(c(1:4,1:4,1,2)))

I want to get two new variables. Object ndiv would give the number of
divisions by year:
 1998 0
 1999 3
 2000 2
Object norgs would give the number of organizations
 1998 4
 1999 4
 2000 2
I figure xtabs should be able to do it, but I'm stuck without a for loop.
Any suggestions? -Andy

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


Re: [R] random interactions in lme

2005-04-26 Thread Jacob Michaelson
Thanks, Ignacio --
That was another thing I'd been wondering about (the DenDF in SAS vs.  
lme).  Your example will give me something to chew on as I continue to  
try and reconcile proc mixed and lme.

Thanks for the guidance.
Jake
On Apr 26, 2005, at 10:36 AM, Ignacio Colonna wrote:
The code below gives almost identical results for a split-block  
analysis in
lme and SAS proc mixed, in terms of variance components and F  
statistics. It
just extends the example in Pinheiro  Bates (p.162) to a split block
design.

I am including below the SAS code and the data in case you want to try  
it.
The only difference between both is in the df for the F denominator,  
which I
wasn't able to compute correctly in lme, but this may be my ignorance  
on how
to correctly specify the model. It is not a big issue though, as the F
values are identical, so you can compute the p-values if you know how  
to
obtain the correct DenDF.

# a split block design
spbl.an1- 
lme(yield~rowspace*ordered(tpop),random=list(rep=pdBlocked(list(pd
Ident(~1),
pdIdent(~rowspace-1),pdIdent(~ordered(tpop)-1,data=spblock)

* SAS code
proc mixed data=splitblock method=reml;
class rep rowspace tpop;
model yield=rowspace tpop rowspace*tpop;
random rep rep*rowspace rep*tpop;
run;
# data
rowspacetpoprep plotyield
9   60  1   133 19
9   120 1   101 19.5
9   180 1   117 22
9   240 1   132 19.4
9   300 1   116 23.9
18  60  1   134 15.8
18  120 1   102 26.2
18  180 1   118 21.9
18  240 1   131 20
18  300 1   115 23.3
9   60  2   216 20.6
9   120 2   233 22
9   180 2   201 23.4
9   240 2   217 28.2
9   300 2   232 25.9
18  60  2   215 19.7
18  120 2   234 30.3
18  180 2   202 22.4
18  240 2   218 27.9
18  300 2   231 28.5
9   60  3   309 20.8
9   120 3   308 21.6
9   180 3   324 24.6
9   240 3   340 25.3
9   300 3   325 35.3
18  60  3   310 17.2
18  120 3   307 23.6
18  180 3   323 24.9
18  240 3   339 30.7
18  300 3   326 33
9   60  4   435 15.6
9   120 4   403 20.4
9   180 4   430 24.4
9   240 4   414 21
9   300 4   419 23.2
18  60  4   436 17.7
18  120 4   404 23.6
18  180 4   429 21.7
18  240 4   413 24.4
18  300 4   420 26.2
Ignacio
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas Bates
Sent: Monday, April 25, 2005 6:40 PM
To: Jacob Michaelson
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] random interactions in lme
Jacob Michaelson wrote:
On Apr 24, 2005, at 8:52 AM, Douglas Bates wrote:
Jacob Michaelson wrote:
Hi All,
I'm taking an Experimental Design course this semester, and have
spent many long hours trying to coax the professor's SAS examples
into something that will work in R (I'd prefer that the things I
learn not be tied to a license).  It's been a long semester in that
regard.
One thing that has really frustrated me is that lme has an extremely
counterintuitive way for specifying random terms.  I can usually
figure out how to express a single random term, but if there are
multiple terms or random interactions, the documentation available
just doesn't hold up.
Here's an example: a split block (strip plot) design evaluated in  
SAS
with PROC MIXED (an excerpt of the model and random statements):
model DryMatter = Compacting|Variety / outp = residuals ddfm =
satterthwaite;
random Rep Rep*Compacting Rep*Variety;
Now the fixed part of that model is easy enough in lme:
DryMatter~Compacting*Variety
But I can't find anything that adequately explains how to simply add
the random terms to the model, ie rep + rep:compacting +
rep:variety; anything to do with random terms in lme seems to go  
off
about grouping factors, which just isn't intuitive for me.

The grouping factor is rep because the random effects are associated
with the levels of rep.
I don't always understand the SAS notation so you may need to help me
out here.  Do you expect to get a single variance component estimate
for Rep*Compacting and a single variance component for Rep*Variety?
If so, you would specify the model in lmer by first creating factors
for the interaction of Rep and Compacting and the interaction of Rep
and Variety.
dat$RepC - with(dat, Rep:Compacting)[drop=TRUE]
dat$RepV - with(dat, Rep:Variety)[drop=TRUE]
fm - lmer(DryMatter ~ Compacting*Variety+(1|Rep)+(1|RepC)+(1|RepV),  
dat)


Thanks for the prompt reply.  I tried what you suggested, here's what  
I
got:


Re: [R] Summarizing factor data in table?

2005-04-26 Thread Tony Plate
Do you want to count the number of non-NA divisions and organizations in 
the data for each year (where duplicates are counted as many times as 
they appear)?

 tapply(!is.na(foo$div), foo$yr, sum)
1998 1999 2000
   042
 tapply(!is.na(foo$org), foo$yr, sum)
1998 1999 2000
   442

Or perhaps the number of unique non-NA divisions and organizations in 
the data for each year?

 tapply(foo$div, foo$yr, function(x) length(na.omit(unique(x
1998 1999 2000
   042
 tapply(foo$org, foo$yr, function(x) length(na.omit(unique(x
1998 1999 2000
   442

(I don't understand where the 3 in your desired output comes from 
though, which maybe indicates I completely misunderstand your request.)

Andy Bunn wrote:
I have a very simple query with regard to summarizing the number of factors
present in a certain snippet of a data frame.
Given the following data frame:
foo - data.frame(yr = c(rep(1998,4), rep(1999,4), rep(2000,2)), div =
factor(c(rep(NA,4),A,B,C,D,A,C)),
org = factor(c(1:4,1:4,1,2)))
I want to get two new variables. Object ndiv would give the number of
divisions by year:
 1998 0
 1999 3
 2000 2
Object norgs would give the number of organizations
 1998 4
 1999 4
 2000 2
I figure xtabs should be able to do it, but I'm stuck without a for loop.
Any suggestions? -Andy
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Summarizing factor data in table?

2005-04-26 Thread Andy Bunn
The three was a typo, which I regret very much. I don't know why I didn't
think of apply. I was obsessed with doing it as a table.
Thanks for your response,
-Andy

 -Original Message-
 From: Tony Plate [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 26, 2005 2:00 PM
 To: Andy Bunn
 Cc: R-Help
 Subject: Re: [R] Summarizing factor data in table?


 Do you want to count the number of non-NA divisions and organizations in
 the data for each year (where duplicates are counted as many times as
 they appear)?

   tapply(!is.na(foo$div), foo$yr, sum)
 1998 1999 2000
 042
   tapply(!is.na(foo$org), foo$yr, sum)
 1998 1999 2000
 442
  

 Or perhaps the number of unique non-NA divisions and organizations in
 the data for each year?

   tapply(foo$div, foo$yr, function(x) length(na.omit(unique(x
 1998 1999 2000
 042
   tapply(foo$org, foo$yr, function(x) length(na.omit(unique(x
 1998 1999 2000
 442
  

 (I don't understand where the 3 in your desired output comes from
 though, which maybe indicates I completely misunderstand your request.)

 Andy Bunn wrote:
  I have a very simple query with regard to summarizing the
 number of factors
  present in a certain snippet of a data frame.
  Given the following data frame:
 
  foo - data.frame(yr = c(rep(1998,4), rep(1999,4),
 rep(2000,2)), div =
  factor(c(rep(NA,4),A,B,C,D,A,C)),
  org = factor(c(1:4,1:4,1,2)))
 
  I want to get two new variables. Object ndiv would give the number of
  divisions by year:
   1998 0
   1999 3
   2000 2
  Object norgs would give the number of organizations
   1998 4
   1999 4
   2000 2
  I figure xtabs should be able to do it, but I'm stuck without a
 for loop.
  Any suggestions? -Andy
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 



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


Re: [R] Summarizing factor data in table?

2005-04-26 Thread Gabor Grothendieck
Actually it can be done with xtabs if that's the approach you prefer.
  foo$yr - factor(foo$yr)
 margin.table(xtabs(~ div + yr, foo), 2)
yr
1998 1999 2000 
0 4 2 
 margin.table(xtabs(~ org + yr, foo), 2)
yr
1998 1999 2000 
4 4 2 


 On 4/26/05, Andy Bunn [EMAIL PROTECTED] wrote: 
 
 The three was a typo, which I regret very much. I don't know why I didn't
 think of apply. I was obsessed with doing it as a table.
 Thanks for your response,
 -Andy
 
  -Original Message-
  From: Tony Plate [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, April 26, 2005 2:00 PM
  To: Andy Bunn
  Cc: R-Help
  Subject: Re: [R] Summarizing factor data in table?
 
 
  Do you want to count the number of non-NA divisions and organizations in
  the data for each year (where duplicates are counted as many times as
  they appear)?
 
   tapply(!is.na(foo$div), foo$yr, sum)
  1998 1999 2000
  0 4 2
   tapply(!is.na(foo$org), foo$yr, sum)
  1998 1999 2000
  4 4 2
  
 
  Or perhaps the number of unique non-NA divisions and organizations in
  the data for each year?
 
   tapply(foo$div, foo$yr, function(x) length(na.omit(unique(x
  1998 1999 2000
  0 4 2
   tapply(foo$org, foo$yr, function(x) length(na.omit(unique(x
  1998 1999 2000
  4 4 2
  
 
  (I don't understand where the 3 in your desired output comes from
  though, which maybe indicates I completely misunderstand your request.)
 
  Andy Bunn wrote:
   I have a very simple query with regard to summarizing the
  number of factors
   present in a certain snippet of a data frame.
   Given the following data frame:
  
   foo - data.frame(yr = c(rep(1998,4), rep(1999,4),
  rep(2000,2)), div =
   factor(c(rep(NA,4),A,B,C,D,A,C)),
   org = factor(c(1:4,1:4,1,2)))
  
   I want to get two new variables. Object ndiv would give the number of
   divisions by year:
   1998 0
   1999 3
   2000 2
   Object norgs would give the number of organizations
   1998 4
   1999 4
   2000 2
   I figure xtabs should be able to do it, but I'm stuck without a
  for loop.
   Any suggestions? -Andy
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
  
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


[[alternative HTML version deleted]]

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


RE: [R] good editor for R sources ?

2005-04-26 Thread Liaw, Andy
 From: Rau, Roland
 
 Hi,
 
 
  -Original Message-
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of vincent
  (Sorry if the question has already been answered.)
  Could someone please suggest a good text editor for
  writing R sources ?
  (I know emacs exists ... but I find it a bit heavy).
  I use crimson (http://www.crimsoneditor.com) which is
  small and simple, but the R syntax seems not to be supported.
  Thanks for any advice
 
 although I prefer myself (X)Emacs, I suggest to people Tinn-R, it is
 GPLed, has syntax highlighting, and something I haven't seen with any
 other editor before:
 You write for example:
 mydata - read.table(.csv, header=TRUE, )
 and while you are writing your code, a line pops up below the line you
 are writing giving you the arguments and their default values for the
 current function (I was impressed, I have to admit).

I believe the builtin editor in JGR can do that, too.

Andy

 
 The homepage of this project is:
 http://www.sciviews.org/Tinn-R/
 
 Best,
 Roland
 
 
 +
 This mail has been sent through the MPI for Demographic 
 Rese...{{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
 
 


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


[R] PCA model

2005-04-26 Thread Frédéric Ooms
Hi,
Another newbie question. Once I have generated a PCA model using the princomp 
command how can i use it to display a new dataset ?
Thanks for your help
Fred

[[alternative HTML version deleted]]

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


Re: [R] PCA model

2005-04-26 Thread Prof Brian Ripley
It has a predict method, and ?predict points you to it.
predict() is the usual way to apply a model to new data: see `An 
Introduction to R' or any good book on S/R.

On Tue, 26 Apr 2005, Frédéric Ooms wrote:
Another newbie question. Once I have generated a PCA model using the princomp 
command how can i use it to display a new dataset ?
Thanks for your help
[[alternative HTML version deleted]]
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
As in the comment about HTML mail!
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] how to add a column with string values to a data frame while still converting them to factors

2005-04-26 Thread avneet singh
I have 2 questions. In essence i am trying to create product
categories based on product description and have it as an additional
column of my dataframe. some products dont fit any category and i need
a list of them. i am having some trouble in this simple (for most)
task.
Could you please provide suggestions. Thank you. 

avneet

Question 1)

I have a data frame 

agm.data=read.xls(agm.xls)

i add a column to it by this and similar statements
agm.data$ProdCategory[agm.data$Product.Description==PGX|agm.data$Product.Description==PGW|agm.data$Product.Description==PS|agm.data$Product.Description==PSX]=Molded
Graphite

if i do 
agm.data$ProdCategory

i get:

  [1] Extruded Graphite   Molded Graphite Molded Graphite
   [4] Extruded Graphite   Extruded Graphite   NA   
   [7] Molded Graphite Extruded Graphite   Extruded Graphite  
  [10] Extruded Graphite   Extruded Graphite   Extruded Graphite  
  [13] Extruded Graphite   Porous  Iso-Molded Graphite
.
.
.
.
.
[1222] Extruded Graphite   Molded Graphite Extruded Graphite  
[1225] Extruded Graphite   Extruded Graphite   NA   
[1228] Iso-Molded Graphite Extruded Graphite   NA  

if i check the class, i get
is(agm.data$ProdC)
[1] character vector  

i want this to have..
[1] factor   oldClass

..like other columns have



Question 2)some values of agm.data$ProdCategory are NA. i want to find
corresponding values of agm.data$Product.Description so i give the
following command
agm.data$Product.Description[agm.data$ProdCategory==NA]

i get:

[1] NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA
 [17] NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA
.
.
.
.
.
.
[257] NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA
[273] NA NA NA NA NA
165 Levels:  1.563x24 10x50x60 61x1.25 6x72 890S 8x6 9x7; 10x1.5 AGR ... YBDXX88


-- 
God created man because he was disappointed over the apes. After that he has
given up any further experiments ~Mark Twain

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


Re: [R] good editor for R sources ?

2005-04-26 Thread Paul Smith
On 4/26/05, Uwe Ligges [EMAIL PROTECTED] wrote:
  (Sorry if the question has already been answered.)
  Could someone please suggest a good text editor for
  writing R sources ?
  (I know emacs exists ... but I find it a bit heavy).
  I use crimson (http://www.crimsoneditor.com) which is
  small and simple, but the R syntax seems not to be supported.
 
 See http://www.sciviews.org/_rgui/projects/Editors.html
 The page tells us that there is support for Crimson editor.

And for Linux, what do you recommend?

Paul

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


RE: [R] good editor for R sources ?

2005-04-26 Thread Liaw, Andy
 From: Paul Smith
 
 On 4/26/05, Uwe Ligges [EMAIL PROTECTED] wrote:
   (Sorry if the question has already been answered.)
   Could someone please suggest a good text editor for
   writing R sources ?
   (I know emacs exists ... but I find it a bit heavy).
   I use crimson (http://www.crimsoneditor.com) which is
   small and simple, but the R syntax seems not to be supported.
  
  See http://www.sciviews.org/_rgui/projects/Editors.html
  The page tells us that there is support for Crimson editor.
 
 And for Linux, what do you recommend?

There are suggestions on that page that Uwe mentioned above for Linux!
First choice would be (X)Emacs/ESS.  Then there are also vim, kate,
bluefish, ...

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


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


[R] Re: how to add a column with string values to a data frame while still converting them to factors

2005-04-26 Thread avneet singh
i got the first part:

agm.data$ProdCategory=as.factor(agm.data$ProdCategory)

the second i am still struggling with


On 4/26/05, avneet singh [EMAIL PROTECTED] wrote:
 I have 2 questions. In essence i am trying to create product
 categories based on product description and have it as an additional
 column of my dataframe. some products dont fit any category and i need
 a list of them. i am having some trouble in this simple (for most)
 task.
 Could you please provide suggestions. Thank you.
 
 avneet
 
 Question 1)
 
 I have a data frame
 
 agm.data=read.xls(agm.xls)
 
 i add a column to it by this and similar statements
 agm.data$ProdCategory[agm.data$Product.Description==PGX|agm.data$Product.Description==PGW|agm.data$Product.Description==PS|agm.data$Product.Description==PSX]=Molded
 Graphite
 
 if i do
 agm.data$ProdCategory
 
 i get:
 
   [1] Extruded Graphite   Molded Graphite Molded Graphite
[4] Extruded Graphite   Extruded Graphite   NA
[7] Molded Graphite Extruded Graphite   Extruded Graphite
   [10] Extruded Graphite   Extruded Graphite   Extruded Graphite
   [13] Extruded Graphite   Porous  Iso-Molded Graphite
 .
 .
 .
 .
 .
 [1222] Extruded Graphite   Molded Graphite Extruded Graphite
 [1225] Extruded Graphite   Extruded Graphite   NA
 [1228] Iso-Molded Graphite Extruded Graphite   NA
 
 if i check the class, i get
 is(agm.data$ProdC)
 [1] character vector
 
 i want this to have..
 [1] factor   oldClass
 
 ..like other columns have
 
 Question 2)some values of agm.data$ProdCategory are NA. i want to find
 corresponding values of agm.data$Product.Description so i give the
 following command
 agm.data$Product.Description[agm.data$ProdCategory==NA]
 
 i get:
 
 [1] NA NA NA NA NA NA NA NA NA NA NA NA NA
 NA NA NA
  [17] NA NA NA NA NA NA NA NA NA NA NA NA NA
 NA NA NA
 .
 .
 .
 .
 .
 .
 [257] NA NA NA NA NA NA NA NA NA NA NA NA NA
 NA NA NA
 [273] NA NA NA NA NA
 165 Levels:  1.563x24 10x50x60 61x1.25 6x72 890S 8x6 9x7; 10x1.5 AGR ... 
 YBDXX88
 
 --
 God created man because he was disappointed over the apes. After that he has
 given up any further experiments ~Mark Twain
 


-- 
God created man because he was disappointed over the apes. After that he has
given up any further experiments ~Mark Twain

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


[R] how to modify and compile R sourse codes

2005-04-26 Thread Zhongming Yang
Dear All:
 
I am working on writing some R functions to make statistical reports 
automatically. Dr. Harrell's Hmisc has all the wonderful stuff. But sometimes I 
need change some formats,  so I want to read through it and make some 
modifications to fit my project. 
 
Ideally, I want proceed as following:
1. change some source of Hmisc
2. compile and install the modified Hmisc
3. debug my modified functions.
 
And I am working on windows 2000.
 
Could anyone give some suggestions on the tools and the best way to do this?
 
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


[R] Problem with clipping in Lattice, and closing a postscript device

2005-04-26 Thread VU HA
I would appreciate any answer to the following two problems I am having with 
the Lattice package.

First, in most instances of using Lattice, the produced graphs have some 
clipping, usually at the borders of the encompassing rectangles. An example 
of this is here: http://cs.uwm.edu/~vu/lattice.pdf where the clipping occurs 
in the first half of the X axis.

Second, when printing to a postscript file, for example, using the command
trellis.device(postscript, file = test.ps, color = TRUE)
to initialize the output file and then the command
dotplot(y ~ x | z, ...)
to draw the graph, the postscript file test.ps still has zero size. If at 
this point I quit R, then test.ps will contain the output graphics. Is there 
a way to flush the trellis device without exiting R?

Thank you very much in advance.
Vu Ha, PhD.
Information and Decision Technology
Honeywell Aerospace
3660 Technology Dr.
Minneapolis, MN 55418
612-951-7114
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with clipping in Lattice, and closing a postscript device

2005-04-26 Thread Deepayan Sarkar
On Tuesday 26 April 2005 15:27, VU HA wrote:
 I would appreciate any answer to the following two problems I am
 having with the Lattice package.

 First, in most instances of using Lattice, the produced graphs have
 some clipping, usually at the borders of the encompassing rectangles.
 An example of this is here: http://cs.uwm.edu/~vu/lattice.pdf where
 the clipping occurs in the first half of the X axis.

I've never seen this type of problem before. I suspect using dev.off() 
as described below would solve this too.

 Second, when printing to a postscript file, for example, using the
 command

 trellis.device(postscript, file = test.ps, color = TRUE)

 to initialize the output file and then the command

 dotplot(y ~ x | z, ...)

 to draw the graph, the postscript file test.ps still has zero size.
 If at this point I quit R, then test.ps will contain the output
 graphics. Is there a way to flush the trellis device without
 exiting R?

You have to use 

dev.off()

to properly finish creating a graphics file (this is true for R graphics 
in general, not just lattice).

Deepayan

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


Re: [R] good editor for R sources ?

2005-04-26 Thread Paul Smith
On 4/26/05, Liaw, Andy [EMAIL PROTECTED] wrote:
(Sorry if the question has already been answered.)
Could someone please suggest a good text editor for
writing R sources ?
(I know emacs exists ... but I find it a bit heavy).
I use crimson (http://www.crimsoneditor.com) which is
small and simple, but the R syntax seems not to be supported.
  
   See http://www.sciviews.org/_rgui/projects/Editors.html
   The page tells us that there is support for Crimson editor.
 
  And for Linux, what do you recommend?
 
 Tere are suggestions on that page that Uwe mentioned above for Linux!
 First choice would be (X)Emacs/ESS.  Then there are also vim, kate,
 bluefish, ...

Thanks, Andy. Does somebody know how to install ess on xemacs?

Paul

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


[R] survreg with numerical covariates

2005-04-26 Thread Richard Mott
Does anyone know if the survreg function in the survival package can fit 
numerical covariates ?

When I fit a survival model of the form
survreg( Surv(time,censored) ~ x )
then x is always treated as a factor even if it is numeric (and even if 
I try to force it to be numeric using as.numeric(x). Thus, in the 
particular example I am analysing, a simple numerical covariate becomes 
a factor with 190 levels. Is this the expected behaviour ? Am I doing 
something wrong ?

I am running R 2.0.1 on a 64bit Debian Linux system, and version 2.17 of 
the survival package

Thanks
Richard Mott
--

Richard Mott   | Wellcome Trust Centre
tel 01865 287588   | for Human Genetics
fax 01865 287697   | Roosevelt Drive, Oxford OX3 7BN
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Finding 'ncp' for t

2005-04-26 Thread Ted Harding
On 26-Apr-05 Peter Dalgaard wrote:
 (Ted Harding) [EMAIL PROTECTED] writes:
 
 Hi Folks,
 
 I'm looking for a neat procedure for the following:
 
 Given t0 such that
 
   pt(t0,df,ncp=0) = alpha (given)
 
 find ncp0 such that for given beta
 
   pt(t0,df,ncp=ncp0) = (1 - beta)
 
 (In other words, what's the ncp such that you get power (1-beta)
 to detect it, using a 1-sided test with size alpha when ncp = 0?)
 
 In the past I've done the groping by hand, but this time it
 needs to be done many times over, so a good solver for ncp0
 in this situation would be handy.
 
 You might want to peek inside power.t.test(). Or just use it...

Thanks for reminding me of this, Peter. It can be persuaded to
do what I want!

Also to Rolf Turner for his suggestion.

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Apr-05   Time: 20:13:16
-- 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


Re: [R] good editor for R sources ?

2005-04-26 Thread A.J. Rossini
On 4/26/05, Paul Smith [EMAIL PROTECTED] wrote:
 On 4/26/05, Liaw, Andy [EMAIL PROTECTED] wrote:
 (Sorry if the question has already been answered.)
 Could someone please suggest a good text editor for
 writing R sources ?
 (I know emacs exists ... but I find it a bit heavy).
 I use crimson (http://www.crimsoneditor.com) which is
 small and simple, but the R syntax seems not to be supported.
   
See http://www.sciviews.org/_rgui/projects/Editors.html
The page tells us that there is support for Crimson editor.
  
   And for Linux, what do you recommend?
 
  Tere are suggestions on that page that Uwe mentioned above for Linux!
  First choice would be (X)Emacs/ESS.  Then there are also vim, kate,
  bluefish, ...
 
 Thanks, Andy. Does somebody know how to install ess on xemacs?

It comes with ESS built-in if you get the full distribution.  But
this would be better asked on the ess-help list.


best,
-tony

Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes (AJR, 4Jan05).

A.J. Rossini
[EMAIL PROTECTED]

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


Re: [R] mantelhaen.test for more than two groups?

2005-04-26 Thread Francisco J. Zagmutt
How about using logistic regression?  When you have K dimensional tables and 
several potential confounders it might be better to go for a multivariable 
model. Take a look at function glm(stats) and lrm(Design).

Cheers
Francisco
From: Peter Dalgaard [EMAIL PROTECTED]
To: Thomas Lumley [EMAIL PROTECTED]
CC: Katrin Schweitzer [EMAIL PROTECTED],
r-help@stat.math.ethz.ch
Subject: Re: [R] mantelhaen.test for more than two groups?
Date: 26 Apr 2005 18:24:31 +0200

Thomas Lumley [EMAIL PROTECTED] writes:
 On Tue, 26 Apr 2005, Katrin Schweitzer wrote:

  Dear All,
 
  I'd like to perform the generalized Cochran-Mantel-Haenszel-Test (as
  described in Agresti (1990), Categorical Data Analysis) for my
  nominal data.
 
  My problem is that I have more than two groups. In fact I think I'd
  need an 5-dimensional array for the response variable, the control
  variable and three group variables.
  Could you please tell me if this is possible in R - and if yes how I
  am supposed to do this?

 You're supposed to have a three-dimensional array: exposure x response
 x group.

 This means turning your three group variables into one variable.  One
 way to do this is with the interaction() function.
Or, if data are already counts, change the dimensions (as in dim(x) -
c(2,3,8)), possibly after using aperm() to get the indices in the
right order.
--
   O__   Peter Dalgaard Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error in nonlinear mixed-effects model

2005-04-26 Thread Douglas Bates
Revilla,AJ (pgt) wrote:
Dear all,
I am trying to fit a mixed-effects non linear regression, but I have
some trouble with it. My data are a balanced panel of 904 subjects
with 8 observations (at regular periods) per subject. The functional
form of my model is Y=Aexp(-BX1)X2 +e. I want to allow parameters A
and B to vary among subjects and also include an autocorrelation
term. I have already fitted a standard nonlinear regression to the
data, but I keep having problems with NLME.
I have defined my data as a groupedData object, and when I try to fit
the model I get this error message:
dat-groupedData(V~VAC|ID,data=dat) 
 attach(dat)
I don't think that attach'ing a groupedData object will propagate the 
grouping factors.  I suggest that you avoid the construction of the 
groupedData object and also that you avoid attaching and detaching data 
frames.  Just use

 mod - nlme(V~A*exp(B*YEAR)*VAC, dat, fixed=A+B~1, random=A+B~1|ID, 
correlation=corCAR1(), start=c(A=1.2,B=0.2))

You will also need to specify a formula for the corAR1 constructor.  My 
guess is form = ~ YEAR | ID but you will need to decide if that is what 
you intend.  Check the help page for corAR1 to see the list of possible 
arguments.

Error in
getGroups.data.frame(dataMix, eval(parse(text = paste(~1,
deparse(groups[[2]]),  : Invalid formula for groups
Do you have any clue of whats happening? Its the first time I fit a
model like this in R, so the problem is probably pretty obvious, but
I cannot see it.
Thank you very much,
Antonio
__ 
R-help@stat.math.ethz.ch mailing list 
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the
posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] making table() work

2005-04-26 Thread Stephen Choularton
I am trying to do some verification across a large dataset, cuData, that
has 23 columns.
 
Column 23 (similarity) is the outcome 0 or 1 and the other columns are
the features.
 
I do this:
 
verificationglm.model - glm(formula = similarity ~ ., family=binomial,
data=cuData[1:1000,])
 
and produce the model:
 
 summary(verificationglm.model)
 
Call:
glm(formula = similarity ~ ., family = binomial, data = cuData[1:1000, 
])
 
Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-2.3885  -0.8943  -0.2918   0.8851   2.7025  
 
Coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept)   26.3112869 21.2229690   1.240 0.215066
length-0.6249415  0.1906254  -3.278 0.001044 ** 
meanPitch -0.0110389  0.0053083  -2.080 0.037565 *  
minimumPitch   0.0002689  0.0024290   0.111 0.911845
maximumPitch  -0.0013454  0.0038149  -0.353 0.724326
meanF1-0.0362153  0.0112499  -3.219 0.001286 ** 
meanF2 0.0016765  0.0115335   0.145 0.884430
meanF3 0.0073960  0.0076235   0.970 0.331964
meanF4 0.0063015  0.0016820   3.746 0.000179 ***
meanF5-0.0022535  0.0024885  -0.906 0.365153
ratioF2ToF1   -1.2322825  7.0036532  -0.176 0.860334
ratioF3ToF1   -4.9643148  4.5973552  -1.080 0.280222
jitter-8.7535283 14.5273818  -0.603 0.546806
shimmer1.6706067  2.6327972   0.635 0.525731
percentUnvoicedFrames -0.4863219  1.1638115  -0.418 0.676042
numberOfVoiceBreaks   -0.0335636  0.0634956  -0.529 0.597086
percentOfVoiceBreaks  -2.9353239  0.8945600  -3.281 0.001033 ** 
meanIntensity -0.2931293  0.3355314  -0.874 0.382321
minimumIntensity   0.0689654  0.1531059   0.450 0.652392
maximumIntensity   0.2186570  0.2510906   0.871 0.383848
ratioIntensity-8.1777871 13.1676287  -0.621 0.534565
noSyllsIntensity   0.1714826  0.0695021   2.467 0.013614 *  
speakingRate  -0.3564808  0.1507373  -2.365 0.018034 *  
startSpeech   -1.3537348  6.7337461  -0.201 0.840669
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
 
(Dispersion parameter for binomial family taken to be 1)
 
Null deviance: 1384.0  on 999  degrees of freedom
Residual deviance: 1084.7  on 976  degrees of freedom
AIC: 1132.7
 
Number of Fisher Scoring iterations: 5
 

 
Now I want to use the model to predict on a different part of the
dataset.
 
I try this, and get my prediction:
 
 
 pred - predict(verificationglm.model, cuData[1001:2000,1:23])
 pred
1001 1002 1003 1004 1005
1006 1007 
-0.495901722 -2.406349629 -0.911082179 -0.965869553 -0.488695693
-1.849622304 -1.637722247 
1008 1009 1010 1011 1012
1013 1014 
-1.148952722 -0.191538278 -1.511895046 -2.989036645 -2.775775622
0.603852124 -0.838613048 
1015 1016 1017 1018 1019
1020 1021 
-0.434259674 -2.004230065 -0.234829011  1.666502334  2.039631718
-0.592192326  1.667700087 
1022 1023 1024 1025 1026
1027 1028 
 0.104644531  1.748724399  0.391461247  1.356898357  1.468154760
1.090708994  1.071487227 
1029 1030 1031 1032 1033
1034 1035 
 0.720596788  2.378350706 -0.128248232  0.969373318  0.315142756
1.372108172 -2.399517898 
1036 1037 1038 1039 1040
1041 1042 
-0.684530171  0.761198819 -1.298372615  1.185368711 -1.148974059
0.358234433  0.671495255 
1043 1044 1045 1046 1047
1048 1049 
 0.683771224  0.663767266  2.009012643  0.196591464  2.063417812
0.823472345  0.696638161
 
[runs on to 2000]
 
However, I then want to check for classAgreement (an e1701 package
function).  First I want a table. I do this:
 
 t = table(pred,cuData[1001:2000,24])
 t
  
pred   0 1
  -8.900700989801060 1
  -8.0484071844879 0 1
  -7.792985487755231 0
  -7.183383306090131 0
[runs on]
 
when I expect this
 
0 1
0  ??
1  ??
 
with the ?’s being some count.  When I look at my slice of cuData it
looks like this:
 
 cuData[1001:2000,24]
   [1] 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1
1 1 1 1
  [38] 1 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 0 0
0 1 1 0
  [75] 1 0 0 1 1 0 1 1 0 0 1 0 1 1 1 0 0 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 1
0 0 0 0
 [112] 0 1 1 1 0 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
 [149] 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1
0 1 0 0
 [186] 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1
1 1 0 1
 [223] 0 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0 0 1 1 1 1 1
1 1 1 0
 [260] 1 0 0 

[R] lattice plot problem!

2005-04-26 Thread Ivy_Li
Hello everybody,
Could I consult you two questions?
Recently I write some code about lattice plot.
1) bwplot function
I know the lattice default background color is grey and the box color 
is green, but I don't like the color. So I change the background color to white 
use the 

 trellis.device(bg=white) 

then I modify the 

 panel=function(...)
+{
+   panel.bwplot(col=black...)
+   }

But I find the the box color is still green, just change the color of 
point which is in the box, I guss it is the mean or median value of the data. 
So How to change the color of box, and how to change the shape of the point in 
the box. I want it like other boxplot, like a horizontal line.

2) In every lattices, I want to add a mean line of the group. I try the 

panel.abline(h)  

But I find in very lattice add the same line. Then I try the 
panel.linejoin etc. But I can not get my wish plot.

Could anyone help me to settle these problems?
Thanks very much!

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

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


[R] Time series indexes

2005-04-26 Thread Fernando Saldanha
I tried to assign values to specific elements of a time series and got
in trouble. The code below should be almost self-explanatory. I wanted
to assign 0 to the first element of x, but instead I assigned  zero to
the second element of x, which is not what I wanted. Is there a
function that will allow me to do this without going into index
arithmetic (which would be prone to errors)?

FS

 x- ts(c(1,2,3,4), start = 2)
 x
Time Series:
Start = 2 
End = 5 
Frequency = 1 
[1] 1 2 3 4
 x[2] - 0
 x
Time Series:
Start = 2 
End = 5 
Frequency = 1 
[1] 1 0 3 4

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


RE: [R] lattice plot problem!

2005-04-26 Thread Mulholland, Tom
Lattice is not my forte but here goes.

?panel.bwplot specifically notes that pch, col, cex: graphical parameters 
controlling the dot. If you look at the code for panel.bwplot you will see 
where the colours come from in which case you can probably set up your own 
colour scheme using trellis.par.set. 

If you are trying to change the symbol so that it is a small line that can be 
done using the pch parameter, however it sounds as if you are wanting to 
substitute the symbol for a line in which case you might have to write your own 
function. a good starting point would be the existing function. A quick look 
suggests to me that all you would have to do is to replace the stats$stats[3] 
code from grid.points to grid.lines.

Tom


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Behalf Of Ivy_Li
 Sent: Wednesday, 27 April 2005 10:53 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] lattice plot problem!
 
 
 Hello everybody,
   Could I consult you two questions?
   Recently I write some code about lattice plot.
 1) bwplot function
   I know the lattice default background color is grey and 
 the box color is green, but I don't like the color. So I 
 change the background color to white use the 
 
  trellis.device(bg=white) 
 
   then I modify the 
 
  panel=function(...)
 +{
 + panel.bwplot(col=black...)
 + }
   
   But I find the the box color is still green, just 
 change the color of point which is in the box, I guss it is 
 the mean or median value of the data. So How to change the 
 color of box, and how to change the shape of the point in the 
 box. I want it like other boxplot, like a horizontal line.
 
 2) In every lattices, I want to add a mean line of the group. 
 I try the 
 
 panel.abline(h)  
 
   But I find in very lattice add the same line. Then I 
 try the panel.linejoin etc. But I can not get my wish plot.
 
   Could anyone help me to settle these problems?
   Thanks very much!
 
 Best Regards!
 Ivy Li
 YMS in Production  Testing
 Semiconductor Manufactory International(ShangHai) Corporation
 #18 ZhangJiang Road, PuDong New Area, Shanghai, China
 Tel: 021-5080-2000 *11754
 Email: [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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