[R] Plot Point Labelling

2008-10-31 Thread Charles Liard
Hi,

Please tell me of an R graphical routine that will create a 3d plot
something like cloud or scatterplot3d but that allows individual
labeling of each point in the plot.  I've done it with SPSS.  I'm sure that
there is an R routine, but I can't find it.

I'm at: 
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Thanks!
Charles
Charles Liard 
CMHA Vancouver - Burnaby Branch
Tel: (604) 872 4902 
This email is intended only for the person to whom it was addressed (the
addressee) and may contain confidential and / or private material. Any
retransmission, dissemination, or other communication to a person other than
the addressee of this message is prohibited. If you received this email in
error, please contact the sender (or call 604 872 4902) and destroy all
copies of the message. 



[[alternative HTML version deleted]]

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


[R] A question about pairs()

2008-10-31 Thread Ian Sue Wing

Greetings R users,

I am an R graphics newbie trying to produce a custom trellis plot using 
pairs() with R 2.7.2.


I have spatial data on which I run a geographically weighted regression 
(gwr, using the -spgwr- package). I want to check the gwr coefficients 
for multicollinearity and spatial association, following Wheeler and 
Tiefelsdorf (2005), and I would like to summarize the results of this 
exercise using -pairs-.


My problem is that I want to generate figures for two groups of 
variables and then assemble them into a panel display. The first set of 
variables is the gwr coefficients, for which I want to generate x-y 
scatterplots. This is straightforward, and works fine. The second set of 
variables is the local correlation between the gwr coefficient 
estimates, which I want to plot as kernel densities. Is there any way to 
do this? I can do one or the other, but not both together.


For example:

data(columbus)
# compute gwr bandwidth
col.bw - gwr.sel(crime ~ income + housing, data=columbus, 
coords=cbind(columbus$x, columbus$y))

# estimate gwr
col.gauss - gwr(crime ~ income + housing, data=columbus, 
coords=cbind(columbus$x, columbus$y), bandwidth=col.bw, hatmatrix=TRUE)

# summarize gwr results
col.gauss
# compute local correlation matrix among gwr coefs
col.cor - gw.cov(col.gauss$SDF,vars=2:4,bw=col.bw,cor=T,longlat=F)
# extract gwr coefficients and local correlations
col.gauss.mat - as(col.gauss$SDF, data.frame)[,2:4]
col.cor.mat - as(col.cor$SDF, data.frame)[,16:18]
# define correlation function for use by -pairs-
panel.cor - function(x,y,digits=4)
{
   r = (cor(x,y,use=pairwise))
   txt - format(c(r, 0.123456789), digits=digits)[1]
   text(0.5, 0.5, txt)
}
# show gwr results: works fine, except that text positioning is screwed up
pairs(col.gauss.mat,
   upper.panel=panel.smooth,
   lower.panel=panel.cor,
   labels=c(Intercept,Income,Housing))
# show gwr local correlations: works fine, except that text positioning 
is screwed up

pairs(col.cor.mat,
   upper.panel=panel.smooth,
   lower.panel=panel.cor,
   labels=c(Intercept,Income,Housing))

# My problem is with the following function...

panel.dis - function(...)
{
   if(panel.number()==4) dist - lines(density(col.cor.mat[,1]))
   if(panel.number()==7) dist - lines(density(col.cor.mat[,2]))
   if(panel.number()==8) dist - lines(density(col.cor.mat[,3]))
}

pairs(col.gauss.mat,
   upper.panel=panel.smooth,
   lower.panel=panel.dis,
   labels=c(Intercept,Income,Housing))


The last -pairs- call terminates with the following error:

Error in if (panel.number() == 4) dist - lines(density(col.cor.mat[,  :
 argument is of length zero

I thought I could address panels in this way using the panel.number() 
function. I would very much appreciate it if someone could let me know 
what I am doing wrong. Should I not use -pairs- at all? The problem is 
that I'd like the plots to line up nicely.


-i

--
Ian Sue Wing  675 Commonwealth Ave., Boston MA 02215
Associate Professor   Tel: (617) 353-5741
Dept. of Geography  Environment  Fax: (617) 353-5986
Boston University Web: http://people.bu.edu/isw

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


Re: [R] PAM: how to get the best number of clusters

2008-10-31 Thread Maura E Monville
I have the book you mentioned. It basically describes the silhouette method.
I do not have it handy as I moved so it is still in some box. However I
cannot remember that book providing any other criterion to find the best
clusters number.
On the other hand I have the same problem with hierarchical clustering
techniques.
I use clusters as exploratory analysis because I do not have any a-priori
knowledge that helps me make a choice.
How can multivariate analysis help?
I launched a loop where the silhouette test follows PAM which is passed a
clusters number increased by 1 at each iteration.
Since I am observing that the silhouette value is now oscillating among
negative numbers, I wonder whether I can assume that it can only grow worse
once it has turned negative the first time so leave the loop after the first
negative number and choose the clusters number associated with the biggest
positive silhouette value.
This procedure would spare a lot of CPU time.

Thank you very much,
Maura

On Thu, Oct 30, 2008 at 7:25 PM, Dylan Beaudette
[EMAIL PROTECTED]wrote:

 On Thursday 30 October 2008, Maura E Monville wrote:
  I have a pretty big similarity matrix (2870x2870). I will produce even
  bigger ones soon.
  I am using PAM to generate clusters.
  The desired number of output clusters is a PAM input parameter.
  I do not know  a-priopri what is the best clusters layout .
  I resorted to the silhouette test. It takes forever as I have to run PAM
  with all possible
  numbers of clusters.
  I wonder whether there is some faster method, either a s/w code or some
  theoretical guidelines,
  to get the optimum clusters number.
 
  Thank you very much,

 This is a very general topic in the field of multivariate analysis. There
 really isn't any way to know the 'correct' number of clusters, however
 there
 are several metrics that can give you an indication of how messy your data
 are.

 For information on the methods in the cluster package, see this book:

 Kaufman, L.  Rousseeuw, P. J. Finding Groups in Data An Introduction to
 Cluster Analysis Wiley-Interscience, 2005

 Otherwise, consider a book on multivariate analysis. Alternatively, try a
 hierarchical clustering approach, and look for meaningful groupings. Some
 thing like this:

 d - diana(daisy(your_data_matrix))
 d.hc - as.hclust(d)

 d.hc$labels - your_data_matrix$id

 plot(d.hc)

 Cheers,

 Dylan


 --
 Dylan Beaudette
 Soil Resource Laboratory
 http://casoilresource.lawr.ucdavis.edu/
 University of California at Davis
 530.754.7341




-- 
Maura E.M

[[alternative HTML version deleted]]

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


[R] Problems with R make - related to blas

2008-10-31 Thread William Hudspeth
Hello,


I am having problems installing R-2.7.2 on a maching running OpenSUSE
Linux 10.2. Initially, R couldn't find a Fortran compiler, so I
downloaded and installed compat-g77-3.3.5-38.i586.rpm. I then set
FPICFLAGS=fPIC in the config.site file.



I next configured using ./configure, with no errors.


When I run make, I get the following error:


make[3]: Entering directory `/usr/local/src/R-2.7.2/src/extra/blas'

make[4]: Entering directory `/usr/local/src/R-2.7.2/src/extra/blas'

g77 fPIC -g -c blas.f -o blas.o

g77: cannot specify -o with -c or -S and multiple compilations

make[4]: *** [blas.o] Error 1

make[4]: Leaving directory `/usr/local/src/R-2.7.2/src/extra/blas'

make[3]: *** [R] Error 2

make[3]: Leaving directory `/usr/local/src/R-2.7.2/src/extra/blas'

make[2]: *** [R] Error 1

make[2]: Leaving directory `/usr/local/src/R-2.7.2/src/extra'

make[1]: *** [R] Error 1

make[1]: Leaving directory `/usr/local/src/R-2.7.2/src'

make: *** [R] Error 1


I'd appreciate it if anyone could guide me around this problem...


Thanks, William

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


[R] R help for invoking nmmin()

2008-10-31 Thread DJadeChou

My code is as follows:

#include iostream
#include cmath
using namespace std;

#define MATHLIB_STANDALONE 1

extern C
{
#include R_ext/Applic.h
}

typedef struct TT{
double ** tempX;
double * tempY;
int tempN;
} TT, *MM;

double fn(int N, double * beta, void * ex){
double total = 0;
int i = 0,j = 0;
double * betaFn = new double[N];
MM tmp = (MM)ex;
for(i = 0; i  N; i++)
{
betaFn[i] = exp(beta[i]);
}
for(j = 0; j  tmp-tempN; j++) {
double temp = 0;
for(i = 0; i  N; i ++) {
temp += tmp-tempX[j][i] * betaFn[i];
}
total += pow(tmp-tempY[j] - temp,2);
}
return total;
}
void mgr(int, double *, double *, void *){}

int main()
{
//coutpchisq(2,7,1,0)endl;
//cout  qnorm(0.7, 0.0, 1.0, 0, 0)  endl;

int n = 5;
double *dpar, *opar;
int fncount, fail;
dpar = new double [n];
opar = new double [n];
dpar[0] = 13.67318;
dpar[1] = 0;
dpar[2] = 17.02707;
dpar[3] = 0;
dpar[4] = 24.08231;
double value;
double abstol = 1e-16;
double intol = 1e-8;

int y = 12;
MM t = (MM)malloc(y*(n+2)*sizeof(TT));
t- tempX = new double * [y];
for(size_t ii = 0; ii  y; ii++) {
t-tempX[ii] = new double [n];
}

t-tempX[0][1] = -0.03;
t-tempX[1][1] = -0.02;
t-tempX[2][1] = -0.015;
t-tempX[3][1] = -0.01;
t-tempX[4][1] = -0.005;
t-tempX[5][1] = 0;
t-tempX[6][1] = 0.005;
t-tempX[7][1] = 0.01;
t-tempX[8][1] = 0.015;
t-tempX[9][1] = 0.02;
t-tempX[10][1] = 0.03;
t-tempX[11][1] = 0.04;
for(int ii = 0; ii  n; ii++) {
for(int yy = 0; yy  y; yy++)
t-tempX[yy][ii] = pow(t-tempX[yy][1], ii);
}

t- tempY = new double [y];
t-tempY[0] = 930862;
t-tempY[1] = 893736;
t-tempY[2] = 882721;
t-tempY[3] = 872066;
t-tempY[4] = 871729;
t-tempY[5] = 868550;
t-tempY[6] = 865100;
t-tempY[7] = 862132;
t-tempY[8] = 870266;
t-tempY[9] = 870493;
t-tempY[10] = 893980;
t-tempY[11] = 952914;

t-tempN = y;

cout  fn(n,dpar,(void*)t)endl;
nmmin(n, dpar, opar, value, fn,
   fail, abstol, intol, (void *)t,
   1, 0.5, 2, 0,
   fncount, 500);
for(int aa = 0 ; aa  n; aa++) {
cout opar[aa],;
}
cout\n;
return 0;   
}



I run this code, It told me  Segmentation fault. I dont know if the
parameter is wrong or not. 
Thank you very much.

DJade
-- 
View this message in context: 
http://www.nabble.com/R-help-for-invoking-nmmin%28%29-tp20258786p20258786.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Problems installing R-2.8.0 on Suse linux 10.1

2008-10-31 Thread William Hudspeth
Hello, I am trying to install R on Suse linux 10.1. To get configure to
run correctly, I had to set FPICFLAGS=fPIC.


R is now configured for i686-pc-linux-gnu

  Source directory:  .
  Installation directory:/usr/local

  C compiler:gcc -std=gnu99  -g -O2
  Fortran 77 compiler:   g77  -g

  C++ compiler:  g++  -g -O2
  Fortran 90/95 compiler:g77 -g
  Obj-C compiler:

  Interfaces supported:  X11
  External libraries:readline
  Additional capabilities:   PNG, JPEG, TIFF, iconv, MBCS, NLS
  Options enabled:   shared BLAS, R profiling, Java

  Recommended packages:  yes


When I then run make, I get:

make[3]: Entering directory `/usr/local/src/R-2.8.0/src/extra/blas'
make[4]: Entering directory `/usr/local/src/R-2.8.0/src/extra/blas'
g77  fPIC  -g -c blas.f -o blas.o
g77: cannot specify -o with -c or -S and multiple compilations
make[4]: *** [blas.o] Error 1
make[4]: Leaving directory `/usr/local/src/R-2.8.0/src/extra/blas'
make[3]: *** [R] Error 2
make[3]: Leaving directory `/usr/local/src/R-2.8.0/src/extra/blas'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/usr/local/src/R-2.8.0/src/extra'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/usr/local/src/R-2.8.0/src'
make: *** [R] Error 1


Help would be appreciated,

William

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


Re: [R] Plot Point Labelling

2008-10-31 Thread Felix Andrews
Check out panel.identify.cloud in the latest version of the lattice package.

E.g.

cloud(depth ~ lat * long, quakes)
trellis.focus()
panel.identify.cloud()


2008/10/31 Charles Liard [EMAIL PROTECTED]:
 Hi,

 Please tell me of an R graphical routine that will create a 3d plot
 something like cloud or scatterplot3d but that allows individual
 labeling of each point in the plot.  I've done it with SPSS.  I'm sure that
 there is an R routine, but I can't find it.

 I'm at:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 Thanks!
 Charles
 Charles Liard
 CMHA Vancouver - Burnaby Branch
 Tel: (604) 872 4902
 This email is intended only for the person to whom it was addressed (the
 addressee) and may contain confidential and / or private material. Any
 retransmission, dissemination, or other communication to a person other than
 the addressee of this message is prohibited. If you received this email in
 error, please contact the sender (or call 604 872 4902) and destroy all
 copies of the message.



[[alternative HTML version deleted]]

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




-- 
Felix Andrews / 安福立
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8

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


Re: [R] Convert windows package to Linux source package

2008-10-31 Thread Renaud Gaujoux
Indeed in the case of a lazy-loaded package it looks a bit tricky, but 
it should still be possible, as I guess one can access the source code 
of any function defined in a package, once loaded (am I wrong?).


When no lazy-load takes place then it is actually quite straight forward 
as you said Duncan:
- I looked into the merged Rd file, and the functions documentation 
appear embedded between as follows:

% --- Source file: function-name.Rd
...
...
\eof

So with some shell scripting (csplit, sed, ...) I succeeded in separate 
the single file into separate Rd files, named after the functions' names.
- the source files can be generated using package.skeleton on the R 
source files (remember no lazy-load, so plain and complete source code 
is directly available)
- then replace the generic Rd files generated by package.skeleton by the 
Rd files obtained from the merged Rd file.
- copy the original DESCRIPTION file into the source package directory, 
removing the 'Build' section.


In theory this works well, except if:

- the window packages Rd file contains error (!): I couldn't believe it 
but some of the Rd definitions where wrong (missing closing bracket, 
invalid tags (reference instead of references), invalid keywords, ...). 
Isn't it mandatory to have valid Rd files to be able to build a package 
with R CMD build?
- the package's dependencies are not defined in the original DESCRIPTION 
file. Isn't it also mandatory to specify if the package depends on other 
packages ? (because R CMD check can effectively detect the discrepancy 
between the field  DESCRIPTION:Dependencies and what is directly 
required by the package...)




Prof Brian Ripley wrote:

On Thu, 30 Oct 2008, Duncan Murdoch wrote:


On 10/30/2008 10:50 AM, Renaud Gaujoux wrote:

Hi,

is there a simple way, I mean a utility that converts a windows 
package (.zip file) to a Linux source package (tar.gz or even simply 
extract the source code and Rd files needed to run successfully a R 
CMD check).
The windows package doesn't have any external lib, C code, etc..., 
just plain R code, so in theory it is quite straight forward 
(extract the code from the functions, and re-separate the Rd files 
from the man directory.


Any idea?


No, no such utility exists as far as I know.  But as you say, it 
should be relatively straightforward to write one:  the Rd files are 
concatenated and compressed into man/pkg.Rd.gz, and the R files are 
concatenated into R/pkg.


Not if lazy-loading is used (and it normally is).  But what really is 
wrong with Roger Koenker's suggestion: 'unzip -a' the .zip into a 
library directory?  It will most likely work (the reverse does: zip up 
on Linux, unzip on Windows).


You just need to watch out for comments in the files that will be 
mistaken for separators.


I think that is safe enough in Rd files, as we process the 
concatenated versions.



Duncan Murdoch

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

and provide commented, minimal, self-contained, reproducible code.





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


Re: [R] Problems installing R-2.8.0 on Suse linux 10.1

2008-10-31 Thread Prof Brian Ripley

On Thu, 30 Oct 2008, William Hudspeth wrote:


Hello, I am trying to install R on Suse linux 10.1. To get configure to
run correctly, I had to set FPICFLAGS=fPIC.


FPICFLAGS=-fPIC would have been correct (or -fpic).  It is odd that 
FFLAGS has been set to -g and not '-g -O2': did you change that?  And also 
odd that FC has been set to g77, which is not a Fortran 90/95 compiler.


Your problem was a direct result of your incorrect setting.  However, I am 
rather surprised that any change was needed, as R's configure correctly 
finds FPICFLAGS on many Linux systems, and I am sure has in the past on 
Suse 10.1.




R is now configured for i686-pc-linux-gnu

 Source directory:  .
 Installation directory:/usr/local

 C compiler:gcc -std=gnu99  -g -O2
 Fortran 77 compiler:   g77  -g

 C++ compiler:  g++  -g -O2
 Fortran 90/95 compiler:g77 -g
 Obj-C compiler:

 Interfaces supported:  X11
 External libraries:readline
 Additional capabilities:   PNG, JPEG, TIFF, iconv, MBCS, NLS
 Options enabled:   shared BLAS, R profiling, Java

 Recommended packages:  yes


When I then run make, I get:

make[3]: Entering directory `/usr/local/src/R-2.8.0/src/extra/blas'
make[4]: Entering directory `/usr/local/src/R-2.8.0/src/extra/blas'
g77  fPIC  -g -c blas.f -o blas.o
g77: cannot specify -o with -c or -S and multiple compilations
make[4]: *** [blas.o] Error 1
make[4]: Leaving directory `/usr/local/src/R-2.8.0/src/extra/blas'
make[3]: *** [R] Error 2
make[3]: Leaving directory `/usr/local/src/R-2.8.0/src/extra/blas'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/usr/local/src/R-2.8.0/src/extra'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/usr/local/src/R-2.8.0/src'
make: *** [R] Error 1


Help would be appreciated,

William

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



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

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


Re: [R] Suppressing internal grid in filled.contour

2008-10-31 Thread Dieter Menne
Martin Maechler maechler at stat.math.ethz.ch writes:

 Yes, indeed, PDFs *are* fine

Apologies to the original poster, I was not aware of this.

Dieter

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


[R] Problem of running R console from Java on linux box

2008-10-31 Thread ZhaoWei
Hi the list:

  I can not create R process from Java application with my linux box, 
the process never was created, or just terminated immediately after I
called Runtime.getRuntime().exec(...)

  The command lines I have tried are(the paths are all correct):

  /bin/sh /usr/bin/R
  /bin/sh -c /usr/bin/R
  /usr/lib/R/bin/exec/R(also set R_HOME=/usr/lib/R)

  I also tried ProcessBuilder, which is no help. I'm confused, is this
possible?

Many Thanks!

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


Re: [R] package pls

2008-10-31 Thread Bjørn-Helge Mevik
tsn4867 [EMAIL PROTECTED] writes:

For the package pls, I need to understand the algorithm for simpls.fit
 for Partial Least Squares. I'm not sure if simpls.fit tries to find the
 weight vectors (loadings) to maximize which of the two:  Cov(Xw, y) or
 maximize Cov^2(Xw,y)? Are these objective functions equivalent? (in some
 texts, they use the first and in other texts, they use the second
 obj. function.). I think the algorithm for simpls.fit is using Cov(Xw,y).
 Also, can you give me some references where they state the equivalency of
 the two obj. functions?

The implementation in simpls.fit follows the algorithm in

 de Jong, S. (1993) SIMPLS: an alternative approach to partial
 least squares regression.  _Chemometrics and Intelligent
 Laboratory Systems_, *18*, 251-263.

(up to simplifications and performance changes).  I don't recall if the
criterion was cov or cov^2, but I believe they should be identical (up
to sign).

-- 
Bjørn-Helge Mevik

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


[R] how to retrieve some records from a dataframe

2008-10-31 Thread Kurapati, Ravichandra (Ravichandra)
Hi ,

 

 Dataframe  Df contains more than 30 no of records.but I want only
first 30 rows of data.

 

How can I retrieve it. 

 

Thanks

K.Ravichandra

 

 


[[alternative HTML version deleted]]

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


Re: [R] FW: Re: linux batch question

2008-10-31 Thread Martin Maechler
 ML == Mark Leeds [EMAIL PROTECTED]
 on Wed, 29 Oct 2008 17:13:04 -0500 (CDT) writes:

ML Hi Phil: That's EXACTLY what it is. Thanks so much. It's nice to know 
ML that the R Gods don't hate me. I hope it's okay that I'm going to cc 
ML r-help
ML in case this thread comes up in the future and also so that other 
people 
ML who might want to help know that it's solved. Thanks again.

another note below,  just for the archives i.e. future reference:


ML On Wed, Oct 29, 2008 at  5:01 PM, Phil Spector wrote:

 Mark:
 
 delete workspace? (y/n):  print(test of batch\n)
 
 It looks like you've got something in your .Rprofile or .First
 that's causing R to prompt you about saving your workspace, and
 it's interpreting your program as that response.
 
 Try
 
 R --no-save --vanilla CMD BATCH test.r test.out

A mini-remark:
I'd recommend *dropping* the final  'test.out',
such that R will automatically use   test.Rout
and the *.Rout ending is automagically recognized by an
ESS-enabled emacs [as R Transcript file]  and maybe similarly
by other R-aware editors.

Martin


 - Phil

 On Wed, 29 Oct 2008, [EMAIL PROTECTED] wrote:
 
 I usually just run my R programs at the R command prompt but for my 
 latest one I want to save any output that gets written to the screen 
 so I am
 trying to use R CMD BATCH and send the output to an output file. I 
 realize I could use sink at the prompt but I'd rather try to do it 
 this way
 because I know that I used to do this in S+.
 
 So, I wrote a simple one line program called test.R which is below.
 
 print(test of batch\n)
 
 Then I did
 
 R CMD BATCH temp.R temp.out
 
 temp.out which is shown below then ends up containing all my loading 
 up messages  and a proc.time statement at the very bottom  but not 
 the print statement itself ? Does someone know what I'm doing wrong. 
 I've looked around but I can't find anything that answers my 
 question. My sessionInfo() is at ther very bottom of this email. 
 Thanks.



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


Re: [R] how to retrieve some records from a dataframe

2008-10-31 Thread nalluri pratap
Df[1:30,]

--- On Fri, 31/10/08, Kurapati, Ravichandra (Ravichandra) [EMAIL PROTECTED] 
wrote:

From: Kurapati, Ravichandra (Ravichandra) [EMAIL PROTECTED]
Subject: [R] how to retrieve some records from a dataframe
To: r-help@r-project.org
Date: Friday, 31 October, 2008, 2:14 PM

Hi ,

 

 Dataframe  Df contains more than 30 no of records.but I want only
first 30 rows of data.

 

How can I retrieve it. 

 

Thanks

K.Ravichandra

 

 


[[alternative HTML version deleted]]

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



  Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/
[[alternative HTML version deleted]]

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


Re: [R] Goto loop

2008-10-31 Thread Peter Dalgaard
megh wrote:
 Is there anything like goto loop, which exists in most computer programs?
 e.g. I am looking for this kind of stuff :
 
 if(i  6) goto step-02
 
 Any idea?
 
 Regards,

It doesn't exist, but it can always be replaced by if() {} else {}
constructs. (You don't usually see goto in the class of functional
programming languages to which R belongs.  See also
http://en.wikipedia.org/wiki/Edsger_W._Dijkstra .)

R does have break, next, and return() which cover some common cases
where goto might be used with some reason.

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

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


[R] Row and Column positions

2008-10-31 Thread Shubha Vishwanath Karanth
Hi R,

 

m=data.frame(a=c(1,NA,5,5),b=c(4,5,6,7),c=c(NA,NA,NA,5))

 

I want to know the methods of getting row and column positions of NA in
the above dataframe. How do I do this?

 

 

Thanks, Shubha

 

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

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


Re: [R] Row and Column positions

2008-10-31 Thread Claudia Beleites
Am Freitag 31 Oktober 2008 12:17:30 schrieb Shubha Vishwanath Karanth:
 m=data.frame(a=c(1,NA,5,5),b=c(4,5,6,7),c=c(NA,NA,NA,5))

? which

HTH Claudia

-- 
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 (0 40) 5 58-34 47
email: [EMAIL PROTECTED]

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


[R] *** buffer overflow detected ***: /usr/lib64/R/bin/exec/R terminated on R 2.6.2 to 2.8.0: logging a bug?

2008-10-31 Thread Corrado
Dear friends,

there is a serious problem with RODBC on R from 2.6.2 to 2.8.0 on a postgresql 
8.3 database.

Let's say we define an empty dsn called test, with user postgres and 
password none. We test the connection with another application, and it 
works properly.

When you call the database using RODBC, you get the following:

 odbcConnect(test,postgres,none)
*** buffer overflow detected ***: /usr/lib64/R/bin/exec/R terminated
=== Backtrace: =
/lib64/libc.so.6(__fortify_fail+0x37)[0x2ad38a3f4157]
/lib64/libc.so.6[0x2ad38a3f27e0]
/lib64/libc.so.6[0x2ad38a3f1db9]
/lib64/libc.so.6(_IO_default_xsputn+0x8e)[0x2ad38a379b5e]
/lib64/libc.so.6(_IO_vfprintf+0x3c22)[0x2ad38a351fa2]
/lib64/libc.so.6(__vsprintf_chk+0x9d)[0x2ad38a3f1e5d]
/lib64/libc.so.6(__sprintf_chk+0x80)[0x2ad38a3f1da0]
/usr/lib64/libodbcpsql.so.2(SQLGetInfo+0x973)[0x2ad38de11013]
/usr/lib64/libodbc.so.1(SQLGetInfo+0x624)[0x2ad38c5e91a4]
/usr/lib64/R/library/RODBC/libs/RODBC.so(RODBCGetInfo+0xbb)[0x2ad38c393a9b]
/usr/lib64/R/lib/libR.so[0x2ad389c2562d]
/usr/lib64/R/lib/libR.so(Rf_eval+0x6a1)[0x2ad389c4ef31]
/usr/lib64/R/lib/libR.so[0x2ad389c51dc3]
/usr/lib64/R/lib/libR.so(Rf_eval+0x474)[0x2ad389c4ed04]
/usr/lib64/R/lib/libR.so[0x2ad389c5014c]
/usr/lib64/R/lib/libR.so(Rf_eval+0x474)[0x2ad389c4ed04]
/usr/lib64/R/lib/libR.so(Rf_applyClosure+0x2aa)[0x2ad389c5268a]
/usr/lib64/R/lib/libR.so(Rf_eval+0x38c)[0x2ad389c4ec1c]
/usr/lib64/R/lib/libR.so[0x2ad389c5014c]
/usr/lib64/R/lib/libR.so(Rf_eval+0x474)[0x2ad389c4ed04]
/usr/lib64/R/lib/libR.so(Rf_applyClosure+0x2aa)[0x2ad389c5268a]
/usr/lib64/R/lib/libR.so(Rf_eval+0x38c)[0x2ad389c4ec1c]
/usr/lib64/R/lib/libR.so(Rf_ReplIteration+0x1c3)[0x2ad389c733c3]
/usr/lib64/R/lib/libR.so(run_Rmainloop+0xd1)[0x2ad389c736d1]
/usr/lib64/R/bin/exec/R(main+0x2b)[0x4008bb]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x2ad38a32a074]
/usr/lib64/R/bin/exec/R[0x400769]
=== Memory map: 
0040-00401000 r-xp  08:02 
815595 /usr/lib64/R/bin/exec/R
0060-00601000 rw-p  08:02 
815595 /usr/lib64/R/bin/exec/R
00601000-01bf3000 rw-p 00601000 00:00 0  
[heap]
2ad38995c000-2ad389976000 r-xp  08:02 
2044002/lib64/ld-2.7.so
2ad389976000-2ad389978000 rw-p 2ad389976000 00:00 0
2ad389b75000-2ad389b76000 r--p 00019000 08:02 
2044002/lib64/ld-2.7.so
2ad389b76000-2ad389b77000 rw-p 0001a000 08:02 
2044002/lib64/ld-2.7.so
2ad389b77000-2ad389e03000 r-xp  08:02 
878425 /usr/lib64/R/lib/libR.so
2ad389e03000-2ad38a002000 ---p 0028c000 08:02 
878425 /usr/lib64/R/lib/libR.so
2ad38a002000-2ad38a016000 rw-p 0028b000 08:02 
878425 /usr/lib64/R/lib/libR.so
2ad38a016000-2ad38a0af000 rw-p 2ad38a016000 00:00 0
2ad38a0af000-2ad38a0db000 r-xp  08:02 
878426 /usr/lib64/R/lib/libRblas.so
2ad38a0db000-2ad38a2da000 ---p 0002c000 08:02 
878426 /usr/lib64/R/lib/libRblas.so
2ad38a2da000-2ad38a2db000 rw-p 0002b000 08:02 
878426 /usr/lib64/R/lib/libRblas.so
2ad38a2db000-2ad38a2dc000 r--p  08:02 
892499 
/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/SYS_LC_MESSAGES
2ad38a2dc000-2ad38a2e3000 r--s  08:02 
654700 /usr/lib64/gconv/gconv-modules.cache
2ad38a30b000-2ad38a30c000 rw-p 2ad38a30b000 00:00 0
2ad38a30c000-2ad38a457000 r-xp  08:02 
2044009/lib64/libc-2.7.so
2ad38a457000-2ad38a656000 ---p 0014b000 08:02 
2044009/lib64/libc-2.7.so
2ad38a656000-2ad38a65a000 r--p 0014a000 08:02 
2044009/lib64/libc-2.7.so
2ad38a65a000-2ad38a65b000 rw-p 0014e000 08:02 
2044009/lib64/libc-2.7.so
2ad38a65b000-2ad38a66 rw-p 2ad38a65b000 00:00 0
2ad38a66-2ad38a718000 r-xp  08:02 
2396466/usr/lib64/libgfortran.so.2.0.0
2ad38a718000-2ad38a917000 ---p 000b8000 08:02 
2396466/usr/lib64/libgfortran.so.2.0.0
2ad38a917000-2ad38a919000 rw-p 000b7000 08:02 
2396466/usr/lib64/libgfortran.so.2.0.0
2ad38a919000-2ad38a998000 r-xp  08:02 
2044017/lib64/libm-2.7.so
2ad38a998000-2ad38ab98000 ---p 0007f000 08:02 
2044017/lib64/libm-2.7.so
2ad38ab98000-2ad38ab99000 r--p 0007f000 08:02 
2044017/lib64/libm-2.7.so
2ad38ab99000-2ad38ab9a000 rw-p 0008 08:02 
2044017/lib64/libm-2.7.so
2ad38ab9a000-2ad38ab9b000 rw-p 2ad38ab9a000 00:00 0
2ad38ab9b000-2ad38abd1000 r-xp  08:02 
2044184/lib64/libreadline.so.5.2
2ad38abd1000-2ad38add ---p 00036000 08:02 
2044184/lib64/libreadline.so.5.2
2ad38add-2ad38add8000 rw-p 00035000 08:02 
2044184/lib64/libreadline.so.5.2
2ad38add8000-2ad38add9000 rw-p 2ad38add8000 00:00 0

[R] Goto loop

2008-10-31 Thread megh

Is there anything like goto loop, which exists in most computer programs?
e.g. I am looking for this kind of stuff :

if(i  6) goto step-02

Any idea?

Regards,
-- 
View this message in context: 
http://www.nabble.com/%22Goto%22-loop-tp20263445p20263445.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Goto loop

2008-10-31 Thread Barry Rowlingson
2008/10/31 megh [EMAIL PROTECTED]:

 Is there anything like goto loop, which exists in most computer programs?

Really? Not since 1968, I think:

http://www.cs.utexas.edu/users/EWD/ewd02xx/EWD215.PDF

 e.g. I am looking for this kind of stuff :

 if(i  6) goto step-02

 Any idea?

 Thinking you need a 'goto' is a massive red flag in your program.
This red flag is waving to warn you of danger ahead. As well as
Dijkstra's somewhat technical reasons for abhoring such a language
construct, it will also make your program very difficult to
understand.

 R has for-loops, repeat-loops, while loops, and conditional
(if-then-else) structures. You can break out of loops with 'break',
and jump to the next iteration with 'next'.  There is no goto:

  help.search(goto)
 No help files found with alias or concept or title matching 'goto'
 using regular expression matching.

If you have been given a bolognese full of spaghetti code (which is
what we call anything with a generous sprinkling of goto statements)
and you want to rewrite it in R, you'll have some thinking to do. Or
just write it in Fortran which, since it dates from well before
Dijkstra's famous note, has GOTO statements you can use.

Barry

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


Re: [R] how to retrieve some records from a dataframe

2008-10-31 Thread Henrique Dallazuanna
See head:

head(Df, n = 30)

On Fri, Oct 31, 2008 at 6:44 AM, Kurapati, Ravichandra (Ravichandra) 
[EMAIL PROTECTED] wrote:

 Hi ,



 Dataframe  Df contains more than 30 no of records.but I want only
 first 30 rows of data.



How can I retrieve it.



 Thanks

 K.Ravichandra






[[alternative HTML version deleted]]

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

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


Re: [R] Row and Column positions

2008-10-31 Thread Henrique Dallazuanna
Try:

which(is.na(m), arr = T)

On Fri, Oct 31, 2008 at 9:17 AM, Shubha Vishwanath Karanth 
[EMAIL PROTECTED] wrote:

 Hi R,



 m=data.frame(a=c(1,NA,5,5),b=c(4,5,6,7),c=c(NA,NA,NA,5))



 I want to know the methods of getting row and column positions of NA in
 the above dataframe. How do I do this?





 Thanks, Shubha



 This e-mail may contain confidential and/or privileged i...{{dropped:13}}

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

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


Re: [R] rimage don't install on mac OS X 10.5.5

2008-10-31 Thread Florencio Gonzalez Blazquez
Thanks for your rapid response. I tried your sugerences and set  
C_INCLUDE_PATH=/usr/local/include. I also look in /usr/local/include  
and here it appears fftw.h and also fftw3.f, fftw3.h, fftw_threads.h  
and rfftw.h rfftw_threads.h

but it don't work also. I will try to update to R 2.8.0
Thanks for your sugestions

El 31/10/2008, a las 10:10, Prof Brian Ripley escribió:


On Fri, 31 Oct 2008, Florencio Gonzalez Blazquez wrote:

Hello, i'm trying to install de rimage package form source. I have  
installed fftw2.1.5 and libjpeg, but during compilation appear this  
message:


Where did you install the fftw headers?  If in /usr/local/include,  
this is apparently not in the C_INCLUDE_PATH for your system.  (The  
reason that configure finds ffw.h but the compile does not is most  
likely that -isysroot has been set in the compile: the author of  
rimage has not been careful to use the same compiler flags as R  
uses. Cc:ing the author here -- please study 'Writing R Extensions'  
about how to use a configure script in a package.)  I suspect the  
workaround is to set C_INCLUDE_PATH=/usr/local/include (or as  
appropriate) in the environment used for the compile, or to install  
ffw with --prefix=/usr.


There is a list, R-sig-mac, for MacOS-specific questions and you  
will get the ears of the MacOS experts there.


Please note the advice of the posting guide to update your R *before  
posting*: R 2.7.0 is rather old and many bugs have been fixed since.




* Installing *source* package 'rimage' ...
checking for g++... g++
checking for C++ compiler default output... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fftw.h usability... yes
checking fftw.h presence... yes
checking for fftw.h... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for inline... inline
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
** arch - i386
g++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx- 
version-min=10.4 -I/Library/Frameworks/R.framework/Resources/ 
include -I/Library/Frameworks/R.framework/Resources/include/i386 -g  
-O2   -msse3 -fPIC  -g -O2 -march=nocona -c equalize.cpp -o  
equalize.o
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx- 
version-min=10.4 -std=gnu99 -I/Library/Frameworks/R.framework/ 
Resources/include -I/Library/Frameworks/R.framework/Resources/ 
include/i386 -g -O2   -msse3 -fPIC  -g -O2 -march=nocona -c  
fftw_access_func.c -o fftw_access_func.o

fftw_access_func.c:10:18: error: fftw.h: No such file or directory
fftw_access_func.c: In function ‘fftw_access_func’:
fftw_access_func.c:20: error: ‘fftwnd_plan’ undeclared (first use  
in this function)
fftw_access_func.c:20: error: (Each undeclared identifier is  
reported only once

fftw_access_func.c:20: error: for each function it appears in.)
fftw_access_func.c:20: error: syntax error before ‘plan’
fftw_access_func.c:21: error: ‘fftw_complex’ undeclared (first use  
in this function)
fftw_access_func.c:21: error: ‘i’ undeclared (first use in this  
function)
fftw_access_func.c:21: error: ‘s’ undeclared (first use in this  
function)

fftw_access_func.c:32: error: syntax error before ‘)’ token
fftw_access_func.c:33: error: syntax error before ‘)’ token
fftw_access_func.c:39: error: ‘fftw_real’ undeclared (first use in  
this function)

fftw_access_func.c:39: error: syntax error before ‘img’
fftw_access_func.c:40: error: syntax error before ‘img’
fftw_access_func.c:43: error: ‘plan’ undeclared (first use in this  
function)
fftw_access_func.c:43: warning: implicit declaration of function  
‘fftw2d_create_plan’
fftw_access_func.c:43: error: ‘FFTW_ESTIMATE’ undeclared (first use  
in this function)
fftw_access_func.c:45: warning: implicit declaration of function  
‘fftwnd_one’
fftw_access_func.c:46: warning: implicit declaration of function  
‘fftwnd_destroy_plan’

make: *** [fftw_access_func.o] Error 1
chmod: /Library/Frameworks/R.framework/Resources/library/rimage/ 
libs/i386/*: No such file or directory
** Removing 

[R] dotplot with a log scale

2008-10-31 Thread glaporta

Dear all,
I would like to create a dotplot (lattice) with a log scale as the function 
http://www.nabble.com/dotchart-with-log-scale--td5411625.html#a5411625
mydotchart  of Johannes Huesing. Is it possible?
Thanx Gianandrea
-- 
View this message in context: 
http://www.nabble.com/dotplot-with-a-log-scale-tp20265718p20265718.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Fitting weibull and exponential distributions to left censoring data

2008-10-31 Thread Terry Therneau
 Use the survreg function.
 
 There are many different ways to parameterize a Weibull.  The survreg function 
imbeds it a general location-scale familiy, which is a different 
parameterization than the rweibull function. 
 
 y - rweibull(1000, shape=2, scale=5)
 survreg(Surv(y)~1, dist=weibull)

Coefficients:
(Intercept) 
   1.592543 

Scale= 0.5096278 

Loglik(model)= -2201.9   Loglik(intercept only)= -2201.9



 survreg's scale  =1/(rweibull shape)
 survreg's intercept = log(rweibull scale)
 For the log-likelihood all parameterizations lead to the same value.

  There is not right or wrong parameterization for a Weibull (IMHO), but 
there certainly is a lot of room for confusion.  This comes up enough that I 
have just added it as an example in the survreg help page, which will migrate 
to 
the general R distribution in due course.
  
  Terry Therneau

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


[R] locfit and latest R version

2008-10-31 Thread Stuart Barker (Prof)


I have been using some old R scripts that were prepared for me using 
R Version 1.9.0. In these, there is a call to

library(locfit)
and with this version of R, I have no problem.

But needing to upgrade to the latest version of R, I find these 
scripts no longer work, and with

help(locfit)
I get
Error in help(locfit): Object locfit not found

So my question is -
what is available that has replaced locfit, and that will do the same 
thing as locfit, but with the latest R version?


You will realise from this that I have no expertise in using R or in 
writing R scripts, and will greatly appreciate any advice.


Many thanks

Stuart Barker




J.S.F. (Stuart) Barker HonDSc FTSE
Emeritus Professor
School of Environmental and Rural Science
University of New England
Armidale, NSW 2351
Australia

Honorary Professor
School of Integrative Biology
University of Queensland
Brisbane

HOME: 114 Cooke Road
Witta, Maleny
Qld 4552

Ph.  HOME ++ 61 7 5435 8365
email - [EMAIL PROTECTED]

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


Re: [R] PAM: how to get the best number of clusters

2008-10-31 Thread Maura E Monville
My problem is that I have already a distance (similarity) matrix generated
outside R through a C++ code because the criteria to calculate the
distance between pairs of objects are none of the standard criteria
implemented in R.
If I got it right, but I might be mistaken, stepFlexclust() performs the
clusters layout optimization by calling either one of  kcca or cclust which
calculate their own similarity matrix.
I just need a function or method to optimize the clusters number no matter
how the similarity matrix has been generated and no matter which clustering
function I use (PAM).
Is this at all possible ?

Thank you very much,
Maura



On Fri, Oct 31, 2008 at 12:18 AM, Dylan Beaudette [EMAIL PROTECTED]
 wrote:

 On Thursday 30 October 2008, Maura E Monville wrote:
  I have the book you mentioned. It basically describes the silhouette
  method. I do not have it handy as I moved so it is still in some box.
  However I cannot remember that book providing any other criterion to find
  the best clusters number.
  On the other hand I have the same problem with hierarchical clustering
  techniques.
  I use clusters as exploratory analysis because I do not have any a-priori
  knowledge that helps me make a choice.
  How can multivariate analysis help?
  I launched a loop where the silhouette test follows PAM which is passed a
  clusters number increased by 1 at each iteration.
  Since I am observing that the silhouette value is now oscillating among
  negative numbers, I wonder whether I can assume that it can only grow
 worse
  once it has turned negative the first time so leave the loop after the
  first negative number and choose the clusters number associated with the
  biggest positive silhouette value.
  This procedure would spare a lot of CPU time.

 Another approach might involve the stepFlexclust() from the flexclust
 package.
 See the manual page for this function for examples.

 Dylan


  Thank you very much,
  Maura
 
  On Thu, Oct 30, 2008 at 7:25 PM, Dylan Beaudette
 
  [EMAIL PROTECTED]wrote:
   On Thursday 30 October 2008, Maura E Monville wrote:
I have a pretty big similarity matrix (2870x2870). I will produce
 even
bigger ones soon.
I am using PAM to generate clusters.
The desired number of output clusters is a PAM input parameter.
I do not know  a-priopri what is the best clusters layout .
I resorted to the silhouette test. It takes forever as I have to run
PAM with all possible
numbers of clusters.
I wonder whether there is some faster method, either a s/w code or
 some
theoretical guidelines,
to get the optimum clusters number.
   
Thank you very much,
  
   This is a very general topic in the field of multivariate analysis.
 There
   really isn't any way to know the 'correct' number of clusters, however
   there
   are several metrics that can give you an indication of how messy your
   data are.
  
   For information on the methods in the cluster package, see this book:
  
   Kaufman, L.  Rousseeuw, P. J. Finding Groups in Data An Introduction
 to
   Cluster Analysis Wiley-Interscience, 2005
  
   Otherwise, consider a book on multivariate analysis. Alternatively, try
 a
   hierarchical clustering approach, and look for meaningful groupings.
 Some
   thing like this:
  
   d - diana(daisy(your_data_matrix))
   d.hc - as.hclust(d)
  
   d.hc$labels - your_data_matrix$id
  
   plot(d.hc)
  
   Cheers,
  
   Dylan
  
  
   --
   Dylan Beaudette
   Soil Resource Laboratory
   http://casoilresource.lawr.ucdavis.edu/
   University of California at Davis
   530.754.7341



 --
 Dylan Beaudette
 Soil Resource Laboratory
 http://casoilresource.lawr.ucdavis.edu/
 University of California at Davis
 530.754.7341




-- 
Maura E.M

[[alternative HTML version deleted]]

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


[R] chi-square area analysis

2008-10-31 Thread Arctica

Hi

I was wondering if anyone have done an area analysis using chi-aquare?
I have three areas (area1, area2 and area3) I need to compare them to each
other by looking at a binomial distribution factor (0=negative, 1=positive).

I have already done a logistiv regression analysis comparing these areas,
but I have been told to do a chi-square, but I cannot find any commands for
area comparing.

Thanks for your help!

-
Arctica
-- 
View this message in context: 
http://www.nabble.com/chi-square-area-analysis-tp20266619p20266619.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] how to compute a roc curve

2008-10-31 Thread Pau Marc Munoz Torres
Hi,

 I'm trying to set up a prediction software, now i testing the performance
of my method, so i need to calculate a ROC curve, specially auc, cut-off,
sens and spec, i just looking at ROCH package, but it's a mass for me,  i'm
not a math guy and I'm getting lost

Could any of you recommend me an easy-to-use package to do this task? i just
have a list of positive/negative samples and his score on my program. can I
compute a roc curve with this?

thanks

pau
-- 
Pau Marc Muñoz Torres

Laboratori de Biologia Computacional
Institut de  Biotecnologia   i Biomedicina Vicent Villar

Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)

telèfon: 93 5812807
Email : [EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


Re: [R] stratified kappa (measure agreement or interrater reliability)?

2008-10-31 Thread David Winsemius


On Oct 30, 2008, at 11:38 PM, FD wrote:


Hi All:
Could anyone point me to a package that can calculate stratified  
kappa?  My
design is like this, 4 raters,  30 types of diagnosis scores, 20  
patients.
Each rater will rate each patient for each type of diagnosis score.  
The

rater's value is nominal.

I know I can measure the agreement between raters for each type of  
diagnosis
score, e.g., calculate out 30 kappa values. My problem is I want to  
have an
overall agreement measure (a single value and its significance over  
chance).

Could anyone help me with this?


I am not a statistician or a psychometrician, so have no experience  
with any of these packages. A google search on produced this link:
http://www.mail-archive.com/[EMAIL PROTECTED]/ 
msg89858.html   ... and looking in package psy in CRAN, I see  
lkappa(), Light’s kappa for n raters,  which seems to meet your  
specifications.


The concord package may have the facilities but I am not able to tell  
from the documentation. Perhaps Jim Lemon can be queried.


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


Re: [R] locfit and latest R version

2008-10-31 Thread David Winsemius
My guess is that you have not configured you new installation to see  
(and update) your collection of packages. As a quick fix, what happens  
when you go to your favorite CRAN mirror and install a new copy of  
locfit? My version is 1.5-4 and runs with recent versions of R.


--
David Winsemius, MD
Heritage Labs

On Oct 31, 2008, at 7:21 AM, Stuart Barker (Prof) wrote:



I have been using some old R scripts that were prepared for me using  
R Version 1.9.0. In these, there is a call to

library(locfit)
and with this version of R, I have no problem.

But needing to upgrade to the latest version of R, I find these  
scripts no longer work, and with

help(locfit)
I get
Error in help(locfit): Object locfit not found

So my question is -
what is available that has replaced locfit, and that will do the  
same thing as locfit, but with the latest R version?


You will realise from this that I have no expertise in using R or in  
writing R scripts, and will greatly appreciate any advice.


Many thanks

Stuart Barker




J.S.F. (Stuart) Barker HonDSc FTSE
Emeritus Professor
School of Environmental and Rural Science
University of New England
Armidale, NSW 2351
Australia

Honorary Professor
School of Integrative Biology
University of Queensland
Brisbane

HOME: 114 Cooke Road
Witta, Maleny
Qld 4552

Ph.  HOME ++ 61 7 5435 8365
email - [EMAIL PROTECTED]

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


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


Re: [R] subset with variable number of subset arguments

2008-10-31 Thread Erik Iverson

I think

subset(set, InfCode %in% x)


does it, where 'x' is your vector of ids (e.g., c(1,3,9) in your example 
at the bottom)


Brar Piening wrote:

I've got a big data.frame from which I need to extract data based on a variable 
number of Id's (InfCode).
Until now I've been using the following dull solution as I never needed to 
search for more than 5 codes.

Now my needs have increased faster than my R skills did and I need to call my 
function with about 25 values for x.

There has to be a *apply or even simpler solution which (after RTM) I'm not 
able to figure out.

Can anybody direct me to a possible solution?

Regards,

Brar


GetInfCodeSubset - function(set, x){
if(1 == length(x))
return(subset(set, (set$InfCode == x[1])))
else if(2 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2])))
else if(3 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3])))
else if(4 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3]) | (set$InfCode == x[4])))
else if(5 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3]) | (set$InfCode == x[4]) | (set$InfCode == x[5])))
else if(6 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3]) | (set$InfCode == x[4]) | (set$InfCode == x[5]) | 
(set$InfCode == x[6])))
else stop(Too many elements in x)
}

set - data.frame(PatId = c(1:100), InfCode = rep(c(1:20), 5))

GetInfCodeSubset(set, c(1,3,9))

--

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


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


[R] getting the p-value from lm as a list object

2008-10-31 Thread eric lee
Hi,

I'm trying to get the p-value from the 'lm' regression function as a list
object.  For example, I can get r^2 from the following code by entering
summary(fm)$r.squared.  Is there a way to get the p-value?  If not, is there
a function where I can enter the f-value and degrees of freedom to get the
p-value?  Thanks.

x - c(1,2,3,4,5,6,7,8,9,10)
y - c(1,2,3,4,4,5,6,8,1,9)

fm - lm(y ~ x)
str(summary(fm))

[[alternative HTML version deleted]]

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


Re: [R] how to compute a roc curve

2008-10-31 Thread Saeed Abu Nimeh
Try library(ROCR)

Pau Marc Munoz Torres wrote:
 Hi,
 
  I'm trying to set up a prediction software, now i testing the performance
 of my method, so i need to calculate a ROC curve, specially auc, cut-off,
 sens and spec, i just looking at ROCH package, but it's a mass for me,  i'm
 not a math guy and I'm getting lost
 
 Could any of you recommend me an easy-to-use package to do this task? i just
 have a list of positive/negative samples and his score on my program. can I
 compute a roc curve with this?
 
 thanks
 
 pau
 
 
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] getting the p-value from lm as a list object

2008-10-31 Thread Thomas Petzoldt

eric lee wrote:

Hi,

I'm trying to get the p-value from the 'lm' regression function as a list
object.  For example, I can get r^2 from the following code by entering
summary(fm)$r.squared.  Is there a way to get the p-value?  If not, is there
a function where I can enter the f-value and degrees of freedom to get the
p-value?  Thanks.

x - c(1,2,3,4,5,6,7,8,9,10)
y - c(1,2,3,4,4,5,6,8,1,9)

fm - lm(y ~ x)
str(summary(fm))


What about the following (taken from  stats:::print.summary.lm):


x - c(1,2,3,4,5,6,7,8,9,10)
y - c(1,2,3,4,4,5,6,8,1,9)

fm - lm(y ~ x)

summary(fm) # for comparison only

sfm - summary(fm)
pf(sfm$fstatistic[1], sfm$fstatistic[2], sfm$fstatistic[3],
  lower.tail = FALSE)



Thomas P.

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


Re: [R] getting the p-value from lm as a list object

2008-10-31 Thread Marc Schwartz
on 10/31/2008 10:59 AM eric lee wrote:
 Hi,
 
 I'm trying to get the p-value from the 'lm' regression function as a list
 object.  For example, I can get r^2 from the following code by entering
 summary(fm)$r.squared.  Is there a way to get the p-value?  If not, is there
 a function where I can enter the f-value and degrees of freedom to get the
 p-value?  Thanks.
 
 x - c(1,2,3,4,5,6,7,8,9,10)
 y - c(1,2,3,4,4,5,6,8,1,9)
 
 fm - lm(y ~ x)
 str(summary(fm))


The default output is created in stats:::print.summary.lm().

The basic incantation is:

  pf(x$fstatistic[1], x$fstatistic[2], x$fstatistic[3],
 lower.tail = FALSE)

where:

  pf() is the F distribution function

  x = the summary.lm model object

  x$fstatistic[1] = model F statistic

  x$fstatistic[2] = model numerator DF

  x$fstatistic[3] = model denominator DF



Thus, using lm.D9 from example(lm):


 summary(lm.D9)

Call:
lm(formula = weight ~ group)

Residuals:
Min  1Q  Median  3Q Max
-1.0710 -0.4938  0.0685  0.2462  1.3690

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)   5.0320 0.2202  22.850 9.55e-15 ***
groupTrt -0.3710 0.3114  -1.1910.249
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6964 on 18 degrees of freedom
Multiple R-squared: 0.07308,Adjusted R-squared: 0.02158
F-statistic: 1.419 on 1 and 18 DF,  p-value: 0.249


 summary(lm.D9)$fstatistic
value numdf dendf
 1.419101  1.00 18.00


 pf(1.419, 1, 18, lower = FALSE)
[1] 0.2490394


See ?pf

HTH,

Marc Schwartz

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


[R] Help needed with Waterfall plot

2008-10-31 Thread Philip Twumasi-Ankrah
Hi friends,
I need suggestions/directions on how to producing a waterfall plot for present 
extend of change in tumour size for a set of respondents in a study.  Example 
of use of waterfall plot is in the following slides presented at ASCO 2007 by 
Axel Grothey. Link is 

http://media.asco.org/player/default.aspx?LectureID=AG265conferenceFolder=GI2007SessionFolder=Posterslideonly=yesTrackID=N929LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.Key=vm_45_3_26_265SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MDmediaURL=%2fmediaServerName=media.asco.orgmax=12ext=jpguseASX=falseplaytype=playtype=playtype=,

The link is pretty long but it takes you right to the presentation.



A Smile costs Nothing  
 But Rewards Everything

Happiness is not perfected until it is shared
  -Jane Porter  
  



  
[[alternative HTML version deleted]]

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


Re: [R] set the language

2008-10-31 Thread Prof Brian Ripley

On Fri, 31 Oct 2008, Gustave Lefou wrote:


Hello,

I would like to change my R language from German to French or English.


On Windows, we presume.


I have read messages in the archives and also R Installation and
Administration paragraph 7.2 but I did not get it all.
I have to set LANGUAGE=en (what would it be for French, fr ?), but I don't
know where.


Well, the rw-FAQ does tell you where:

  1. On the command line as name=value pairs.  For example in the
 shortcut to `Rgui' you could have

  path_to_R\bin\Rgui.exe HOME=p:/ R_LIBS=p:/myRlib

so in your shortcut use LANGUAGE=fr .  (That's the ISO 639 abbreviation 
for French, and the manual does tell you that is what to use! Google very 
rapidly produces http://en.wikipedia.org/wiki/ISO_639-1 as a list.)


That's the best place as it sets the language only for R.



I am under Windows XP. FAQ 2.15 tells me : under Windows 2000/XP/2003 you
can use `System' in the control panel or the properties of `My Computer'
(under the `Advanced' tab). Is that right ? I have problem finding all
this, partly because my Windows is in German.

I give you the German names I have found : Systemsteuerung -- System --
Umgebungsvariablen
Should I click on Neu (Neu Benutzervariable) and then enter LANGUAGE
as Name and en as Wert ?
Maybe I am completely wrong.

Thank you very much

[[alternative HTML version deleted]]

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



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

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


Re: [R] Help needed with Waterfall plot

2008-10-31 Thread Thomas Petzoldt

Philip Twumasi-Ankrah schrieb:

Hi friends,
I need suggestions/directions on how to producing a waterfall plot for present extend of change in tumour size for a set of respondents in a study.  Example of use of waterfall plot is in the following slides presented at ASCO 2007 by Axel Grothey. Link is 


http://media.asco.org/player/default.aspx?LectureID=AG265conferenceFolder=GI2007SessionFolder=Posterslideonly=yesTrackID=N929LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.Key=vm_45_3_26_265SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MDmediaURL=%2fmediaServerName=media.asco.orgmax=12ext=jpguseASX=falseplaytype=playtype=playtype=,

The link is pretty long but it takes you right to the presentation.


Hi Phillip,

is this a waterfall plot:

## a few data
x - 0:99
y - sort(rnorm(100), decreasing=TRUE)

# the plot
plot(y, type=n)
polygon(c(min(x), x, max(x), 0), c(0, y, 0, 0), col=green)

Thomas P.

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


[R] Question about betareg using R

2008-10-31 Thread Jordi Garcia
Good morning,
I am using R to try to model the proportion of burned area in Portugal. 
The dependent variable is the proportion (P). The family used is 
binomial and the epsilon would be binary. They have recommended me to 
use the Betareg package as it allows to work with proportions.

When I use the Betareg function for my data (2800 lines) with 7 
variavels. I created a model using the sum of all seven variables and 
using p (proportion of area burnt as the independent variable). I 
obtained these results, can you tell me if this is normal? or what do 
the errors mean? Thank you in advance.
Is there any limit in the number of lines and variables(columns) to use?

This was the functions used and the results obtained:
 attach(dados)
 mod9 - betareg(P ~ 
Fuel+Temperature+Slope+Altitude+Precipitation+Roadsproximity+Population, 
data=dados)
Warning messages:
1: NaNs produced in: sqrt(W)
2: NaNs produced in: sqrt(W)
3: NaNs produced in: sqrt(1 + phihat)
  summary(mod9)

Call:
betareg(formula = P ~ Fuel + Temperature + Slope + Altitude + 
Precipitation + Roadsproximity + Population, data = dados)

DevianceResiduals:  



Min.1st Qu. Median  3rd

0   0   0   0   0






Coefficients:   





EstimateStd.Error   z-value Pr(|z|)
(Intercept) -83062.59.34E-02-8.89E+05   0
FuelAnnualCrop  -2256.8 2.31E-01-9.78E+03   0
FuelHard
-8179.8 7.95E-02-1.03E+05   0
FuelHardSoftEuc -4449.7 7.02E-02-6.34E+04   0
FuelNoFuel  -9552.1 9.02E-02-1.06E+05   0
FuelPermCrop-5112.5 8.39E-02-6.10E+04   0
FuelShrubs  -8246   7.32E-02-1.13E+05   0
FuelSoft
-11795.17.51E-02-1.57E+05   0
FuelSoftEuc -1561.8 7.67E-02-2.04E+04   0
Temperature -1.3E+077.14E-04-1.80E+10   0
Slope   
78122.8 3.78E-032.07E+070
Altitude
1143023 7.19E-051.59E+100
Precipitation   -14822882.11E-03-7.03E+08   0
RoadsproximityDistRd1Km-45315.13.82E-02-1.19E+06   0
Population  4711684 2.81E-041.68E+100



Estimated precision parameter (phi): -560353.4 with s.e. 315.9113

Null Deviance: 0 on 2818 degrees of freedom
Residual Deviance: 0 on 2804 degrees of freedom
Log-Likelihood Ratio Statistic: 3291846935 on 14 degrees of freedom

Pseudo R^2: 0.07753642   AIC: -3291849573

Warning messages:
1: NaNs produced in: sqrt(muhat * (1 - muhat)/(1 + phihat))
2: NaNs produced in: sqrt(muhat * (1 - muhat)/(1 + phihat))

Thank you very much in advance,

Jordi






-- 
__
Jordi Garcia-Gonzalo  
 
FORCHANGE - Forest Ecosystem Management Under Global Change
Departamento de Engenharia Florestal - Instituto Superior de Agronomia
Universidade Técnica de Lisboa
Tapada da Ajuda, 1349-017 Lisboa 
Portugal
tel: +351 21 365 33 66
fax: +351 21 364 50 00
email:[EMAIL PROTECTED]


[[alternative HTML version deleted]]

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


[R] Quantile Regression for Longitudinal Data:error message

2008-10-31 Thread Helen Chen

Quantile Regression for Longitudinal Data.

Hi, 

I am trying to estimate a quantile regression using panel data. I am trying
to use the model that is described in Dr. Koenker's article. So I use the
code the that is posted in the following link: 

http://www.econ.uiuc.edu/~roger/research/panel/rq.fit.panel.R

I am trying to change the number quantiles being estimated.
I change the codes about w and taus ,as following
w=c(.01,.02,.03,.04,.05,.06,.07,.08,.09,.1,.11,.12,.13,.14,.15,.16,.17
,.18,.19,.2,.21,.22,.23,.24,.25,.26,.27,.28,.29,.3,.31,.32,.33,.34,.35
,.36,.37,.38,.39,.4,.41,.42,.43,.44,.45,.46,.47,.48,.49,.5,.49,.48,.47
,.46,.45,.44,.43,.42,.41,.4,.39,.38,.37,.36,.35,.34,.33,.32,.31,.3,.29
,.28,.27,.26,.25,.24,.23,.22,.21,.2,.19,.18,.17,.16,.15,.14,.13,.12,.11
,.1,.09,.08,.07,.06,.05,.04,.03,.02,.01)
,taus=(1:99)/100,lambda = 1

But I get error message: .local(x, pivot, ...) : Increase tmpmax
So I am wondering if I am doing something wrong or I mistake w's meaning.

Thanks 
I really would appreciate some suggestions. 
Best
Helen Chen 
-- 
View this message in context: 
http://www.nabble.com/Quantile-Regression-for-Longitudinal-Data%3Aerror-message-tp20269386p20269386.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Kalman Filter

2008-10-31 Thread Sandrine LUNVEN

Hi,

I am studying Kalman Filter and it seems to be difficult for me to apply the
filter on a simple ARMA.
It is easy to construct the state-space model, for instance:
dlmModARMA(ar=c(0.4,-0.2),ma=c(0.2,-0.1, sigma2=1)
but applying the dlmFilter on it, it doesn't work...
I don't know if my problem is clear but if anyone has already worked on
Kalman filter, it could be great to advise me!
Thank you in advance!

Sandrine

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


Re: [R] Goto loop

2008-10-31 Thread Barry Rowlingson
2008/10/31 Peter Dalgaard [EMAIL PROTECTED]:

 It doesn't exist, but it can always be replaced by if() {} else {}
 constructs. (You don't usually see goto in the class of functional
 programming languages to which R belongs.  See also
 http://en.wikipedia.org/wiki/Edsger_W._Dijkstra .)

 Also see also the always wonderful xkcd comic on the subject:

http://xkcd.com/292/

Barry

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


Re: [R] [ifelse] how to maintain a value from original matrix without probs?

2008-10-31 Thread Henrik Bengtsson
 A - matrix(-4:4, ncol=3)
 A
 [,1] [,2] [,3]
[1,]   -4   -12
[2,]   -303
[3,]   -214
 Apos - A; Apos[A = 0] - NA;
 Apos
 [,1] [,2] [,3]
[1,]   NA   NA2
[2,]   NA   NA3
[3,]   NA14
 Aneg - A; Aneg[A = 0] - NA
 Aneg
 [,1] [,2] [,3]
[1,]   -4   -1   NA
[2,]   -3   NA   NA
[3,]   -2   NA   NA

/Henrik

On Fri, Oct 31, 2008 at 7:59 AM, Diogo André Alagador
[EMAIL PROTECTED] wrote:
 Dear all,

 I have a matrix with positive and negative values.
 From this I would like to produce 2 matrices:
 1st - retaining positives and putting NA in other positions
 2nd - retaining negatives and putting NA in other positions

 and then apply rowMeans for both.

 I am trying to use the function ifelse in the exemplified form:
 ifelse(A0,A,NA)
 but by putting A as a 2nd parameter it changes dimensions of the original
 object.

 I wonder if I can do this, as it seems not to difficult.

 thanks in advance

[[alternative HTML version deleted]]

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


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


Re: [R] [ifelse] how to maintain a value from original matrix without probs?

2008-10-31 Thread Erik Iverson

Hello -

Diogo André Alagador wrote:

Dear all,
 
I have a matrix with positive and negative values.

From this I would like to produce 2 matrices:

1st - retaining positives and putting NA in other positions
2nd - retaining negatives and putting NA in other positions
 
and then apply rowMeans for both.
 
I am trying to use the function ifelse in the exemplified form:

ifelse(A0,A,NA)
but by putting A as a 2nd parameter it changes dimensions of the original
object


I cannot reproduce this:

a - matrix(sample(-10:10, 100, replace = TRUE), nrow = 10)
ifelse(a  0 , a, NA)

gives me a 10 x 10 matrix of positive values and NA values, with 10 x 10 
being the original dimensions of a.



rowMeans(ifelse(a  0 , a, NA), na.rm = TRUE)

gives me what you'd like for positive values, I think?



 
I wonder if I can do this, as it seems not to difficult.
 
thanks in advance


[[alternative HTML version deleted]]

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


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


Re: [R] [ifelse] how to maintain a value from original matrix without probs?

2008-10-31 Thread Greg Snow
The ifelse function sometimes has unwanted side effects.  Your problem can 
easily be done with simple subsetting.  Try:

 pos - neg - A
 pos[ pos = 0 ] - NA
 neg[ neg = 0 ] - NA

# remove the ='s if you don't want strict positive/negative

Hope this helps,

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


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Diogo André Alagador
 Sent: Friday, October 31, 2008 8:59 AM
 To: r-help@r-project.org
 Subject: [R] [ifelse] how to maintain a value from original matrix
 without probs?

 Dear all,

 I have a matrix with positive and negative values.
 From this I would like to produce 2 matrices:
 1st - retaining positives and putting NA in other positions
 2nd - retaining negatives and putting NA in other positions

 and then apply rowMeans for both.

 I am trying to use the function ifelse in the exemplified form:
 ifelse(A0,A,NA)
 but by putting A as a 2nd parameter it changes dimensions of the
 original
 object.

 I wonder if I can do this, as it seems not to difficult.

 thanks in advance

 [[alternative HTML version deleted]]

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

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


[R] R-WinEdt unexcpected Asian characters

2008-10-31 Thread Saskia Sandring

Dear list!
I have encountered an odd problem with R-WinEdt. 

The program is mostly running fine and I had no problems with the installation.
But several times a day I'm typing in R-WinEdt there appears a menu with
Chinese characters where the curser is and I'm not able to type normally. I
don’t know any other way to stop it except restarting R-WinEdt. After that it
works normally for a while until it happens again. I was not able to figure out
when it happens. Sometimes after error messages in R, but not always and I am
never aware of having typed a certain key combination or anything like that.

Is there anything I can change in the settings to prevent this from happening? 

I'm using R 2.8.0. and WinEdt 5.5. in Windows XP. My regional options in
Windows
are set to Sweden and Swedish. 

With earlier versions of R and WinEdt I did not have this problem. However, this
is a different computer.

Thank you for your help!
Saskia

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


Re: [R] smooth function advice

2008-10-31 Thread tolga . i . uzuner
Thanks to Mark Leeds for an implementation of exponentially weighted 
moving averages as follows which solves this problem. This also resmooths 
recursively.


ewma-function(x,lambda = .5, init = (1-lambda)*.raw[good.ind][1],order=1) 
{
.raw - unclass(coredata(x))
good.ind - !is.na(.raw)  # determine good values
if(order1)
ewma(ewma(x,lambda,init,order=1),lambda,init,order=order-1)
else {
   # work with 'non-zoo' data for speed and then recombine
   .raw[good.ind] - filter(lambda * .raw[good.ind], filter=(1-lambda),
   method='recursive',init=coredata(init))
   zoo(.raw, index(x)) # create zoo object for return
}
}





Tolga I Uzuner/JPMCHASE 
30/10/2008 15:36

To
r-help@r-project.org
cc

Subject
smooth function advice





Dear R Users,

I am looking for a smoothing function with the following characteristics 
for a time series of data:
- at each date, should only use data up to that date (so, right aligned 
and not centered)
- should return a smoothed series of length equal to the original time 
series:
- for a one-day time series, just returns that day
- this means the front part of the series will not be as smooth... 
that's  ok
- if the original time series has length 10, the returned smoothed 
time series has length 10 
- there should be some control over smoothness
Any suggestions for a specific approach/package in R ?

Thanks,
Tolga




Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase  Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase 
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
[[alternative HTML version deleted]]

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


Re: [R] dotplot with a log scale

2008-10-31 Thread Deepayan Sarkar
On 10/31/08, glaporta [EMAIL PROTECTED] wrote:

  Dear all,
  I would like to create a dotplot (lattice) with a log scale as the function
  http://www.nabble.com/dotchart-with-log-scale--td5411625.html#a5411625
  mydotchart  of Johannes Huesing. Is it possible?

The usual lattice syntax for this is

dotplot(..., scales = list(x = list(log = TRUE)))

Does this not work?

-Deepayan

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


Re: [R] [ifelse] how to maintain a value from original matrix without probs?

2008-10-31 Thread Marc Schwartz
on 10/31/2008 09:59 AM Diogo André Alagador wrote:
 Dear all,
  
 I have a matrix with positive and negative values.
From this I would like to produce 2 matrices:
 1st - retaining positives and putting NA in other positions
 2nd - retaining negatives and putting NA in other positions
  
 and then apply rowMeans for both.
  
 I am trying to use the function ifelse in the exemplified form:
 ifelse(A0,A,NA)
 but by putting A as a 2nd parameter it changes dimensions of the original
 object.
  
 I wonder if I can do this, as it seems not to difficult.
  
 thanks in advance

A couple of approaches, depending upon the size of the matrix.

The first, if the matrix is small-ish:

set.seed(1)
mat - matrix(sample(-10:10, 100, replace = TRUE), ncol = 10)

 mat
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   -5   -690709   -3   -1-5
 [2,]   -3   -7   -6238   -474-9
 [3,]24306   -1   -1   -3   -2 3
 [4,]9   -2   -8   -71   -5   -4   -3   -4 8
 [5,]   -66   -571   -9305 6
 [6,]80   -246   -8   -58   -6 6
 [7,]95  -106  -10   -4084-1
 [8,]3   10   -2   -8006   -2   -8-2
 [9,]3   -38553   -96   -5 7
[10,]   -96   -3   -24   -28   10   -7 2


 apply(mat, 1, function(x) mean(x[x  0], na.rm = TRUE))
 [1] 8.33 4.80 3.60 6.00 4.67 6.40 6.40
 [8] 6.33 5.285714 6.00

 apply(mat, 1, function(x) mean(x[x  0], na.rm = TRUE))
 [1] -4.00 -5.80 -1.75 -4.714286 -6.67 -5.25
 [7] -6.25 -4.40 -5.67 -4.60


This way, you avoid splitting the matrix. You did not specify how you
might want 0's to be handled, so adjust the logic above accordingly.


If the matrix is large, such that that splitting it and using rowMeans()
would be faster:


mat.pos - mat
is.na(mat.pos) - mat = 0

 mat.pos
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   NA   NA9   NA7   NA9   NA   NANA
 [2,]   NA   NA   NA238   NA74NA
 [3,]243   NA6   NA   NA   NA   NA 3
 [4,]9   NA   NA   NA1   NA   NA   NA   NA 8
 [5,]   NA6   NA71   NA3   NA5 6
 [6,]8   NA   NA46   NA   NA8   NA 6
 [7,]95   NA6   NA   NA   NA84NA
 [8,]3   10   NA   NA   NA   NA6   NA   NANA
 [9,]3   NA8553   NA6   NA 7
[10,]   NA6   NA   NA4   NA8   10   NA 2

 rowMeans(mat.pos, na.rm = TRUE)
 [1] 8.33 4.80 3.60 6.00 4.67 6.40 6.40
 [8] 6.33 5.285714 6.00



mat.neg - mat
is.na(mat.neg) - mat = 0

 mat.neg
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   -5   -6   NA   NA   NA   NA   NA   -3   -1-5
 [2,]   -3   -7   -6   NA   NA   NA   -4   NA   NA-9
 [3,]   NA   NA   NA   NA   NA   -1   -1   -3   -2NA
 [4,]   NA   -2   -8   -7   NA   -5   -4   -3   -4NA
 [5,]   -6   NA   -5   NA   NA   -9   NA   NA   NANA
 [6,]   NA   NA   -2   NA   NA   -8   -5   NA   -6NA
 [7,]   NA   NA  -10   NA  -10   -4   NA   NA   NA-1
 [8,]   NA   NA   -2   -8   NA   NA   NA   -2   -8-2
 [9,]   NA   -3   NA   NA   NA   NA   -9   NA   -5NA
[10,]   -9   NA   -3   -2   NA   -2   NA   NA   -7NA


 rowMeans(mat.neg, na.rm = TRUE)
 [1] -4.00 -5.80 -1.75 -4.714286 -6.67 -5.25
 [7] -6.25 -4.40 -5.67 -4.60



See ?is.na and note the assignment variant.

HTH,

Marc Schwartz

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


[R] dot colour in dotchart2 function (Hmisc-package)

2008-10-31 Thread Rainer Tischler
Hi,

I'm using the dotchart2-function from the Hmisc-package to plot multiple dots 
on horizontal lines using the add=TRUE option.
My question is very simple: How can I change the color of the dots?
I couldn't find the right option in the help-pages of the dotchart2-function or 
the plot.default-function and I tried all obvious possibilities (col, 
color, dotcol, etc.).

Thanks in advance,
Rainer

WikipediaWictionaryChambers (UK)Google imagesGoogle defineThe Free 
DictionaryJoin exampleWordNetGoogleUrban 
DictionaryAnswers.comrhymezone.comMerriam-Webster0
wvcidfjoguarm




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


Re: [R] smooth function advice

2008-10-31 Thread Bert Gunter

RSiteSearch(ewma,rest=func) 

would have told you there already exists an ewma implementation in the qcc
package. 

-- Bert Gunter 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Friday, October 31, 2008 10:04 AM
To: [EMAIL PROTECTED]
Cc: r-help@r-project.org
Subject: Re: [R] smooth function advice

Thanks to Mark Leeds for an implementation of exponentially weighted 
moving averages as follows which solves this problem. This also resmooths 
recursively.


ewma-function(x,lambda = .5, init = (1-lambda)*.raw[good.ind][1],order=1) 
{
.raw - unclass(coredata(x))
good.ind - !is.na(.raw)  # determine good values
if(order1)
ewma(ewma(x,lambda,init,order=1),lambda,init,order=order-1)
else {
   # work with 'non-zoo' data for speed and then recombine
   .raw[good.ind] - filter(lambda * .raw[good.ind], filter=(1-lambda),
   method='recursive',init=coredata(init))
   zoo(.raw, index(x)) # create zoo object for return
}
}





Tolga I Uzuner/JPMCHASE 
30/10/2008 15:36

To
r-help@r-project.org
cc

Subject
smooth function advice





Dear R Users,

I am looking for a smoothing function with the following characteristics 
for a time series of data:
- at each date, should only use data up to that date (so, right aligned 
and not centered)
- should return a smoothed series of length equal to the original time 
series:
- for a one-day time series, just returns that day
- this means the front part of the series will not be as smooth... 
that's  ok
- if the original time series has length 10, the returned smoothed 
time series has length 10 
- there should be some control over smoothness
Any suggestions for a specific approach/package in R ?

Thanks,
Tolga




Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase  Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase 
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
[[alternative HTML version deleted]]

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

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


[R] Digest setting won't take

2008-10-31 Thread Farley, Robert
I've been trying to set my email setting to Digest Mode for a while, but
it doesn't seem to take.

 

 

 I log through to the Unsubscribe or edit options button on the Web
interface to the R-help mailing list page.  I scroll down to the Set
Digest Mode box and change the radio button to On. I click the
Submit My Changes button which takes me back to the mailing list
log-in page.   I log back in and the setting is Off.  It looks like
all settings are re-set to the default.

 

 

How do I change these settings?

 

 

Thanks

 

 

 

 

Robert Farley

Metro

1 Gateway Plaza

Mail Stop 99-23-7

Los Angeles, CA 90012-2952

Voice: (213)922-2532

Fax:(213)922-2868

www.Metro.net 

 

 


[[alternative HTML version deleted]]

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


[R] help with contrasts for a binomial 3-way GLM

2008-10-31 Thread Susana Zuloaga
Hi
 I am a new user the R and I am very grateful for all your help but...

I have a problem and I can't resolve yet. I am trying to get the contrasts for 
a binomial 3-way GLM (T= 4 temperature, t= 2 time and c= 2 substrate levels, 
plus treatment control) in total they are 17 treatments.

  

I have tried with the glht but this function only work for 1-way GLM, 

 

acacia-cbind(g,N-g)

 acacia1-glm(acacia~tratamiento,binomial)

 

 acacia2-glht(acacia1, linfct = mcp(tratamiento = Tukey))

 summary(acacia2)

 

 Simultaneous Tests for General Linear Hypotheses

 

Multiple Comparisons of Means: Tukey Contrasts

 

 

Fit: glm(formula = acacia ~ tratamiento, family = binomial)

 

Linear Hypotheses:

Estimate Std. Error z value p value

B - A == 02.9073 1.0395   2.797  0.2417

C - A == 04.0860 1.0227   3.995   0.01 ** 

D - A == 04.8458 1.0207   4.748   0.01 ***

E - A == 03.0445 1.0362   2.938  0.1727

F - A == 03.3399 1.0306   3.241  0.0744 .etc. 

 

If the GLM is with interactions don't work

 

Ø   acacia3-glm(acacia~T*t*c,binomial)

Øglht(acacia3, linfct = mcp(T = Tukey))

Ø   Error in modelparm.default(model, ...) : 

Ø dimensions of coefficients and covariance matrix don't match

Ø   Warning message:

Ø   In mcp2matrix(model, linfct = linfct) :

Ø covariate interactions found -- default contrast might be 
inappropriate

 

 

Other function could be simtes but this was deprecated from package multcomp

 

There are others options to get comparisons contrasts for model GLM with 
interactions? or this test don't exist ?

 

I hope help me 

 


[[alternative HTML version deleted]]

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


Re: [R] Quantile Regression for Longitudinal Data:error message

2008-10-31 Thread roger koenker

If you are going to insist on doing such things you will have to learn
to read the documentation.  In this case if you do a

traceback()

you will see that the error is occurring in rq.fit.slm and when you do

?rq.fit.slm

you will see that there are several storage sizes that can be adjusted:

 nsubmax: upper bound of the dimension of lindx in Cholesky
  factorization; computed automatically inside the routine if
  missing.

  tmpmax: upper bound of the working array in Cholesky factorization;
  computed automatically inside the routine if missing.

 nnzlmax: upper bound of the non-zero entries in the Cholesky factor L;
  computed automatically inside the routine if missing.

  cachsz: size of the cache on the machine; default to 64.

Since you don't give,  as stipulated by the posting guide, a  
reproducible

example, one can only speculate about what you are trying to do, but
it appears that  you are trying to simultaneously estimate 99 quantiles
with a sample size of length(w) = 99 observations and this is Unsound.

I would also like to repeat my earlier comment that this is NOT a  
proper R help

question since it refers not to something that is in base R, nor even
something in a package, but to code that I happen to have posted to
complement a paper that was published several years ago.


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820



On Oct 31, 2008, at 11:32 AM, Helen Chen wrote:



Quantile Regression for Longitudinal Data.

Hi,

I am trying to estimate a quantile regression using panel data. I am  
trying
to use the model that is described in Dr. Koenker's article. So I  
use the

code the that is posted in the following link:

http://www.econ.uiuc.edu/~roger/research/panel/rq.fit.panel.R

I am trying to change the number quantiles being estimated.
I change the codes about w and taus ,as following
w=c(.01,.02,.03,.04,.05,.06,.07,.08,.09,.1,.11,.12,.13,.14,.15,.16,.17
,.18,.19,.2,.21,.22,.23,.24,.25,.26,.27,.28,.29,.3,.31,.32,.33,.34,.35
,.36,.37,.38,.39,.4,.41,.42,.43,.44,.45,.46,.47,.48,.49,.5,.49,.48,.47
,.46,.45,.44,.43,.42,.41,.4,.39,.38,.37,.36,.35,.34,.33,.32,.31,.3,.29
,. 
28,.27,.26,.25,.24,.23,.22,.21,.2,.19,.18,.17,.16,.15,.14,.13,.12,.11

,.1,.09,.08,.07,.06,.05,.04,.03,.02,.01)
,taus=(1:99)/100,lambda = 1

But I get error message: .local(x, pivot, ...) : Increase tmpmax
So I am wondering if I am doing something wrong or I mistake w's  
meaning.


Thanks
I really would appreciate some suggestions.
Best
Helen Chen
--
View this message in context: 
http://www.nabble.com/Quantile-Regression-for-Longitudinal-Data%3Aerror-message-tp20269386p20269386.html
Sent from the R help mailing list archive at Nabble.com.

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


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


[R] reshape bug?

2008-10-31 Thread stephen sefick
Hadley et al.,
I was using the cast function to reshape some data (aggregate a melted
data frame) and I did not put in the fill and for the most part the
values that came out were fine, but there were value great than an
order of magnitude from the actual value.  When I put in the fill
argument everything is okay.  I don't provide a reproducible example
because the data set is to large to post to the list, but if you would
like to see it then I can provide it.

#this works
cast(x, Date+RiverMile+location~Order, sum, fill=0)

#this doesn't
cast(x, Date+RiverMile+location~Order, sum)



R version 2.8.0 (2008-10-20)
i386-pc-mingw32

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

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

other attached packages:
[1] ggplot2_0.7MASS_7.2-44RColorBrewer_1.0-2
proto_0.3-8reshape_0.8.1  plyr_0.1.1


thanks

-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


Re: [R] Compiling R Packages

2008-10-31 Thread Cahill, Joshua
I'm currently using R version 2.7.2.  Not the newest, but not even six months 
old either.  Thanks for the idea.



-Original Message-
From: Erin Hodgess [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 30, 2008 4:06 PM
To: Cahill, Joshua
Cc: r-help@r-project.org
Subject: Re: [R] Compiling R Packages

Which version of R are you using, please?

I had that problem with some earlier versions of R.



On Thu, Oct 30, 2008 at 3:59 PM, Cahill, Joshua
[EMAIL PROTECTED] wrote:
 I am working on a SLES 10 cluster with R available on it.  To better use my 
 resources, I want to use Rmpi, but I am having a difficult time installing 
 it.  I have set the $R_LIBS variable correctly.

 The MPI libraries are available through the PGI compiler, but this R instance 
 was compiled with GCC.

 The Rmpi package can be compiled and installed with

 %R CMD INSTALL Rmpi_0.5-5.tar.gz --configure-args=CC=pgcc 
 --with-mpi=/shared/pgi725/linux86-64/7.2/mpi/mpich

 But when entering R and loading the library, I get
 %R
 library(Rmpi)
 Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library '/home/username/.Rlib/Rmpi/libs/Rmpi.so':
  /home/username/.Rlib/Rmpi/libs/Rmpi.so: undefined symbol: __pgdbg_stub
 Error in library(Rmpi) : .First.lib failed for 'Rmpi'
 Error in dyn.unload(file.path(libpath, libs, paste(Rmpi, 
 .Platform$dynlib.ext,  :
  dynamic/shared library '/home/username/.Rlib/Rmpi/libs/Rmpi.so' was not 
 loaded


 The undefined symbol is for the PGI debugger.

 It doesn't matter if the $CC variable is gcc, pgcc, or mpicc, and all three 
 do show up in the make output during the configure process.

 Thanks for your help,
 Joshua

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




--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

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


Re: [R] R-WinEdt unexcpected Asian characters

2008-10-31 Thread Uwe Ligges



Saskia Sandring wrote:

Dear list!
I have encountered an odd problem with R-WinEdt. 


The program is mostly running fine and I had no problems with the installation.
But several times a day I'm typing in R-WinEdt there appears a menu with
Chinese characters where the curser is and I'm not able to type normally. I
don’t know any other way to stop it except restarting R-WinEdt. After that it
works normally for a while until it happens again. I was not able to figure out
when it happens. Sometimes after error messages in R, but not always and I am
never aware of having typed a certain key combination or anything like that.

Is there anything I can change in the settings to prevent this from happening? 


I'm using R 2.8.0. and WinEdt 5.5. in Windows XP. My regional options in
Windows
are set to Sweden and Swedish. 


With earlier versions of R and WinEdt I did not have this problem. However, this
is a different computer.



It should not be related to R (no direct link between both programs), 
and probably not to RWinEdt (because I have not had a second report like 
this).


Best wishes,
Uwe Ligges




Thank you for your help!
Saskia

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


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


Re: [R] Digest setting won't take

2008-10-31 Thread Marianne Promberger
On Friday, 31 October 2008, 10:46 (UTC-0700), Farley, Robert wrote:
 I've been trying to set my email setting to Digest Mode for a while, but
 it doesn't seem to take.

I think I had such a problem at some point, and I think it was because
I didn't have cookies enabled in my browser.

m.




-- 
Marianne Promberger
Graduate student in Psychology
http://www.psych.upenn.edu/~mpromber

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


Re: [R] subset with variable number of subset arguments

2008-10-31 Thread Brar Piening

Thank you very much!

Brar


Erik Iverson schrieb:

I think

subset(set, InfCode %in% x)


does it, where 'x' is your vector of ids (e.g., c(1,3,9) in your 
example at the bottom)


Brar Piening wrote:
I've got a big data.frame from which I need to extract data based on 
a variable number of Id's (InfCode).
Until now I've been using the following dull solution as I never 
needed to search for more than 5 codes.


Now my needs have increased faster than my R skills did and I need to 
call my function with about 25 values for x.


There has to be a *apply or even simpler solution which (after RTM) 
I'm not able to figure out.


Can anybody direct me to a possible solution?

Regards,

Brar


GetInfCodeSubset - function(set, x){
if(1 == length(x))
return(subset(set, (set$InfCode == x[1])))
else if(2 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2])))

else if(3 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3])))

else if(4 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3]) | (set$InfCode == x[4])))

else if(5 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3]) | (set$InfCode == x[4]) | (set$InfCode 
== x[5])))

else if(6 == length(x))
return(subset(set, (set$InfCode == x[1]) | (set$InfCode == 
x[2]) | (set$InfCode == x[3]) | (set$InfCode == x[4]) | (set$InfCode 
== x[5]) | (set$InfCode == x[6])))

else stop(Too many elements in x)
}

set - data.frame(PatId = c(1:100), InfCode = rep(c(1:20), 5))

GetInfCodeSubset(set, c(1,3,9))

--

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

and provide commented, minimal, self-contained, reproducible code.


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

and provide commented, minimal, self-contained, reproducible code.



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


[R] replace() error: new columns would leave holes after existing columns

2008-10-31 Thread Kirsten M Barrett
Hello, I have a problem with using replace() to convert a vector of dates 
from -mm-dd to julian date.

For example, I type 

replace(x,2004-05-14,134)

and I receive an error:

Error in `[-.data.frame`(`*tmp*`, list, value = 134) : 
  new columns would leave holes after existing columns

If I can successfully convert, I have a script that will convert all of 
the dates in the vector (i.e., the same line repeated with the next 
-mm-dd and corresponding julian day).  Any help would be much 
appreciated.

Thank you,
Kirsten

Kirsten Barrett
Mendenhall Postdoctoral Fellow, USGS
Alaska Science Center
4210 University Drive
Anchorage, AK
[[alternative HTML version deleted]]

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


Re: [R] AIC for quasipoisson link

2008-10-31 Thread Marc Schwartz
on 10/31/2008 01:07 PM [EMAIL PROTECTED] wrote:
 Dear fellows,
  
 I'm trying to extract the AIC statistic from a GLM model with quasipoisson 
 link.
 The formula I'm referring to is 
  
 AIC = -2(maximum loglik) + 2df * phi
  
 with phi the overdispersion parameter, as reported in:
  
 Peng et al., Model choice in time series studies os air pollution and 
 mortality. J R Stat Soc A, 2006; 162: pag 190.
  
 Unfortunately, the function logLik doesn't work for a quasipoisson link.
 Do you know a fast method to extract the AIC for these models?
  
 Thanks in advance

I was under the impression that there is no log likelihood for quasi*
family models, thus no AIC, which is why they are not calculated/printed
in the glm() summary outputs.

If you want to model overdispersed data and need the AIC, you should
look at glm.nb() in MASS for a negative binomial model:

  library(MASS)
  ?glm.nb

This would also avail you of the anova.glm() methods for comparing
models, which the quasi* families would not.

You might also want to look at:

  http://cran.r-project.org/web/packages/pscl/vignettes/countreg.pdf

which is the vignette from the pscl package.

HTH,

Marc Schwartz

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


Re: [R] how to compute a roc curve

2008-10-31 Thread Greg Snow
There are various packages that do ROC curves (others have mentioned some, you 
can search for the others), but ROC curves are not that hard to do by hand in 
R.  Using the classic iris dataset, we can use Sepal.Length as the test/score 
and species=='virginica' as the true pos/neg that we are trying to predict.  
One way to compute the ROC curve, auc and values is:

 xx - c( -Inf, sort(unique(iris$Sepal.Length)), Inf )
 sens - sapply(xx, function(x) with(iris,
+ mean( Sepal.Length[Species=='virginica'] = x ) ) )
 spec - sapply(xx, function(x) with(iris,
+ mean( Sepal.Length[Species!='virginica']  x ) ) )
 plot( 1-spec, sens, type='l' )

 ch - chull(1-spec,sens)
 lines(1-spec[ch], sens[ch], col='green')

 integrate( approxfun(spec, sens), 0, 1) # Area under curve

Hope this helps,


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


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Pau Marc Munoz Torres
 Sent: Friday, October 31, 2008 8:25 AM
 To: r-help@r-project.org
 Subject: [R] how to compute a roc curve

 Hi,

  I'm trying to set up a prediction software, now i testing the
 performance of my method, so i need to calculate a ROC curve, specially
 auc, cut-off, sens and spec, i just looking at ROCH package, but it's a
 mass for me,  i'm not a math guy and I'm getting lost

 Could any of you recommend me an easy-to-use package to do this task? i
 just have a list of positive/negative samples and his score on my
 program. can I compute a roc curve with this?

 thanks

 pau
 --
 Pau Marc Muñoz Torres

 Laboratori de Biologia Computacional
 Institut de  Biotecnologia   i Biomedicina Vicent Villar

 Universitat Autonoma de Barcelona
 E-08193 Bellaterra (Barcelona)

 telèfon: 93 5812807
 Email : [EMAIL PROTECTED]

 [[alternative HTML version deleted]]

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


Re: [R] dotplot with a log scale

2008-10-31 Thread glaporta


Perfectly... thanx Deepayan


Deepayan Sarkar wrote:
 
 On 10/31/08, glaporta [EMAIL PROTECTED] wrote:

  Dear all,
  I would like to create a dotplot (lattice) with a log scale as the
 function
  http://www.nabble.com/dotchart-with-log-scale--td5411625.html#a5411625
  mydotchart  of Johannes Huesing. Is it possible?
 
 The usual lattice syntax for this is
 
 dotplot(..., scales = list(x = list(log = TRUE)))
 
 Does this not work?
 
 -Deepayan
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/dotplot-with-a-log-scale-tp20265718p20273083.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Formula for Xi

2008-10-31 Thread Johannes Hüsing


Am 30.10.2008 um 16:53 schrieb [EMAIL PROTECTED]:




Hallo! ?xml:namespace prefix = o ns = 
urn:schemas-microsoft-com:office:office /o:p/o:p





[...]


[[alternative HTML version deleted]]



This is a rare case where I would have liked to see the HTML version in 
order to see how these o:p tags are interpreted (paragraphs? tab 
advances?).


But then I doubt if MS-Office generated HTML will be any more 
conclusive.


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


Re: [R] AIC for quasipoisson link

2008-10-31 Thread Ben Bolker
Marc Schwartz marc_schwartz at comcast.net writes:

 
 on 10/31/2008 01:07 PM Antonio.Gasparrini at lshtm.ac.uk wrote:

  I'm trying to extract the AIC statistic from a GLM model 
  with quasipoisson link.
  The formula I'm referring to is 
   
  AIC = -2(maximum loglik) + 2df * phi
   
  with phi the overdispersion parameter, as reported in:
   
  Peng et al., Model choice in time series studies os air pollution and
mortality. J R Stat Soc A, 2006; 162:
 pag 190.
   
 I was under the impression that there is no log likelihood for quasi*
 family models, thus no AIC, which is why they are not calculated/printed
 in the glm() summary outputs.
 

  Yes, but ... this is a matter of some disagreement.  

Long answer: The purist
position (hi Prof. Ripley) is that quasi-likelihood estimation
does not produce a likelihood and should not return one.  
A common position in applied statistics (I think starting with 
a paper by Lebreton, but I can't find the ref right now:
see refs below) is that dividing the log-likelihood of a regular
likelihood fit by the estimated scale (overdispersion) parameter
of the quasi- variant gives a quasilikelihood that can be
used to compute a quasi-AIC that can then be used in model
selection.

 Short answer: I think that if you fit the non-quasi version
of the model (ie. Poisson family in your case) and extract
the likelihood from it, then divide by the overdispersion
parameter estimated from the quasi variant, that should
give you what you want.

  By the way, the formula quoted above looks funny.
Shouldn't it be

 QAIC = -2(maximum loglik)/phi + 2df

?  The formula quoted above (phi times my
version) should give the same ordering, but
model weights and interpretations of QAIC
differences will be wrong.

 cheers
  Ben Bolker


Anderson, D. R., K. P. Burnham, and G. C. White. 1994. AIC model selection in
overdispersed capture-recapture data. Ecology 75, no. 6: 1780-1793.

Richards, Shane A. 2008. Dealing with overdispersed count data in applied
ecology. Journal of Applied Ecology 45: 218-227.
doi:10./j.1365-2664.2007.01377.x.

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


Re: [R] why does sample(x, n) give the same n items in every separate runs?

2008-10-31 Thread Shuhua Zhan
Hello,
I'd like to think all respondents for your advises and suggestions. I am sorry 
for not including the ordered gene expression data frame (largedf) since it is 
large.
The problem is solved now by Greg Down by including the command: 
rm(.Random.seed) in the code, perhaps I used some R packges to process that 
expression data which set the seed on the Random Number Generator to a fixed 
value.
Thanks again,
Joshua

- Original Message -
From: Charles C. Berry [EMAIL PROTECTED]
To: Shuhua Zhan [EMAIL PROTECTED]
Cc: r-help@r-project.org
Sent: Thursday, October 30, 2008 9:07:09 PM GMT -05:00 US/Canada Eastern
Subject: Re: [R] why does sample(x, n) give the same n items in every separate 
runs?


Run help.request().

In particular you need to attend to this part:

Have you written example code that is
  - minimal
  - reproducible
  - self-contained
  - commented
using data that is either
  - constructed by the code
  - loaded by data()
  - reproduced using dump(mydata, file = )
have you checked this code in a fresh R session (invoking R with the 
--vanilla option if possible) and is this code copied to the clipboard? (y/n)



Once you get this far and can honestly type 'y', if you have not found 
your error, you are ready to post a query.

HTH,

Chuck



On Thu, 30 Oct 2008, Shuhua Zhan wrote:

 Hello R users,
 I have gene expression data of two groups of genes (large and small). Gene 
 expression intensities of those genes are classified into 1 to 10 levels. 
 What I want is to make a random set of genes that have the same levels as the 
 small group from large group using sample().

 I used smallvec to hold the number of genes in each levels (1 to 10) for 
 small group, largevec for large group. I ordered the gene expression data 
 frame of large group (largedf) by the levels and randomly chose the genes 
 with same level as small group. Using the code below I can get the random set 
 of genes from lagre group with same levels for small group. But I got the 
 same set of genes when I run the code in every other runs in Linux. This 
 gives me a doubt in my result.

 smallvec-c(8,12,9,6,13,20,16,11,8,5) ## the No. of genes in levels 1 to 10
 largevec-c(400,300,550,600,210,420,380,600,450,500)
 generdm-c() ## a random set of genes
 for( i in 1:length(smallvec)){

 generdm-c(generdm,sample(rownames(largedf)[sum(largevec[0:(i-1)],1):sum(largevec[0:i])],smallvec[i]))
  ## rownames(largedf) gives gene names ordered by levels in large group
 }

 Could you please help me out?
 Thanks a lot!!
 Josh

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


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


Re: [R] AIC for quasipoisson link

2008-10-31 Thread Bonenfant Christophe
Ben, I think the reference you're searching for is the one below

@ARTICLE{Lebreton1992,
  author = {Lebreton, J.-D. and Burnham, K. P. and Clobert, J. and Anderson,
D. R.},
  title = {Modeling survival and testing biological hypotheses using marked
animals: a unified approach with case studies},
  journal = {Ecological {M}onographs},
  year = {1992},
  volume = {62},
  pages = {67-118},
  keywords = {Modeling, survival, Capture-recapture},
  pdf = {Lebreton1992.pdf}
}

Cheers,

C


Selon Ben Bolker [EMAIL PROTECTED]:

 Marc Schwartz marc_schwartz at comcast.net writes:

 
  on 10/31/2008 01:07 PM Antonio.Gasparrini at lshtm.ac.uk wrote:

   I'm trying to extract the AIC statistic from a GLM model
   with quasipoisson link.
   The formula I'm referring to is
  
   AIC = -2(maximum loglik) + 2df * phi
  
   with phi the overdispersion parameter, as reported in:
  
   Peng et al., Model choice in time series studies os air pollution and
 mortality. J R Stat Soc A, 2006; 162:
  pag 190.
  
  I was under the impression that there is no log likelihood for quasi*
  family models, thus no AIC, which is why they are not calculated/printed
  in the glm() summary outputs.
 

   Yes, but ... this is a matter of some disagreement.

 Long answer: The purist
 position (hi Prof. Ripley) is that quasi-likelihood estimation
 does not produce a likelihood and should not return one.
 A common position in applied statistics (I think starting with
 a paper by Lebreton, but I can't find the ref right now:
 see refs below) is that dividing the log-likelihood of a regular
 likelihood fit by the estimated scale (overdispersion) parameter
 of the quasi- variant gives a quasilikelihood that can be
 used to compute a quasi-AIC that can then be used in model
 selection.

  Short answer: I think that if you fit the non-quasi version
 of the model (ie. Poisson family in your case) and extract
 the likelihood from it, then divide by the overdispersion
 parameter estimated from the quasi variant, that should
 give you what you want.

   By the way, the formula quoted above looks funny.
 Shouldn't it be

  QAIC = -2(maximum loglik)/phi + 2df

 ?  The formula quoted above (phi times my
 version) should give the same ordering, but
 model weights and interpretations of QAIC
 differences will be wrong.

  cheers
   Ben Bolker


 Anderson, D. R., K. P. Burnham, and G. C. White. 1994. AIC model selection in
 overdispersed capture-recapture data. Ecology 75, no. 6: 1780-1793.

 Richards, Shane A. 2008. Dealing with overdispersed count data in applied
 ecology. Journal of Applied Ecology 45: 218-227.
 doi:10./j.1365-2664.2007.01377.x.

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




--

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


Re: [R] Is there a way to vectorize this? [with correction]

2008-10-31 Thread Nutter, Benjamin
** Sorry to repost.  I forgot to include a function necessary to make
the example work **

I apologize up front for this being a little long. I hope it's
understandable.  Please let me know if I need to clarify anything.

Several months ago I wrote a series of functions to help me take my R
analyses and build custom reports in html files.  Each function either
builds or modifies a string of html code that can then be written to a
file to produce the desired output.

To make modifications in the html code, I've placed 'markers' around
certain characteristics that I might want to change.  For instance, the
alignment characteristics have an 'algnmark' on either side of them.
When I wish to change the alignment, I can find where these markers are,
determine their location, and replace the contents between them. 

I've been using the functions for a few months now, and am pleased with
the utility.  Unfortunately, as I was writing these, I wasn't very
strong with my vectorization skills and relied on for loops (lots of for
loops) to get through the work.  So while I'm pleased with the utility,
I've been trying to optimize the functions by vectorizing the for loops.

At this point, I've hit a small snag.  I have a situation where I can't
seem to figure out how to vectorize the loop.  Part of me wonders if it
is even possible. 

The scenario is this:  I run a string of code through the loop, on each
pass, the section of code in need of modification is identified and the
changes are made.  When this is done, however, the length of the string
changes.  The change in length needs to be recognized in the next pass
through the loop.

Okay, some code to illustrate what I mean.  This first function formats
the html file.  I only include it because it will be necessary to create
illustrate what the function is doing.  I am eliminating all comments
and spacing from the code for brevity.

#*** Start of html.file.start
'html.file.start' - function(title, size=11, font=Times New Roman){
  size - format(floor(size),nsmall=1)
  code - paste(
html xmlns:o='urn:schemas-microsoft-com:office:office\'
  xmlns:w=\'urn:schemas-microsoft-com:office:word\'
  xmlns=\'http://www.w3.org/TR/REC-html40\'
  head
meta http-equiv=Content-Type content=\'text/html;
charset=windows-1252\'
meta name=ProgId content=Word.Document
meta name=Generator content=\'Microsoft Word 11\'
meta name=Originator content=\'Microsoft Word 11\'
   style
  !--
/* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 p.MsoEndnoteText, li.MsoEndnoteText, div.MsoEndnoteText
  {margin-top:2.0pt;
  margin-right:0in;
  margin-bottom:0in;
  margin-left:.15in;
  margin-bottom:.0001pt;
  text-indent:-.15in;
  mso-pagination:none;
  font-size:9.0pt;
  mso-bidi-font-size:10.0pt;
  font-family:'Times New Roman';
  mso-fareast-font-family:'Times New Roman';}
   p.Textbody, li.Textbody, div.Textbody--
   /style
,
title,title,/title
  /head
  body lang=EN-US style=\'tab-interval:.5in;,
   textmark; font-size:,size,pt; textmark;,
   fontmark; font-family:,font,; fontmark;\', sep=)
  return(code)
} # End of html.file.start


# Start of html.text
'html.text' - function(text, size=11, font=Times New Roman,
align=left, title){
  size - format(floor(size),nsmall=1)
  if(missing(title)) title -  else title - paste(br/,title)
  title - paste(b,title,/bbr/\n,sep=)
  code - paste(
p class=MsoNormal ,
 algnmark align=,align, algnmark
  span class=GramE style=\',
 textmark; font-size:,size,pt; textmark;,
 fontmark; font-family:,font,; fontmark;,
 stylemark; font-weight:normal; font-style:normal;,
 text-decoration:none; stylemark;\',
  title,text,  
  /span
/p,sep=)
  return(code)
} #** End of html.text


So here is the function I'm trying to vectorize.

#*** Start of html.align
html.align - function(code,new.align=left){
  #* Create a string to replace the current alignment setting.
  align - paste( align=,new.align, ,sep=)

  #* Function to pass to sapply.  This is handy when 'code'
  #*  is a vector.
  f1 - function(code,align=align){
mark - unlist(gregexpr(algnmark,code)) #* Get positions of
markers
if(mark[1]0){
  odd - seq(1,length(mark),by=2) #* odd elements are starting
marker
  evn - seq(2,length(mark),by=2) #* even elements are ending marker

  mark[odd] - mark[odd]+9  #* These two lines determine the
starting
  mark[evn] - mark[evn]-1  #* and ending elements of the substring
to
#* be replaced

  for(i in 1:length(odd)){

l.old - nchar(code)  #* store the length of the code segment.

old.align - substr(code,mark[odd[i]],mark[evn[i]]) 

[R] ctree to rules conversion function

2008-10-31 Thread Sharma, Dhruv
Hi,
Similar to the R function of converting rpart into rules (see
example:
http://books.huihoo.org/data-mining-desktop-survival-guide/Convert_Tree.
html_
 is there any open code to 
convert ctree (from party) into rule format?
 
This would be very useful.
 
thanks
Dhruv
 
 
Dhruv Sharma
Credit Risk Policy and Modeling Manager
Pentagon Federal Credit Union
703-838-1086
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
 
 

[[alternative HTML version deleted]]

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


Re: [R] how to compute a roc curve

2008-10-31 Thread Frank E Harrell Jr

Pau Marc Munoz Torres wrote:

Hi,

 I'm trying to set up a prediction software, now i testing the performance
of my method, so i need to calculate a ROC curve, specially auc, cut-off,
sens and spec, i just looking at ROCH package, but it's a mass for me,  i'm
not a math guy and I'm getting lost


The use of any cutoffs will result in inefficient and arbitrary 
analyses, and note that sensitivity and specificity are improper scoring 
rules (they are optimized by a bogus model).


Frank



Could any of you recommend me an easy-to-use package to do this task? i just
have a list of positive/negative samples and his score on my program. can I
compute a roc curve with this?

thanks

pau




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



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

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


Re: [R] PAM: how to get the best number of clusters

2008-10-31 Thread Dave Roberts

Maura,

   No, in general it is not possible.  Depending on your 
goodness-of-clustering metric (and there are many besides silhouette 
width), the results may demonstrate multiple peaks and be severely 
non-monotonic.  Perhaps more problematic, silhouette width is especially 
difficult.  It is local, as opposed to global, so that it only compares 
an object to the cluster to which it is assigned and to the most similar 
cluster.  Each object in a cluster may be most similar to a different 
cluster, so that re-assigning a single plot from one cluster to another 
requires recalculating the whole mess for all clusters.  In addition, 
despite the utility of a mean silhouette width, it is insufficient as a 
metric in that many different solutions might give the same mean 
silhouette width and yet be very different in numbers of reversals 
(negative silhouette widths) or variance in within-cluster silhouette 
width.  The beauty of the silhouette width concept is the plot, and that 
means you have to actually look at the plot of the solution, and not 
simply accept a mean silhouette width.


   I think you need to consider realistically how many clusters you 
want, and limit yor consideration to solutions of approximately that number.


Good luck, Dave R.
- -

David W. Roberts office 406-994-4548
Professor and Head  FAX 406-994-3190
Department of Ecology email [EMAIL PROTECTED]
Montana State University
Bozeman, MT 59717-3460

Maura E Monville wrote:

My problem is that I have already a distance (similarity) matrix generated
outside R through a C++ code because the criteria to calculate the
distance between pairs of objects are none of the standard criteria
implemented in R.
If I got it right, but I might be mistaken, stepFlexclust() performs the
clusters layout optimization by calling either one of  kcca or cclust which
calculate their own similarity matrix.
I just need a function or method to optimize the clusters number no matter
how the similarity matrix has been generated and no matter which clustering
function I use (PAM).
Is this at all possible ?

Thank you very much,
Maura



On Fri, Oct 31, 2008 at 12:18 AM, Dylan Beaudette [EMAIL PROTECTED]

wrote:



On Thursday 30 October 2008, Maura E Monville wrote:

I have the book you mentioned. It basically describes the silhouette
method. I do not have it handy as I moved so it is still in some box.
However I cannot remember that book providing any other criterion to find
the best clusters number.
On the other hand I have the same problem with hierarchical clustering
techniques.
I use clusters as exploratory analysis because I do not have any a-priori
knowledge that helps me make a choice.
How can multivariate analysis help?
I launched a loop where the silhouette test follows PAM which is passed a
clusters number increased by 1 at each iteration.
Since I am observing that the silhouette value is now oscillating among
negative numbers, I wonder whether I can assume that it can only grow

worse

once it has turned negative the first time so leave the loop after the
first negative number and choose the clusters number associated with the
biggest positive silhouette value.
This procedure would spare a lot of CPU time.

Another approach might involve the stepFlexclust() from the flexclust
package.
See the manual page for this function for examples.

Dylan



Thank you very much,
Maura

On Thu, Oct 30, 2008 at 7:25 PM, Dylan Beaudette

[EMAIL PROTECTED]wrote:

On Thursday 30 October 2008, Maura E Monville wrote:

I have a pretty big similarity matrix (2870x2870). I will produce

even

bigger ones soon.
I am using PAM to generate clusters.
The desired number of output clusters is a PAM input parameter.
I do not know  a-priopri what is the best clusters layout .
I resorted to the silhouette test. It takes forever as I have to run
PAM with all possible
numbers of clusters.
I wonder whether there is some faster method, either a s/w code or

some

theoretical guidelines,
to get the optimum clusters number.

Thank you very much,

This is a very general topic in the field of multivariate analysis.

There

really isn't any way to know the 'correct' number of clusters, however
there
are several metrics that can give you an indication of how messy your
data are.

For information on the methods in the cluster package, see this book:

Kaufman, L.  Rousseeuw, P. J. Finding Groups in Data An Introduction

to

Cluster Analysis Wiley-Interscience, 2005

Otherwise, consider a book on multivariate analysis. Alternatively, try

a

hierarchical clustering approach, and look for meaningful groupings.

Some

thing like this:

d - diana(daisy(your_data_matrix))
d.hc - as.hclust(d)

d.hc$labels - your_data_matrix$id

plot(d.hc)

Cheers,

Dylan


--
Dylan Beaudette
Soil Resource Laboratory

Re: [R] Digest setting won't take

2008-10-31 Thread Farley, Robert
No Joy.  :-(

I've tried with both IE (7.0) and Firefox (3.0.3) and the same thing
happens.  Firefox has cookies enabled, and I set IE to explicitly allow
http://www.r-project.org/ cookies.  





 
Robert Farley
Metro
www.Metro.net 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Marianne Promberger
Sent: Friday, October 31, 2008 12:17
To: r-help@r-project.org
Subject: Re: [R] Digest setting won't take

On Friday, 31 October 2008, 10:46 (UTC-0700), Farley, Robert wrote:
 I've been trying to set my email setting to Digest Mode for a while,
but
 it doesn't seem to take.

I think I had such a problem at some point, and I think it was because
I didn't have cookies enabled in my browser.

m.




-- 
Marianne Promberger
Graduate student in Psychology
http://www.psych.upenn.edu/~mpromber

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

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


[R] Why are these different?

2008-10-31 Thread Farley, Robert
I want to import some target values to normalize elements of a
dataframe.  I'm summarizing the existing totals using
as.matrix(xtabs(~tripid_nu+lineon, data=SurveyData)) and reading a .csv
table of target values.  I can't even get them to list out as similar
data items.  

 

 

My idea is to do something like this, but I don't know how to do it in R

  SurveyData$X1 =  NewTargetX1Sums[Trip,Stop]   /
CurrentX1Sums[Trip,Stop]

   That is; a different value for X1 for each
[Trip,Stop] combination

   

 

Should I be using as.matrix?  

Why doesn't NewTargetX1Sums name the rows when CurrentX1Sums does?  

Why does NewTargetX1Sums have dots in the label spaces?

Do I have the right data organization for my problem?

 

 

 

What I've done:

 SurveyData - read.spss(C:/Data/R/orange_delivery.sav,
use.value.labels=TRUE, max.value.labels=Inf, to.data.frame=TRUE)

 NewTargetData  - read.table(C:/Data/R/NewTarget.csv, header=TRUE,
sep=,, na.strings=NA, dec=.)

 

 CurrentX1Sums - as.matrix(xtabs(~tripid_nu+lineon, data=SurveyData))


 CurrentX2Sums - apply(CurrentX1Sums, 1, sum)

 NewTargetX1Sums - as.matrix(NewTargetData)

 NewTargetX2Sums - apply(NewTargetX1Sums, 1, sum)

 

 CurrentX1Sums

 lineon

tripid_nu Warner Center De Soto Pierce College Tampa Reseda Balboa
Woodley Sepulveda Van Nuys Woodman Valley College Laurel Canyon North
Hollywood

  9011880 1   0  2 1  0  2
1 00   0  1 0
0

  9011890 0   0  0 0  0  0
1 00   0  0 1
0

  9011960 1   1  2 0  1  1
0 13   2  1 0
0

  9011970 0   0  0 0  1  0
0 16   1  1 1
14

  9012040 1   1  1 3  2  7
1 11   0  0 0
0

{Snip}

 

 NewTargetX1Sums

  tripid_nu Warner.Center De.Soto Pierce.College Tampa Reseda Balboa
Woodley Sepulveda Van.Nuys Woodman Valley.College Laurel.Canyon
North.Hollywood

 [1,]   9011880 5   2  2 2  2  2
2 22   2  6 4
1

 [2,]   9011890 1   1  1 1  1  1
2 11   1  1 2
1

 [3,]   9011960 2   2  2 1  2  2
1 23   2  2 1
1

 [4,]   9011970 1   1  1 1  2  1
1 26   2  2 2
24

 [5,]   9012040 2   2  2 3  2  7
2 22   1  1 1
1

{Snip}

 

 

 

 

 

Robert Farley

Metro

1 Gateway Plaza

Mail Stop 99-23-7

Los Angeles, CA 90012-2952

Voice: (213)922-2532

Fax:(213)922-2868

www.Metro.net 

 

 


[[alternative HTML version deleted]]

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


[R] Estimating R2 value for a unit-slope regression

2008-10-31 Thread J. Sebastian Tello
Dear all,

I am in need to estimate the amount of variation
explained in a variable after simulations that produce a predictor
which is in the same units as the dependent variable (numbers of
species). Since the dependent and predictor variables are the same, I would 
think the most appropriate analysis would be a
regression constrained to have an intercept of 0 and a slope of 1.  I
am trying to write a piece of R code to do this, but I am running into
some problems, so I wanted to ask for your advice. I have inverstigated
3 approaches, and i am including a jpg file with the behaivour of these
three pieces of code (R2 values as a function of the slope of the ols 
regression). I also included the regular R2 value from the ols regression for 
comparison (black symbols in figure).


R2 for a regression can be calculated by the formula: R2= (SSY-SSE)/SSY; so:

#1 Green symbols in figure

SSY-sum((y-mean(y))^2)
SSE-SSE-sum((y-x)^2)

R2-(SSY-SSE)/SSY

where y is the dependent and x the predictor variables respectively, of course.

However, I am running into trouble because some times the residual sum of 
squares (SSE) is larger than the SS of the
dependent variable (SSY) and I end up having negative R2s which of
course make no sense. 

Another way to put the same formula is: R2=SSR/SSR+SSE; so:

#2 Blue symbols in figure

SSR-sum((x-mean(y))^2)
SSE-sum((y-x)^2)

R2-SSR/(SSR+SSE)

This
approach behaves beter in the sense that it stays within the 0 to 1
expected range, it peaks when the slope is equal to 1, but its decal as
the slope moves away from 1 is too slow, and for example when the slope
is zero, according to this the R2 value is of about 0.4.

The third and final approach that I have used is that described by Romdal et 
al. 2005. In which they
use the second formula: R2=SSR/SSR+SSE, but they use (at least is how I
understand it) the sum of squares of a regular OLS to estimate the sum of 
squares of the regression:

so the corresponding code would be: 

#3 Red symbols in figure

lm.y.x-lm(y~x)
SSR-(deviance(lm(y~1))-sum((lm.y.x$residuals)^2))
SSE-sum((y-x)^2)

R2-SSR/(SSR+SSE)

This
also of course stays within the expected range of 0 to 1, but has its
own troubling behaivour, it does not peak at a slope of 1, there is an
accelerated decrease at slopes less than 1, but not at slopes larger
than 1, and it increases again at slopes less than 0 (like if negative
associations between y and x would be better than a flat line, when the
predictor is the same vairable as the dependen this does not make sense
again). 

Any advice, recomendations for appropiate literature, or pieces of code would 
be highly appreciated.

Best,

Sebastian


 
 J. Sebastián Tello


Department of Biological Sciences
285 Life Sciences Building
Louisiana State University
Baton Rouge, LA, 70803
(225) 578-4284 (office and lab.)



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


Re: [R] replace() error: new columns would leave holes after existing columns

2008-10-31 Thread Kellie Wills
Hi Kirsten,

The second argument of replace() is actually an index, so it's trying to
replace element number 2004-5-14 = 1985 with 134!  See ?replace.  I would
need more of your code to understand your error exactly.

I think you would be better off converting your dates to date format (?Date)
and then using the julian() function to convert them to Julian.

-- 
Kellie Wills
Engineering Service Manager
REvolution Computing



On Fri, Oct 31, 2008 at 12:17 PM, Kirsten M Barrett [EMAIL PROTECTED]wrote:

 Hello, I have a problem with using replace() to convert a vector of dates
 from -mm-dd to julian date.

 For example, I type

replace(x,2004-05-14,134)

 and I receive an error:

Error in `[-.data.frame`(`*tmp*`, list, value = 134) :
  new columns would leave holes after existing columns

 If I can successfully convert, I have a script that will convert all of
 the dates in the vector (i.e., the same line repeated with the next
 -mm-dd and corresponding julian day).  Any help would be much
 appreciated.

 Thank you,
 Kirsten

 Kirsten Barrett
 Mendenhall Postdoctoral Fellow, USGS
 Alaska Science Center
 4210 University Drive
 Anchorage, AK
[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


[R] trellis: conditional statements within a panel function

2008-10-31 Thread erwann rogard
hello,

what i'm trying to achieve is shown in the comment (# ...) below, which is
surely very wrong, but probably intuitively more meaningful that i can
provide in words.

xyplot(y~x2|x1+which,data=make.groups(
  a=data.a,
  b=data.b,
  c=data.c
 ),
 panel=function(...){
  panel.abline(a=0,b=0)
  panel.points(...)
  # if(x1==0  which==a) panel.abline(...)
 },
 layout=c(2,3),
 pch=20,
 ylim=c(-10,10),
 xlab=x2,
 cex=0.5
)

thank!

[[alternative HTML version deleted]]

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


Re: [R] Error Running TinnR with R

2008-10-31 Thread Yihui Xie
In the 'etc' directory of your installation path, e.g. C:\Program Files\R\etc

Regards,
Yihui
--
Yihui Xie [EMAIL PROTECTED]
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Sat, Nov 1, 2008 at 9:36 AM,  [EMAIL PROTECTED] wrote:
 I am sorry to be so slow but where do I find Rprofile.site?

 Thank you.

 Kevin

  Yihui Xie [EMAIL PROTECTED] wrote:
 Currently there are some problems with the building of Hmisc binary
 package; see CRAN for more information.

 My suggestion is you can remove (or comment out) the code lines not to
 use Hmisc for Tinn-R until it's available again on CRAN. As for me, I
 merely use two expressions in Rprofile.site and I have removed all the
 other code, as I don't need other functions of Tinn-R:

 options(pager=internal)
 .trPaths = c(
   'C:/Documents and Settings/username/Application Data/Tinn-R/tmp/',
   'C:/Documents and Settings/username/Application 
 Data/Tinn-R/tmp/search.txt',
   'C:/Documents and Settings/username/Application 
 Data/Tinn-R/tmp/objects.txt',
   'C:/Documents and Settings/username/Application Data/Tinn-R/tmp/file.r',
   'C:/Documents and Settings/username/Application 
 Data/Tinn-R/tmp/selection.r',
   'C:/Documents and Settings/username/Application Data/Tinn-R/tmp/block.r',
   'C:/Documents and Settings/username/Application Data/Tinn-R/tmp/lines.r')

 Regards,
 Yihui
 --
 Yihui Xie [EMAIL PROTECTED]
 Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
 Mobile: +86-15810805877
 Homepage: http://www.yihui.name
 School of Statistics, Room 1037, Mingde Main Building,
 Renmin University of China, Beijing, 100872, China



 On Fri, Oct 24, 2008 at 7:08 PM, bg708 [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I managed to get it to work this way (changing the Rprofile.site file) with
  R2.7.2. I then made the mistake of updating to R2.8, and it stopped 
  working.
  Now changing the Rprofile.site file does nothing, and sending a block of
  code gives me the Error in source(.trPaths[5], echo = T) : object
  .trPaths not found error message. I triple checked all the additional
  lines in the Rprofile.site file, path for .trPaths is correct. One point of
  note is that Hmisc package appears not to be available.
 
  Thanks for any help you could give me! Otherwise it might be wise to revert
  back to R2.7.2 or use the previous Tinn-R version.
 
  Bernardo
 

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



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


Re: [R] trellis: conditional statements within a panel function

2008-10-31 Thread Deepayan Sarkar
On 10/31/08, erwann rogard [EMAIL PROTECTED] wrote:
 hello,

  what i'm trying to achieve is shown in the comment (# ...) below, which is
  surely very wrong, but probably intuitively more meaningful that i can
  provide in words.

  xyplot(y~x2|x1+which,data=make.groups(
   a=data.a,
   b=data.b,
   c=data.c
   ),
   panel=function(...){
   panel.abline(a=0,b=0)
   panel.points(...)
   # if(x1==0  which==a) panel.abline(...)
   },
   layout=c(2,3),
   pch=20,
   ylim=c(-10,10),
   xlab=x2,
   cex=0.5
  )

Check ?which.packet.

-Deepayan

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


Re: [R] Help about the plot funtion

2008-10-31 Thread Gabor Grothendieck
Try:

?locator

On Fri, Oct 31, 2008 at 10:06 PM, German Urrus [EMAIL PROTECTED] wrote:
 Â
 Hello, my name is German, I am from Argentina, and we are working at 
 university with R. This work is about sounds and how they affect out ears, 
 we are using R to analice different recordings of sounds and we need to get 
 the intensity of this recordings in dB.  In order to get the intensity of 
 the sounds, we are using the plot function, but we can not figure out what 
 is the menaning of the graphic that we are getting, actually the values it 
 takes are between -1 and 1.Â
 It would be very helpfull for us to now what this values are, and where we 
 can get more information about the plot function, besides all the information 
 that is in the help documentation. (we already have read it, and we could not 
 find any help)
 Thanks for helping us
 Best regards
 Germán.


  Yahoo! Cocina
 Recetas prácticas y comida saludable
 http://ar.mujer.yahoo.com/cocina/
[[alternative HTML version deleted]]


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



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


[R] count data with some conditions

2008-10-31 Thread sandsky

Hi there,

I have a data set:

a=cbind(5,2,4,7,8,3,4,11,1,20)

I want to count # of data, satistfying a[1]a[2:10].

Anyone helps me solving this case?

Thank you in advance,


Jin
-- 
View this message in context: 
http://www.nabble.com/count-data-with-some-conditions-tp20275722p20275722.html
Sent from the R help mailing list archive at Nabble.com.

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