Re: [R] matrix row product and cumulative product

2008-08-17 Thread Moshe Olshansky
Hi Jeff, If I understand correctly, the overhead of a loop is that at each iteration the command must be interpreted, and this time is independent of the number of rows N. So if N is small this overhead may be very significant but when N is large this should be very small compared to the time n

Re: [R] Fucntion scope question. General non-linear solution help.

2008-08-17 Thread Prof Brian Ripley
Looks like you want to solve pbinom(k-1, N, p) = 0.5 for p. That is easy: use uniroot. testit <- function(k, N) { fn <- function(p, k, N) pbinom(k-1, N, p) - 0.5 uniroot(fn, c(0,1), k=k, N=N) } testit(6, 10) On Sun, 17 Aug 2008, [EMAIL PROTECTED] wrote: I would like to solve the equa

Re: [R] exporting adaBoost model

2008-08-17 Thread Hans W. Borchers
One way to port these kinds of models between applications is the Predictive Model Markup Language (PMML). The R package 'PMML' supports linear regression, rpart, SVM, and others, not adaBoost. On the other side, not even the Python machine learning library Orange does have an import function fo

Re: [R] graphsheet

2008-08-17 Thread Prof Brian Ripley
You were probably referring to https://stat.ethz.ch/pipermail/r-help/2008-April/160078.html but a reference to ?windows would have sufficed. On Mon, 18 Aug 2008, Duncan Mackay wrote: At 14:53 18/08/2008, you wrote: Hello, I am trying to convert the following command from SPLUS to R: grap

Re: [R] Optim stripping attributes from relistable objects

2008-08-17 Thread Prof Brian Ripley
On Mon, 18 Aug 2008, Katharine Mullen wrote: The following code is inspired by the help file for the relist() function (see?relist), which explicitly details how you can use a The example is in the 'Details' section and, indeed, it looks like it no longer works. I don't think it ever did (a

Re: [R] graphsheet

2008-08-17 Thread Duncan Mackay
At 14:53 18/08/2008, you wrote: Hello, I am trying to convert the following command from SPLUS to R: graphsheet(pages = TRUE) Does anyone have an idea what is the equivalent in R? Thanks -- View this message in context: http://www.nabble.com/graphsheet-tp19026010p19026010.html Sent from

[R] Fucntion scope question. General non-linear solution help.

2008-08-17 Thread rkevinburton
I would like to solve the equation is is the sum from k = i to N of choose(N,k) * MR ^ k * (1 - MR) ^ (N - k) - 0.50 = 0 I want to solve for MR. This seems like a non-linear equation to me. But I am having a hard time writing the function that implements the above. I could use 'for(...) as a br

[R] graphsheet

2008-08-17 Thread Applejus
Hello, I am trying to convert the following command from SPLUS to R: graphsheet(pages = TRUE) Does anyone have an idea what is the equivalent in R? Thanks -- View this message in context: http://www.nabble.com/graphsheet-tp19026010p19026010.html Sent from the R help mailing list archive at

Re: [R] matrix row product and cumulative product

2008-08-17 Thread Charles C. Berry
On Sun, 17 Aug 2008, Jeff Laake wrote: I spent a lot of time searching and came up empty handed on the following query. Is there an equivalent to rowSums that does product or cumulative product and avoids use of apply or looping? I found a rowProd in a package but it was a convenience function

[R] matrix row product and cumulative product

2008-08-17 Thread Jeff Laake
I spent a lot of time searching and came up empty handed on the following query. Is there an equivalent to rowSums that does product or cumulative product and avoids use of apply or looping? I found a rowProd in a package but it was a convenience function for apply. As part of a likelihood calc

Re: [R] Multiple Plotting help (lines don't always connect)

2008-08-17 Thread Rolf Turner
There was a thread on this recently. Solutions were posted to allow you to join interpolated points to ``real'' ones using a different line type. See http://finzi.psych.upenn.edu/R/Rhelp02a/archive/127669.html cheers, Rolf Turner On 18/08/2008, at 2:10 PM, jim holt

Re: [R] Multiple Plotting help (lines don't always connect)

2008-08-17 Thread jim holtman
You can also do: plot(approx(d[,1], d[,2], xout=d[,1]), type='b') This will interprete the values between the missing values, but it is probably best to leave it as you first had it with the missing lines so that you know there is something different in the data. On Sun, Aug 17, 2008 at 6:55 PM,

Re: [R] Multiple Plotting help (lines don't always connect)

2008-08-17 Thread markleeds
I don't know if it's the best way but you can do d<-d[complete.cases(d),] plot(d, type="b") plot doesn't connect the points when there are NAs between them. On Sun, Aug 17, 2008 at 9:55 PM, stephen sefick wrote: d <- structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5

Re: [R] Multiple Plotting help (lines don't always connect)

2008-08-17 Thread jim holtman
You have to get rid of the NAs since they indicate that there are no values and will not draw a line: > c.d <- d[complete.cases(d),] > plot(c.d, type='b') > On Sun, Aug 17, 2008 at 6:55 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > d <- structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14

[R] Multiple Plotting help (lines don't always connect)

2008-08-17 Thread stephen sefick
d <- structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, NA, NA, NA, 14), .Dim = c(14L, 2L ), .Dimnames = list(NULL, c("a", "b"))) plot(d, type="b") This is simplified, but Is there an option I am missing that will force all of the points to be joined by a lin

Re: [R] trying to mimic page 70 of Software for Data Analysis

2008-08-17 Thread Marc Schwartz
on 08/17/2008 07:15 PM [EMAIL PROTECTED] wrote: > I was trying to do what is on page 70 of John Chambers' new book namely > using trace to invoke the browser by doing > > trace(zapsmall, edit = TRUE) > > but , typing above at an R prompt, I get > > trace(zapsmall, edit=TRUE) > sh: EMACS: comman

[R] i fixed my previous trace problem

2008-08-17 Thread markleeds
My previous problem with the emacs editor was that I had options(editor="EMACS", when it should have been small letters as in options(editor="emacs",papersize="letter", width=180, htmlhelp=FALSE, browser="/usr/bin/firefox") Thanks for the help that I'm confident would have been there if I di

[R] trying to mimic page 70 of Software for Data Analysis

2008-08-17 Thread markleeds
I was trying to do what is on page 70 of John Chambers' new book namely using trace to invoke the browser by doing trace(zapsmall, edit = TRUE) but , typing above at an R prompt, I get trace(zapsmall, edit=TRUE) sh: EMACS: command not found Error in edit(name, file, title, editor) : problem

[R] before-after control-impact analysis with R

2008-08-17 Thread Nikolaos Lampadariou
Hello everybody, In am trying to analyse a BACI experiment and I really want to do it with R (which I find really exciting). So, before moving on I though it would be a good idea to repeat some known experiments which are quite similar to my own. I tried to reproduce 2 published examples but

Re: [R] grangertest/lmtest ... what am I doing wrong ?

2008-08-17 Thread Achim Zeileis
On Sun, 17 Aug 2008, [EMAIL PROTECTED] wrote: Dear Achim, R Users, What am I doing wrong in this example ? The Granger test of x and y with lag k tests the significance of the x variables in y ~ Lags(y, 1:k) + Lags(x, 1:k) If x is already a lag of y (as in your example), this is not reall

Re: [R] Optim stripping attributes from relistable objects

2008-08-17 Thread Katharine Mullen
> > The following code is inspired by the help file for the relist() > function (see?relist), which explicitly details how you can use a The example is in the 'Details' section and, indeed, it looks like it no longer works. > relistable object in conjunction with optim to pass and reconstruct > c

Re: [R] Axes in filled.contour plots [Solved]

2008-08-17 Thread hippie dream
I should let you guys know that I figured this whole axes on filled contour plots issue out. This might not be the most elegant solution but it will work me: filled.contour(contour, axes=F, frame.plot=TRUE, color=terrain.colors, ylab= "Length Along Flume (m)", key.title = title(main="Velocity\n(m

[R] Optim stripping attributes from relistable objects

2008-08-17 Thread rhelp . 20 . trevva
Dear all, The following code is inspired by the help file for the relist() function (see?relist), which explicitly details how you can use a relistable object in conjunction with optim to pass and reconstruct complex parameter structures/groupings. The idea is that the optim() function can only wo

Re: [R] Making use of names of viewports (grid)

2008-08-17 Thread Paul Murrell
Hi Patrick Connolly wrote: > The following code, though not brilliant, works on an A4 page. It > might look odd on other devices of a very different size. > > =X8--- cut here > require(grid) > wide <- 15 > vps <- grid.layout(nrow = 3, ncol = 4,

Re: [R] Wichmann-Hill Random Number Generator and the Birthday Problem

2008-08-17 Thread Shengqiao Li
On Sun, 17 Aug 2008, Duncan Murdoch wrote: Shengqiao Li wrote: Dear all, Recently I am generating large random samples (10M) and any duplicated numbers are not desired. We tried several RNGs in R and found Wichmann-Hill did not produce duplications. The duplication problem is the interest

[R] Error fitting overdispersed logistic regression: package dispmod

2008-08-17 Thread Jason Curole
Hi all, First, a quick thank you for R; it's amazing. I am trying to fit models for a count dataset following the overdispersed logisitic regression approach outlined in Baggerly et al. (BMC Bioinformatics, 5:144; Annotated R code is given at the end of the paper) but R is returning an error w

[R] multiple t-tests

2008-08-17 Thread B Nichols
This is probably a basic data manipulation issue and an easy answer, but I can't seem to make it work. I am more used to working with data by participant, not by answer. I have survey data, one answer per line (18000+ lines and counting), and each line includes variables for: prepost (0 for

Re: [R] how to override/replace a function in a package namespace?

2008-08-17 Thread Henrik Bengtsson
The few times I want to patch a function like this, I use: unlockBinding(name, env); assignInNamespace(name, value, ns=pkgName, envir=env); assign(name, value, envir=env); lockBinding(name, env); /Henrik On Sun, Aug 17, 2008 at 10:50 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > In

Re: [R] how to override/replace a function in a package namespace?

2008-08-17 Thread Gabor Grothendieck
In that case add this: unlockBinding("strucplot", as.environment("package:vcd")) assign("strucplot", my.strucplot, "package:vcd") On Sun, Aug 17, 2008 at 1:22 PM, Ben Bolker <[EMAIL PROTECTED]> wrote: > Gabor Grothendieck gmail.com> writes: > >> >> Check out: >> >> ?assignInNamespace >> >> On

Re: [R] how to override/replace a function in a package namespace?

2008-08-17 Thread Michael Friendly
Thanks, Gabor For the record, what I was looking for is accomplished by > source("c:/R/mosaics/strucplot-MF.R") > assignInNamespace("strucplot",strucplot, ns="vcd") -Michael Gabor Grothendieck wrote: Check out: ?assignInNamespace On Sun, Aug 17, 2008 at 12:42 PM, Michael Friendly <[EMAIL PR

Re: [R] Axes in filled.contour plots

2008-08-17 Thread hippie dream
Jim, Thanks so much for getting back to me. Axis.mult could definitely work so me although there still appear to be a couple hiccups. I've included a .png file of my plot rather than trying to explain it. I have for explanatory purpose not called to plot with "axes=F". This illustrates that the a

Re: [R] how to override/replace a function in a package namespace?

2008-08-17 Thread Ben Bolker
Gabor Grothendieck gmail.com> writes: > > Check out: > > ?assignInNamespace > > On Sun, Aug 17, 2008 at 12:42 PM, Michael Friendly wrote: > > I'm trying to test an extension of mosaic() from the vcd package that > > requires a change to the > > basic strucplot() function from that package. I

Re: [R] how to override/replace a function in a package namespace?

2008-08-17 Thread Gabor Grothendieck
Check out: ?assignInNamespace On Sun, Aug 17, 2008 at 12:42 PM, Michael Friendly <[EMAIL PROTECTED]> wrote: > I'm trying to test an extension of mosaic() from the vcd package that > requires a change to the > basic strucplot() function from that package. I want to test my change by > sourcing t

[R] how to override/replace a function in a package namespace?

2008-08-17 Thread Michael Friendly
I'm trying to test an extension of mosaic() from the vcd package that requires a change to the basic strucplot() function from that package. I want to test my change by sourcing the replacement function into my R session. But when I do that, source("c:/R/mosaics/strucplot-MF.R") and run my ext

Re: [R] grangertest/lmtest ... what am I doing wrong ?

2008-08-17 Thread tolga . i . uzuner
Hi Gabor, Perhaps, I should have been clearer. In the subject like, I put "grangertest/lmtest" to indicate the grangertest function in the lmtest package. Later in the example, I am specifically talking about granger.test in the MSBVAR package (which is not failing, as in the example at the v

Re: [R] grangertest/lmtest ... what am I doing wrong ?

2008-08-17 Thread Gabor Grothendieck
There is something wrong with the description below since MSBVAR has granger.test, not grangertest, and it takes 2 args, not 3. This refers to 0.3-1 of MSBVAR. On Sun, Aug 17, 2008 at 9:07 AM, <[EMAIL PROTECTED]> wrote: > Dear Achim, R Users, > > What am I doing wrong in this example ? > > a<-zo

[R] grangertest/lmtest ... what am I doing wrong ?

2008-08-17 Thread tolga . i . uzuner
Dear Achim, R Users, What am I doing wrong in this example ? a<-zoo(rnorm(100),order.by=1:100) b<-lag(a) regr<-na.exclude(merge(a,b)) plot(regr) grangertest(regr[,1],regr[,2],3) > a<-zoo(rnorm(100),order.by=1:100) > b<-lag(a) > regr<-na.exclude(merge(a,b)) > plot(regr) > grangertest(regr[,1],reg

Re: [R] package building problem on windows

2008-08-17 Thread Christophe Dutang
Actually I was suspected that 'r cmd build' search for 'C:/DOCUME~1/c- dutang/Local' and not 'C:/DOCUME~1/c-dutang/Local Settings'. I will check (tomorrow) if there are any spaces in environment variables TMP*. Thanks for your suggestion. Christophe Le 17 août 08 à 14:08, Prof Brian Riple

Re: [R] package building problem on windows

2008-08-17 Thread Prof Brian Ripley
Does your setting of TMPDIR, TEMP or TMP have a space in it? From the R-admin manual: You may need to set TMPDIR to the absolute path to a suitable temporary directory: the default is 'c:/TEMP'. (Use forward slashes and do not use a path including spaces.) The documentation is that man

Re: [R] continuous coloring of a polygon

2008-08-17 Thread Roger Leenders
Thanks Barry, that works beautifully! Roger Barry Rowlingson schreef: 2008/8/17 Roger Leenders <[EMAIL PROTECTED]>: WinXP, R2.7.1 Thanks so much to all who have reponded to my inquery. The solutions are most helpful. There is only one final thing that I can't seem to get right. All of th

Re: [R] Axes in filled.contour plots

2008-08-17 Thread Jim Lemon
On Sat, 2008-08-16 at 14:28 -0700, hippie dream wrote: > I am still struggling on how edit axes on a filled contour plot. I have > managed to figure out how to place labels on the key of this graph but how > to place the axes I want on this plot still eludes me. This command produces > the plot I a

[R] Making use of names of viewports (grid)

2008-08-17 Thread Patrick Connolly
The following code, though not brilliant, works on an A4 page. It might look odd on other devices of a very different size. =X8--- cut here require(grid) wide <- 15 vps <- grid.layout(nrow = 3, ncol = 4, widths = unit(rep(1,

Re: [R] Wichmann-Hill Random Number Generator and the Birthday Problem

2008-08-17 Thread Duncan Murdoch
Shengqiao Li wrote: Dear all, Recently I am generating large random samples (10M) and any duplicated numbers are not desired. We tried several RNGs in R and found Wichmann-Hill did not produce duplications. The duplication problem is the interesting birthday problem. If there are M possible

[R] package building problem on windows

2008-08-17 Thread Christophe Dutang
Hi, I'm trying to compile the package biglm, but when I build it with R CMD build biglm, it failed : C:\LOCAL\c-dutang\code\R\biglm2>R CMD build biglm * checking for file 'biglm/DESCRIPTION' ... OK * preparing 'biglm': * checking DESCRIPTION meta-information ...C:/DOCUME~1/c-dutang/Local: C

Re: [R] Lattice: problem using panel.superpose and panel.groups

2008-08-17 Thread Dieter Menne
Michael Braun MIT.EDU> writes: > > Dieter: > > Thank you for your response. As you requested, I created a self- > running example, pasted below. It may be a little wordier than I > would like, but it runs. .. Details removed > > panel.ppc.plot <- function(...,group.number) { > >if (

Re: [R] continuous coloring of a polygon

2008-08-17 Thread Barry Rowlingson
2008/8/17 Roger Leenders <[EMAIL PROTECTED]>: > WinXP, R2.7.1 > > Thanks so much to all who have reponded to my inquery. The solutions are > most helpful. > There is only one final thing that I can't seem to get right. > All of the proposed solutions yield a figure that is not quite round, but is >

Re: [R] continuous coloring of a polygon

2008-08-17 Thread Roger Leenders
WinXP, R2.7.1 Thanks so much to all who have reponded to my inquery. The solutions are most helpful. There is only one final thing that I can't seem to get right. All of the proposed solutions yield a figure that is not quite round, but is wider than its height. This can be resolved by manuall

Re: [R] Pseudo R2 for Tobit Regression

2008-08-17 Thread Achim Zeileis
On Sat, 16 Aug 2008, ldotero wrote: Dear All: I need some guidance in calculating a goodness-of-fit statistic for a Tobit Regression model. To develop the Tobit regression, I used the tobit() method from the AER package, which is basically a simpler interface to the survreg() method. I've read