RE: [R] plotting a distribution curves

2003-09-03 Thread Hotz, T.
-Original Message- From: Petr Pikal [mailto:[EMAIL PROTECTED] Sent: 03 September 2003 13:57 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] plotting a distribution curves Hallo On 1 Sep 2003 at 16:25, Rajarshi Guha wrote: Hi, is there a way to plot

RE: [R] selecting by variable

2003-08-27 Thread Hotz, T.
Eugene, R allows indexing with logical vectors, so your example would look like hist(X[(Y=A) (Y=B)]) See the manual An Introduction to R for details. HTH Thomas -Original Message- From: Eugene Salinas [mailto:[EMAIL PROTECTED] Sent: 27 August 2003 09:49 To: [EMAIL PROTECTED]

RE: [R] Basic GLM: residuals definition

2003-08-27 Thread Hotz, T.
As ?residuals.glm reveals, it's got an argument type: type: the type of residuals which should be returned. The alternatives are: `deviance' (default), `pearson', `working', `response', and `partial'. You calculated response residuals, R gives deviance residuals by

RE: [R] grid Graphics by Paul Murrell

2003-08-20 Thread Hotz, T.
Simon, You might want to have a look at these two articles in R News (http://CRAN.R-project.org/doc/Rnews/): Paul Murrell. The grid graphics package. R News, 2(2):14-19, June 2002. Deepayan Sarkar. Lattice. R News, 2(2):19-23, June 2002. HTH Thomas -Original Message- From: Roger

RE: [R] Merging and sorting multiple data.frame

2003-08-15 Thread Hotz, T.
Dear Aedin, Similar questions have been asked quite often on this list. See FAQ 7.25, the manual An Introduction to R, and the online help, especially ?merge, ?sort, ?order, and ?data.frame. HTH Thomas -Original Message- From: Culhane, Aedin [mailto:[EMAIL PROTECTED] Sent: 15

RE: [R] Is it possible to separate two independent components fromarandom variable?

2003-08-15 Thread Hotz, T.
Dear Fred, If x1 and x2 are *not* normally distributed, you can use independent component analysis (ICA) which is based on the idea that x will be more normal than either x1 and x2 following the central limit theorem. See package(fastICA) by JL Marchini, C Heaton, and BD Ripley for details. HTH

RE: [R] placing labels in polygon center ?

2003-08-14 Thread Hotz, T.
Dear Jens, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 13 August 2003 10:01 To: [EMAIL PROTECTED] Subject: [R] placing labels in polygon center ? Dear all, is there any function to calculate the center of a polygon mass in R? Actually I need to

RE: [R] Sorting a dataframe

2003-08-14 Thread Hotz, T.
Dear Paul, Use order() to get the indices of the ordered rows. See ?order blah - data.frame(X = rep(3:1, each=4), Y = rep(c(2,1,2,1), 3), Z = rep(2:1, 6)) blah X Y Z 1 3 2 2 2 3 1 1 3 3 2 2 4 3 1 1 5 2 2 2 6 2 1 1 7 2 2 2 8 2 1 1 9 1 2 2 10 1 1 1 11 1 2 2 12 1 1 1 blah -

RE: [R] variable name of variable in dataframe

2003-07-25 Thread Hotz, T.
Dear Tobias, The trick is Programming on the Language, see e.g. the R Language Manual. Construct the expression you want, and have it explicitly parsed and evaluated. toy - function(b=.95){ toyframe - eval(parse(text=paste(data.frame(lion, b, = c(1, 2)), sep=))) return(toyframe) z} toy()

RE: [R] Confidence Band for empirical distribution function

2003-07-24 Thread Hotz, T.
July 2003 15:46 To: Hotz, T. Subject: RE: [R] Confidence Band for empirical distribution function On 22 Jul 2003 at 11:37, Hotz, T. wrote: Dear Leif, If you look at the definition of ks.test, you'll find the lines pkstwo - function(x, tol = 1e-06) { if (is.numeric(x

RE: [R] median and joint distribution

2003-07-24 Thread Hotz, T.
Dear Salvatore, Assuming that you mean convolution when you write additive linkage, the answer is that there is no general answer. It will depend heavily on the joint distribution of the two random variables. Just to give a simple example, let X~f, Y~g, and P(X=0.4)=P(Y=0.4)=1. Then, X and Y

RE: [R] Confidence Band for empirical distribution function

2003-07-22 Thread Hotz, T.
Dear Leif, If you look at the definition of ks.test, you'll find the lines pkstwo - function(x, tol = 1e-06) { if (is.numeric(x)) x - as.vector(x) else stop(Argument x must be numeric) p - rep(0, length(x)) p[is.na(x)] - NA IND - which(!is.na(x) (x 0)) if

RE: [R] variable names

2003-07-22 Thread Hotz, T.
Dear Luis, You might want to have a look at Bill Venables. Programmer's niche. R News, 2(2):24-26, June 2002 which you can find at http://cran.r-project.org/doc/Rnews/ or look into the manual R Language Definition, chapter Computing on the language. Assuming that in your case the variable to be

RE: [R] Plotting a graph of many lines between groups of points...

2003-07-16 Thread Hotz, T.
Dear Andrew, Assuming your variables are called V1 to V4, and are vectors, I'd use something like plot(V1,V2,xlim=range(V1,V3),ylim=range(V2,V4),type=n) segments(V1,V2,V3,V4) HTH Thomas --- Thomas Hotz Research Associate in Medical Statistics University of Leicester United Kingdom

RE: [R] clearing some part of a graph

2003-07-15 Thread Hotz, T.
Dear Vincent, You can't clear a title only. The idea is to plot without one, like plot(...,main=,sub=,xlab=,ylab=) and add the title by hand (as you mentioned). Moreover, AFAIK you can't clear one plot in a multiple figure environment, since you can only clear the graphics device (not the

RE: [R] skip first line with read.table (was: no subject)

2003-07-15 Thread Hotz, T.
Dear Michael, There was an email thread midst June 2003 on a related issue. The suggestions made there will certainly help you Have a look for thread Programcode and data in the same textfile (just type it into the R Site Search, and the thread will come up). I recall that read.table() has an

RE: [R] lists

2003-07-09 Thread Hotz, T.
my.list-list(a=1,b=2) length(my.list) [1] 2 my.list$c-3 my.list[[length(my.list)+1]]-4 my.list $a [1] 1 $b [1] 2 $c [1] 3 [[4]] [1] 4 HTH Thomas --- Thomas Hotz Research Associate in Medical Statistics University of Leicester United Kingdom Department of Epidemiology and Public Health

RE: [R] ?plot problem

2003-06-24 Thread Hotz, T.
-Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: 23 June 2003 22:35 To: Paul, David A Cc: [EMAIL PROTECTED] Subject: Re: [R] ?plot problem On Mon, 23 Jun 2003, Paul, David A wrote: R1.7.0, Win2k: When I use plot( ) on a groupedData object,

RE: [R] Smooth of a temporal serie

2003-06-24 Thread Hotz, T.
If you are talking about a running median smooth à la Tukey, smooth() in library(eda) might be of help. Best wishes Thomas -Original Message- From: Henrique Patrício Sant'Anna Branco [mailto:[EMAIL PROTECTED] Sent: 23 June 2003 23:53 To: [EMAIL PROTECTED] Subject: [R] Smooth of

[R] Error when creating layouts with partly filled pages withinlattice

2003-06-06 Thread Hotz, T.
Dear all, Please take my apologies if that has already been asked - at least I couldn't find it in the archives. When trying to specify a layout within library lattice, i.e. using xyplot, I get an error when the prepanel function tries to subscript the automatically generated x.limits. This

RE: [R] counting missing values

2003-06-06 Thread Hotz, T.
Dear Vincent I'd like to know if there is a function already implemented to count the number of occurence of a given values in a vector Does my.matrix-cbind(c(0,1,NA),c(NA,1,NA)) count.NA-function(the.matrix){ result-t(apply(the.matrix,1,function(x,n){ m-sum(is.na(x)) c(m,m/n)

RE: [R] dynamics of functions

2003-06-06 Thread Hotz, T.
Dear Tobias, I would like to study the dynamics of functions using R (instead of mathematica e.g.), i.e. the behavior of points under iteration of a function. So I tried (in vain) writing a function myfunction - function(f,n,x){...} in order to compute f^{n}(x), f^{n}(x) being the

RE: [R] R help: Correlograms

2003-06-06 Thread Hotz, T.
I have time series and need to draw simple and partial correlograms with associated Q-statistics (the same as in EViews). Can I do it in R? Thanks library(ts) contains functions acf and pacf which come with corresponding plot methods. See their help pages for details. I don't know anything

RE: [R] layout problem

2003-06-06 Thread Hotz, T.
I have a question about using the layout command within a function. I've written function that uses layout to create a figure from 2 plots. This works fine to create a figure. When I use par(mfrow = c(2,2)) to create multiple plots, it seems that the layout command resets the mfrow