Re: [R] Stochastic SEIR model

2006-11-16 Thread Tamas K Papp
On Thu, Nov 16, 2006 at 02:55:07PM +0100, Massimo Fenati wrote: Dear colleagues, I’m a new R-help user. I’ve read the advertisements about the good manners and I hope to propose a good question. I’m using R to build an epidemiological SEIR model based on ODEs. The odesolve package is very

[R] how to get empty sequence for certain bounds

2006-11-15 Thread Tamas K Papp
Hi, I have encountered this problem quite a few times and thought I would ask. Let's say that I have two endpoints, a and b, which are integers. If a = b, I would like to get a:b, but if a b, then numeric(0), for example: myseq(3,5) = 3:5 myseq(3,3) = 3 myseq(3,2) = numeric(0) The operator :

[R] ppform of B-spline basis

2006-11-15 Thread Tamas K Papp
Hi, I would like to get the piecewise polynomial form of a B-spline basis (for repeated calculations of the same spline). polySpline gives the polynomial representation of a particular spline. I wonder if anybody has code to do that for the basis itself... Thanks, Tamas

[R] filling an array, vectorized

2006-11-15 Thread Tamas K Papp
Hi, I am sure this has come up before, but my searches of the archive didn't give any results (maybe I didn't use the right keywords, but if I use too many, the search times out). I have a vector of dimensions n, length is not fixed, eg n - c(4,5,7) or n - c(19,4,5,7) and a function f that

Re: [R] Sparse matrix calculation

2006-11-15 Thread Tamas K Papp
On Wed, Nov 15, 2006 at 01:22:19PM -0500, YONGWAN CHUN wrote: I work on large matrices and found something interesting. For multiplication of matrices, the order has a huge influence on computing time when one of them is a sparse matrix. In the below example, M is a full matrix and A is a

Re: [R] splineDesign and not-a-knot conditions

2006-11-15 Thread Tamas K Papp
, Nov 14, 2006 at 10:41:39PM -0500, Tamas K Papp wrote: Hi, I would like to fit an (interpolating) spline to data where the derivatives at the endpoints of the interval are nonzero, thus the natural spline endpoint-specification does not make sense. Books (de Boor, etc) suggest

[R] splineDesign and not-a-knot conditions

2006-11-14 Thread Tamas K Papp
Hi, I would like to fit an (interpolating) spline to data where the derivatives at the endpoints of the interval are nonzero, thus the natural spline endpoint-specification does not make sense. Books (de Boor, etc) suggest that in this case I use not-a-knot splines. I know what not-a-knot

Re: [R] Bayesian question (problem using adapt)

2006-11-11 Thread Tamas K Papp
On Sat, Nov 11, 2006 at 11:19:46AM -0500, [EMAIL PROTECTED] wrote: kernel1 - function(theta, param) { exp(loglik(theta, param)) + log(1)} kernel2 - function(theta, param) {( exp(loglik(theta, param)) + log(1)) * gm(theta, param) } kernel2(theta0, param0) adapt(4, lower

Re: [R] Making a case for using R in Academia

2006-11-10 Thread Tamas K Papp
On Wed, Nov 08, 2006 at 09:24:38PM -0500, Charilaos Skiadas wrote: Hi Charilaos, I would particularly like to hear from people who were not hard-core programmers before taking up R, so perhaps had originally some difficulties with it. How hard was it, and how quickly did it start

[R] R and Fortran 9x -- advice

2006-11-09 Thread Tamas K Papp
Hi, I found some bottlenecks in my R code with Rprof. First I wanted to rewrite them in C, but a colleague keeps suggesting that I learn Fortran, so maybe this is the time to do it... I like to learn new languages and do it fairly quickly. I would appreciate the advice of others about these

Re: [R] multivariate splines

2006-11-08 Thread Tamas K Papp
On Wed, Nov 08, 2006 at 09:49:50AM -0800, Spencer Graves wrote: You say, I have looked at a few spline packages in R, but didn't find what I was looking for. Could somebody please point me in the right direction? It's difficult to comment without more information on what you've tried

[R] multivariate splines

2006-11-06 Thread Tamas K Papp
Hi, I am looking for an R package that would calculate multivarite (mostly 2d and 3d, tensor) cubic interpolating splines, so that I could evaluate these splines (and their derivatives) at many points (unkown at the time of calculating the spline polynomials) repeatedly. To make things concrete,

Re: [R] Generating a double-exponential jump diffusion process

2006-11-05 Thread Tamas K Papp
On Sun, Nov 05, 2006 at 11:13:28AM +, Tolga Uzuner wrote: Dear R Users, Does anyone know of a package which can generate random realisations of a double-exponential jump diffusion process with a drift ? Something where I can specify the likelihoods of an up or a down jump, the drift

Re: [R] Measuring the effects of history on event probabilities

2006-11-05 Thread Tamas K Papp
Hi Jon, I missed the original post. If you only care about people being interviewed/not interviewed, then I would construct a 2x2 markov chain (the transition matrix has 2 free variables) and simply calculate the posterior (if you like Bayesian methods). If the interview times are irregular in

Re: [R] Error when using cobs library

2006-11-04 Thread Tamas K Papp
On Sat, Nov 04, 2006 at 05:29:00PM +0100, Martin Maechler wrote: Your version of SparseM is probably too old and or may not have been for R 2.3.1. Do the following 1) Get R 2.4.0 (or even R-2.4.0-patched) 2) upgrade.packages() ^^^ perhaps you meant update.packages()? Tamas

[R] can update.packages Debian package files?

2006-11-04 Thread Tamas K Papp
Hi, I have searched the archive for the solution of this question, but couldn't find anything, so I thought I would ask here. I am using R on a Debian (testing) system. Many of the R packages I use are installed as .deb packages, those which are not available in this format I install using

Re: [R] generic arrays in R

2006-11-03 Thread Tamas K Papp
On Fri, Nov 03, 2006 at 07:20:34AM +, Prof Brian Ripley wrote: but a - array(list(f),c(2,2)) a[[2,1]] Thank you very much. Can you please tell me how to make apply generate arrays like this? Eg if a - array(1:16,rep(2,4)) then a apply(a,c(1,2,4), polynomial) will just give me a

Re: [R] question of one matrix column being treated as list rather than vector

2006-11-03 Thread Tamas K Papp
On Fri, Nov 03, 2006 at 02:47:37PM -0800, Waverley wrote: Hi, You probably created that matrix from a list. Eg a - matrix(list(1,2,3,4),2,2) a [,1] [,2] [1,] 13 [2,] 24 a[,2] [[1]] [1] 3 [[2]] [1] 4 b - matrix(1:4,2,2) b[,2] [1] 3 4 Both a and b are matrices, but

Re: [R] How to convert an existing package?

2006-11-03 Thread Tamas K Papp
On Fri, Nov 03, 2006 at 07:59:37PM +0100, rasti matus wrote: Dears, how could I convert an existing package to be able to modify it? Let s say, if I want to change the way how the results of the package are display (to see the oroginal code of the code). Hi, Could you be more specific

[R] generic arrays in R

2006-11-02 Thread Tamas K Papp
Dear R users, Are there any generic arrays (arrays which can store arbitrary objects) in R? Something along the lines of f - function(x) x^2 a - array(f,c(2,2)) etc. I have found fasp in the spatstat package, but in my particular case, I need an array of polynomials, not functions. I know

[R] making uniroot a bit more robust?

2006-10-27 Thread Tamas K Papp
Hi, I wonder if it would make sense to make uniroot detect zeros at the endpoints, eg if f(lower)==0, return lower as the root, else if f(upper)==0, return upper as the root, else stop if f(upper)*f(lower) 0 (currently it stops if =), else proceed to the algorithm proper. Currently I am using

[R] calculating density from cdf

2006-10-27 Thread Tamas K Papp
Hi, I have a vector which contains the cdf of a univariate distribution. The support of the rv is [0,1], so eg if the vector has 101 elements, the give the CDF at 0,0.01,...,1. The function is quite smooth. [1] I would like to calculate (approximate) the density. I tried fitting a splinefun

[R] mapply for matrices

2005-10-05 Thread Tamas K Papp
Hi, I have a matrix A and a vector b, and would like to apply a function f(a,b) to the rows of A and the elements of b. Eg A - matrix(1:4,2,2) b - c(5,7) f - function(a,b) {sum(a)*b} myapply(f,A=A,b=b) would give (1+3)*5 = 20 (2+4)*7 = 42 I found mapply, but it does not work for matrices.

[R] multidimensional (smoothing) splines

2005-09-22 Thread Tamas K Papp
Hi, I am approximation a value function (in dynamic programming) V: R^n-R. In different versions of the problem, n is between 2 and 5. I would like to use splines to use this, I checked the mailing list and CRAN but couldn't find anything that would help me (Tps in fields is too slow, cobs would

[R] retrieving large columns using RODBC

2005-08-13 Thread Tamas K Papp
Hi, I have a large table in Postgresql (result of an MCMC simulation, with 1 million rows) and I would like to retrive colums (correspond to variables) using RODBC. I have a column called index which is used to order rows. Unfortunately, sqlQuery can't return all the values from a column at

[R] how to disable RODBC log file

2005-08-11 Thread Tamas K Papp
I am using RODBC with Postgresql. I have disabled the log file in ~/.odbc.ini, but nevertheless I still get a logfile in /tmp, which can grow to gigabytes, so I would like to disable it. It appears that the logfile is generated by R: % lsof | grep /tmp/psqlodbc_tpapp7482.log R 7482

[R] managing large datasets with RMySQL

2005-08-09 Thread Tamas K Papp
I have a large dataset (about 1 million data points from a 68-dimensional state space, result of an MCMC simulation) which won't fit in memory. I think that the only solution for analyzing this is saving it in relational database (when generated) and then reading back only portions of this data.

[R] using - with a changing variable name (substitute?)

2005-08-08 Thread Tamas K Papp
I have a matrix r and a scalar d, and I would like to apply the following functions to each of its elements: 1. if r 0, no change 2. if 0 = r d, replace element by zero 3. if d = r, replace element by r-d I wrote a small function for this m - function(b) {sapply(b, function(bb) { if (bb

Re: [R] using - with a changing variable name (substitute?)

2005-08-08 Thread Tamas K Papp
On Mon, Aug 08, 2005 at 04:07:10PM +0100, Prof Brian Ripley wrote: On Mon, 8 Aug 2005, Tamas K Papp wrote: m - function(b) {sapply(b, function(bb) { if (bb 0) {bb} else {if (bbd) {bb-d} else 0} })} Why use sapply? r[] - ifelse(r = d, r-d, ifelse(r = 0, 0, r)) is one more

[R] modifying argument of a .C call (DUP=FALSE)

2005-08-08 Thread Tamas K Papp
I have a huge matrix on which I need to do a simple (elementwise) transformation. Two of these matrices cannot fit in the memory, so I cannot do this in R. I thought of writing some C code to do this and calling it using .C with DUP=FALSE. All I need is a simple for loop that replaces elements

Re: [R] use different symbols for frequency in a plot

2005-08-08 Thread Tamas K Papp
On Mon, Aug 08, 2005 at 03:17:44PM -0400, Chuck Cleland wrote: You might consider one of these approaches instead: plot(jitter(x), jitter(y)) or pdf(file=c:/AlphaExample.pdf, version = 1.4) plot(x, y, col = rgb(1, 0, 0, .2), pch = 16) dev.off() sunflowerplot() is also useful for

[R] BUGS and OS X

2004-09-15 Thread Tamas K Papp
Is there a way of running BUGS on OS X (from R)? I only see Windows versions on their website. If not, what are the alternatives for Bayesian analysis? Thanks, Tamas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] BUGS and OS X

2004-09-15 Thread Tamas K Papp
On Wed, Sep 15, 2004 at 02:21:18PM -0400, Liaw, Andy wrote: That's more of a question for the BUGS developers. BUGS is not open source, so whatever binary is provided, that's all you can use. If I'm not mistaken, WinBUGS is the only version under development. I found something called JAGS,

[R] getting started on Bayesian analysis

2004-09-14 Thread Tamas K Papp
I am an economist who decided it's high time that I learned some Bayesian statistics. I am following An Introduction to Modern Bayesian Econometrics by T. Lancaster. The book recommends using BUGS, but I wonder if there are any alternatives which are free software and fully integrated to R

Re: [R] Spare some CPU cycles for testing lme?

2004-09-13 Thread Tamas K Papp
On Mon, Sep 13, 2004 at 08:40:15AM -0400, Frank Samuelson wrote: If anyone has a few extra CPU cycles to spare, I'd appreciate it if you could verify a problem that I have encountered. Run the code below and tell me if it crashes your R before completion. library(lme4) data(bdf)

[R] as.integer(TRUE)

2004-09-13 Thread Tamas K Papp
The fact that as.integer(TRUE) is 1 (and that for FALSE, it gives zero) is a really nice feature, eg when constructing piecewise functions (for example, as in -x*(x0)+x*(x=0)) and for many other things. Since I haven't found a reference about this, I just wanted to ask whether this is officialy

[R] drawing on axes

2004-09-13 Thread Tamas K Papp
Hi, I would like to make certain portions of axis lines thicker (as Tufte suggests). How can I draw on axes? I only need a couple of line segments on the left and bottom one. Thanks Tamas __ [EMAIL PROTECTED] mailing list

[R] can't get the quartz window to the background

2004-09-12 Thread Tamas K Papp
Dear List, I have switched from Linux to OS X, and I find the R interface there really nice. I am using Emacs+ESS, and the quartz device. My only problem is that 1. I can't move the quartz window, whenever I go above it I see a spinning rainbow circle (AFAIK that means I am busy or can't

Re: [R] can't get the quartz window to the foreground (was: background)

2004-09-12 Thread Tamas K Papp
On Sun, Sep 12, 2004 at 01:50:21PM -0400, Tamas K Papp wrote: 1. I can't move the quartz window, whenever I go above it I see a spinning rainbow circle (AFAIK that means I am busy or can't touch me in OS X) 2. Once something gets in front of it, I cannot raise it any more. 3. I