Re: [R] Adding predicted values as a new variable in a data frame

2006-09-14 Thread Gabor Grothendieck
Specify na.action = na.exlude, e.g. x - y - 1:10; x[5] - NA fitted(lm(y ~ x, na.action = na.exclude)) 1 2 3 4 5 6 7 8 9 10 1 2 3 4 NA 6 7 8 9 10 On 9/14/06, Robi Ragan [EMAIL PROTECTED] wrote: I am running a regression: ols.reg1 - lm(y ~ x1 + x2 + x3 + x4) on a data.frame

Re: [R] Rv generation

2006-09-14 Thread nmi13
Hi, Can Someone inform me how to generate RV's using the below CDF, by inverse technique. Thanks for your help and time. My CDF is as follows \[ F(x)=0 \ \text{if} \ x 0\]\[ F(x)=\{\frac{x-x_i}{x_{i+1}-x_{i}}*(p_{i+1}-p_{i})\}+p_{i}\ \forall \ x_{i}\leq x x_{i+1} \] \[ F(x)=1 \ \text{if} \

Re: [R] Adding predicted values as a new variable in a data frame

2006-09-14 Thread Prof Brian D Ripley
?na.exclude should help you: my guess is that you asked (by using the default) na.action = na.omit) for rows with missing values to be excluded from the residuals. But since you have not mentioned missing values, we have to guess what 'for some reason' was: please note the footer of this

Re: [R] an error message with 't.test' with R under Unix

2006-09-14 Thread Peter Dalgaard
Tao Shi [EMAIL PROTECTED] writes: Again, I don't see the error in R under Windows (R 2.3.0) or Unix (R2.3.1). Is this the bug you were talking about? CHANGES IN R VERSION 2.3.0 o Some of the classical tests put unnecessary restrictions on the LHS in the

Re: [R] Conservative ANOVA tables in lmer

2006-09-14 Thread Dimitris Rizopoulos
- Original Message - From: Manuel Morales [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Douglas Bates [EMAIL PROTECTED]; Manuel Morales [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Sent: Wednesday, September 13, 2006 1:04 PM Subject: Re: [R] Conservative ANOVA tables in lmer On Wed,

Re: [R] Conservative ANOVA tables in lmer

2006-09-14 Thread Douglas Bates
On 9/13/06, Dimitris Rizopoulos [EMAIL PROTECTED] wrote: - Original Message - From: Manuel Morales [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Douglas Bates [EMAIL PROTECTED]; Manuel Morales [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Sent: Wednesday, September 13, 2006 1:04 PM

[R] ANOVA in R

2006-09-14 Thread Russell Compton
Despite having used R on a daily basis for the past two years, I’m encountering some difficulty performing an ANOVA on my data. What I’m trying to do is the following:   Given data such as:   Day 1    Day 4    Day 8 2  7  2 3  2  8  3  4  7

Re: [R] Conservative ANOVA tables in lmer

2006-09-14 Thread Douglas Bates
On 9/13/06, Dimitris Rizopoulos [EMAIL PROTECTED] wrote: - Original Message - From: Manuel Morales [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Douglas Bates [EMAIL PROTECTED]; Manuel Morales [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Sent: Wednesday, September 13, 2006 1:04 PM

[R] ANOVA in R

2006-09-14 Thread Russell Compton
Despite having used R on a daily basis for the past two years, I'm encountering some difficulty performing an ANOVA on my data. What I'm trying to do is the following: Given data such as: Day 1Day 4Day 8 2 7 2 3 2 8 3 4

Re: [R] ANOVA in R

2006-09-14 Thread Andrew Robinson
Try test - data.frame(day.1=c(2,3,3,6,1), day.4=c(7,2,4,6,3), day.8=c(2,8,7,8,4)) test test.long - reshape(test, direction=long, varying=c(day.1,day.4,day.8), v.names=response, timevar=day, times=names(test)) test.long$day -

[R] R input output error

2006-09-14 Thread Johannes Jenkner
Dear R users! I have some problems with some cronjobs containing R programs in batch mode. The CPU load always is quite high, as I plot some weather charts which require extensive interpolation procedures. The crucial point is that I frequently get R input/output errors, if my linux PC

Re: [R] ANOVA in R

2006-09-14 Thread Peter Dalgaard
Andrew Robinson [EMAIL PROTECTED] writes: Try test - data.frame(day.1=c(2,3,3,6,1), day.4=c(7,2,4,6,3), day.8=c(2,8,7,8,4)) test test.long - reshape(test, direction=long, varying=c(day.1,day.4,day.8), v.names=response, timevar=day,

Re: [R] ANOVA in R

2006-09-14 Thread Russell Compton
Andrew, Peter, Thanks both for the help, that's exactly what I was after. It is for a one-way ANOVA, looking at identifying differentially expressed genes across time in a microarray dataset. Also, one of the datasets I'm working with is unbalanced, so that additional code will be most useful.

[R] Greedy triangulation

2006-09-14 Thread Dan Bebber
Hello, does anyone have code that will generate a greedy triangulation (triangulation that uses shortest non-overlapping edges) for a set of points in Euclidean space? Thanks, Dan Bebber ___ Dr. Daniel P. Bebber Department of Plant Sciences University of Oxford South Parks

Re: [R] Conservative

2006-09-14 Thread Gregor Gorjanc
Douglas Bates bates at stat.wisc.edu writes: On 9/13/06, Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be I believe that the LRT is anti-conservative for fixed effects, as described in Pinheiro and Bates companion book to NLME. You have this effect if you're using REML, for

Re: [R] kendall's w

2006-09-14 Thread Jim Lemon
Bianca Vieru wrote: Hi, I try to calculate Kendall's W coefficient and I have a bizarre error. little.app.mat-matrix(c(1,3,4,2,6,5,2,4,3,1,5,6,3,2,5,1,5,4),nrow=3,byrow=TRUE) print(kendall.w(little.app.mat[-1,])) Kendall's W for ordinal data W = 0.7753623Error in if

Re: [R] Conservative

2006-09-14 Thread Peter Dalgaard
Gregor Gorjanc [EMAIL PROTECTED] writes: Douglas Bates bates at stat.wisc.edu writes: On 9/13/06, Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be I believe that the LRT is anti-conservative for fixed effects, as described in Pinheiro and Bates companion book to NLME.

Re: [R] Rv generation

2006-09-14 Thread Duncan Murdoch
On 9/14/2006 2:16 AM, nmi13 wrote: Hi, Can Someone inform me how to generate RV's using the below CDF, by inverse technique. Thanks for your help and time. My CDF is as follows \[ F(x)=0 \ \text{if} \ x 0\]\[ F(x)=\{\frac{x-x_i}{x_{i+1}-x_{i}}*(p_{i+1}-p_{i})\}+p_{i}\ \forall \

[R] Binomial test using R

2006-09-14 Thread Srinivasan Ramachandran
Hullo, Can someone suggest whether the binomial test as described in the link http://home.clara.net/sisa/binomial.htm is available in an equivalent form in R? I have downloaded the R package from the CRAN site. Using R will help me do this test rapidly Many Thanks Ramachandran Dr. S.

Re: [R] Binomial test using R

2006-09-14 Thread Peter Dalgaard
Srinivasan Ramachandran [EMAIL PROTECTED] writes: Hullo, Can someone suggest whether the binomial test as described in the link http://home.clara.net/sisa/binomial.htm is available in an equivalent form in R? I have downloaded the R package from the CRAN site. Using R will help me do

[R] Run-time error 521 in SciViews

2006-09-14 Thread Wuming Gong
Dear list, I use SciViews R Console 0.8.9 with R-2.2.1 under Windows XP SP2, and it works very well for most of time. However, sometimes, when commands were executed by clicking F5, the error Run-time error 521, Can't open clipboard pop out. After choosing Yes, the both R console and SciViews

[R] plotting all subgroups with augPred

2006-09-14 Thread Afshartous, David
All, I have a question RE plotting the prediction lines of a random effects model via augPred. I'll illustrate via the Pixel dataset within the nlme package: library(nlme) attach(Pixel) fm1Pixel = lme(pixel ~ day + I(day^2), data = Pixel, random = list(Dog = ~ 1)) plot(augPred(fm1Pixel)) ###

[R] working with strptime data

2006-09-14 Thread Richard Evans
Dear R-forum, I am looking for a good resource/help on working with POSIXct values and controlling the pretty x-axis labels and tick marks for a data VS time plots. Specifically, I wish to do programming logic which creates different vertical ablines calculations based on the range of times which

[R] time varying covariates

2006-09-14 Thread Martin Wagner
Hello, I am trying to model an intensity function with time-varying covariates. Before, I have successfully defined a log likelihood function for a Power-Law Process (lambda(t)=alpha*beta*t^(beta-1)) with two paramters and no covariates for a repairable systems with failure times (t). This

[R] Problem setting options(error=recover) in my Rprofile.site

2006-09-14 Thread Marcus, Jeffrey
I'd like to be able to set options(error=recover) in my Rprofile.site file. When I do this I get the message Error in options(error = recover) : object recover not found I assume this is because the utils package (where recover and dump.frames are defined) has not been loaded at the time I make

Re: [R] Greedy triangulation

2006-09-14 Thread Greg Snow
Does the deldir package do what you want? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bebber Sent: Thursday, September 14, 2006

Re: [R] Greedy triangulation

2006-09-14 Thread roger koenker
Or, perhaps, tripack? 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 Sep 14, 2006, at 10:32 AM, Greg

Re: [R] Greedy triangulation

2006-09-14 Thread Dan Bebber
Thanks, but no, the Delaunay is different. I have written the following, which interested persons might want to check for accuracy and streamlining: #GREEDY TRIANGULATION # #Pick all lines that are shortest and don't overlap, starting with shortest. # greedy-function(xy){ #input is a matrix

Re: [R] time varying covariates

2006-09-14 Thread David Barron
Have a look at the survSplit function in the survival package. It looks to me as though you could use survreg with the weibull option to achieve what you want. Otherwise, you'll have to rewrite the likelihood in terms of both start and end times. On 14/09/06, Martin Wagner [EMAIL PROTECTED]

Re: [R] Problem setting options(error=recover) in my Rprofile.site

2006-09-14 Thread Prof Brian D Ripley
On Thu, 14 Sep 2006, Marcus, Jeffrey wrote: I'd like to be able to set options(error=recover) in my Rprofile.site file. When I do this I get the message Error in options(error = recover) : object recover not found I assume this is because the utils package (where recover and dump.frames are

[R] Beta stochastic simulation

2006-09-14 Thread Mark Pinkerton
Hi, I am finding that I get quite different results when I interchange the following equivalent lines for sampling from a beta distribution in my r script. The rbeta line is correct judging by the summary statistics of the simulated values, while the qbeta line consistently leads to a higher mean

[R] polr

2006-09-14 Thread grazia
Dear R heplper, I'm using polr: fm - polr(factor(y) ~ x, ,method='logistic', data = dat, Hess=T) ans I'm getting a very strange message: Error in optim(start, fmin, gmin, method = BFGS, hessian = Hess, ...) : initial value in 'vmmin' is not finite Can you help me? Thank you in advance, Grazia

Re: [R] Beta stochastic simulation

2006-09-14 Thread Duncan Murdoch
On 9/14/2006 1:42 PM, Mark Pinkerton wrote: Hi, I am finding that I get quite different results when I interchange the following equivalent lines for sampling from a beta distribution in my r script. The rbeta line is correct judging by the summary statistics of the simulated values, while

[R] Help On EBAM

2006-09-14 Thread Learning R
Dear RUsers, I am new to R. I am learning how to use R. I am a PC user and run R on windows. I would appreciate if some one could guide me on a few questions I have: 1) I have 4 cel files (2 replicates for NORM and Disease resp). I have been able to run siggenes on this dataset where I have 4

[R] converting strings to expressions

2006-09-14 Thread Deepayan Sarkar
Hi, consider this: -- estr - c(2^4, alpha[1]) eexp - expression(2^4, alpha[1]) ## Is it possible to get 'eexp' starting from 'estr'? The closest I could ## get was: do.call(expression, lapply(estr, as.name)) ## but it is not quite the same; e.g. the following behave differently:

Re: [R] converting strings to expressions

2006-09-14 Thread Peter Dalgaard
Deepayan Sarkar [EMAIL PROTECTED] writes: Hi, consider this: -- estr - c(2^4, alpha[1]) eexp - expression(2^4, alpha[1]) ## Is it possible to get 'eexp' starting from 'estr'? The closest I could ## get was: do.call(expression, lapply(estr, as.name)) ## but it is

Re: [R] converting strings to expressions

2006-09-14 Thread Sundar Dorai-Raj
Deepayan Sarkar said the following on 9/14/2006 2:31 PM: Hi, consider this: -- estr - c(2^4, alpha[1]) eexp - expression(2^4, alpha[1]) ## Is it possible to get 'eexp' starting from 'estr'? The closest I could ## get was: do.call(expression, lapply(estr, as.name))

Re: [R] converting strings to expressions

2006-09-14 Thread Deepayan Sarkar
On 14 Sep 2006 21:44:01 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: Deepayan Sarkar [EMAIL PROTECTED] writes: Hi, consider this: -- estr - c(2^4, alpha[1]) eexp - expression(2^4, alpha[1]) ## Is it possible to get 'eexp' starting from 'estr'? The closest I

Re: [R] converting strings to expressions

2006-09-14 Thread Richard M. Heiberger
sapply(estr, FUN=function(x) parse(text=x)) and it does print the greek letter in the xlab. xyplot(1:10 ~ 1:10, scales = list(x = list(at = c(3, 6), labels = sapply(estr, FUN=function(x) parse(text=x) Rich __

Re: [R] converting strings to expressions

2006-09-14 Thread Prof Brian Ripley
On Thu, 14 Sep 2006, Deepayan Sarkar wrote: [...] Ah, I'd forgotten about parse. A link from ?expression might be reasonable. But it says Details: 'Expression' here is not being used in its colloquial sense, that of mathematical expressions. Those are calls (see 'call') in R,

Re: [R] converting strings to expressions

2006-09-14 Thread Peter Dalgaard
Prof Brian Ripley [EMAIL PROTECTED] writes: On Thu, 14 Sep 2006, Deepayan Sarkar wrote: [...] Ah, I'd forgotten about parse. A link from ?expression might be reasonable. But it says Details: 'Expression' here is not being used in its colloquial sense, that of

Re: [R] group bunch of lines in a data.frame, an additional requirement

2006-09-14 Thread Emmanuel Levy
Thanks Gabor, that is much faster than using a loop! I've got a last question: Can you think of a fast way of keeping track of the number of observations collapsed for each entry? i.e. I'd like to end up with: A 2.0 400 ID1 3 (3obs in the first matrix) B 0.7 35 ID2 2 (2obs in the first matrix)

Re: [R] converting strings to expressions

2006-09-14 Thread Peter Dalgaard
Peter Dalgaard [EMAIL PROTECTED] writes: Actually, you need to be even more careful because has commonly been Drats! ...because _what_ has..., of course. Talk about being careful. called unevaluated expressions cover symbols and constants too. I.e., quote(1) and quote(x) are not calls. And

Re: [R] converting strings to expressions

2006-09-14 Thread Deepayan Sarkar
On 9/14/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Thu, 14 Sep 2006, Deepayan Sarkar wrote: [...] Ah, I'd forgotten about parse. A link from ?expression might be reasonable. But it says Details: 'Expression' here is not being used in its colloquial sense, that of

[R] hist for two sets

2006-09-14 Thread Ethan Johnsons
A quick question, please. x = c(0.0001, 0.0059, 0.0855, 0.9082) y = c(0.54, 0.813, 0.379, 0.35) where A = 1st set, B = 2nd set, C = 3rd set, D = 4th set respectivley. How do you make hist plot side by side for x y? i.e. 0.0001 and then to the right 0.54, 0.0059 and then to the right 0.813,

Re: [R] Beta stochastic simulation

2006-09-14 Thread Duncan Murdoch
On 9/14/2006 5:26 PM, Mark Pinkerton wrote: Hi Duncan, I had also validated the logic with a simple test which is why I was surprised by the differences I was seeing from tthe more complex simulation. I am running R on a Windows 2000 - I'll have to check which version at my desk tomorrow

[R] EBAM ERROR

2006-09-14 Thread Learning R
Dear RUsers, I am new to R. I am learning how to use R. I am a PC user and run R on windows. I would appreciate if some one could guide me on a few questions I have: 1) I have 4 cel files (2 replicates for NORM and Disease resp). I have been able to run siggenes on this dataset where I have 4

Re: [R] hist for two sets

2006-09-14 Thread Marc Schwartz
On Thu, 2006-09-14 at 19:37 -0400, Ethan Johnsons wrote: A quick question, please. x = c(0.0001, 0.0059, 0.0855, 0.9082) y = c(0.54, 0.813, 0.379, 0.35) where A = 1st set, B = 2nd set, C = 3rd set, D = 4th set respectivley. How do you make hist plot side by side for x y? i.e. 0.0001

[R] what does Height represent?

2006-09-14 Thread zhaoshi
hi-- I am new to R and try to use R cluster my binary data. I use hierarchical clustering plot (hclust (dist(x,method=binary),method=average),cex=0.1) I end up with a cluster Dendrogram. On the left of my dendrogram, there is scale called Height from 0.0 to 1.0. I don't understand what does

Re: [R] group bunch of lines in a data.frame, an additional requirement

2006-09-14 Thread Marc Schwartz
Emmanuel, I wouldn't be surprised if Gabor comes up with something, but since aggregate() can only return scalars, you can't do it in one step here. There are possibilities using other functions such as split(), tapply() or by(), but each has it own respective limitations requiring more than one

Re: [R] working with strptime data

2006-09-14 Thread Gabor Grothendieck
Read the help desk article in R News 4/1. On 9/14/06, Richard Evans [EMAIL PROTECTED] wrote: Dear R-forum, I am looking for a good resource/help on working with POSIXct values and controlling the pretty x-axis labels and tick marks for a data VS time plots. Specifically, I wish to do

[R] Table manipulation question

2006-09-14 Thread Geoff Russell
I have a table: C1 RowName13 RowName22 and another table: C2 RowName15.6 RowName1a 4.3 RowName2NA I want to join join the tables with matching rows: C1 C2 RowName1 3

Re: [R] group bunch of lines in a data.frame, an additional requirement

2006-09-14 Thread Gabor Grothendieck
Here are three different ways to do it: # base R fb - function(x) c(V1 = x$V1[1], V4 = x$V4[1], V2.mean = mean(x$V2), V3.mean = mean(x$V3), n = length(x$V1)) do.call(rbind, by(DF, DF[c(1,4)], fb)) # package doBy library(doBy) summaryBy(V2 + V3 ~ V1 + V4, DF, FUN = c(mean, length))[,-5]

Re: [R] Table manipulation question

2006-09-14 Thread Wensui Liu
Hi, Russell, Here is a piece of code and you might need to tweak it a little. MERGE 2 DATA FRAMES### # MERGE 2 DATA FRAMES:# # INNER JOIN, LEFT JOIN, RIGHT JOIN, # # FULL JOIN, CARTESIAN PRODUCT # ###

Re: [R] hist for two sets

2006-09-14 Thread Ethan Johnsons
thx so much, Marc. ej On 9/14/06, Marc Schwartz [EMAIL PROTECTED] wrote: On Thu, 2006-09-14 at 19:37 -0400, Ethan Johnsons wrote: A quick question, please. x = c(0.0001, 0.0059, 0.0855, 0.9082) y = c(0.54, 0.813, 0.379, 0.35) where A = 1st set, B = 2nd set, C = 3rd set, D = 4th set

[R] plot region too large

2006-09-14 Thread Kamila Naxerova
Hi! I don't understand this: layout(matrix(c(1:10),5,2),heights=c(1,rep(2,4))) plot(1,1) error in plot.new() : plot region too large Why?? Thanks! Kamila __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] plot region too large

2006-09-14 Thread Kiermeier, Andreas \(PIRSA - SARDI\)
The figure margins come from what is set in par(mar), eg layout(matrix(c(1:10),5,2),heights=c(1,rep(2,4))) par(mar) [1] 5.1 4.1 4.1 2.1 There is not enough space left to plot anything with those margins. You will need to make them smaller first, e.g. par(mar=c(1,1,1,1,)) plot(1,1) In