[R] Peculiar behaviour with MatchIt and a function

2010-04-11 Thread Ajay Shah
, Serv.Other, Textiles, TransportEq), class = factor)), .Names = c(treatment, lsales, major.industry), class = data.frame, row.names = c(NA, 125L)) -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org http

[R] Bug in ecdf? Or what am I missing?

2010-02-27 Thread Ajay Shah
: In xy.coords(x, y, xlabel, ylabel, log) : 1 x value = 0 omitted from logarithmic plot This seems to be an error since all the values in x are positive. Thanks, -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org http

Re: [R] [R-SIG-Finance] Sequential MLE on time series with rolling window

2009-11-03 Thread Ajay Shah
from observations (n+1) to (n+T+1). The two $\hat theta$ values should be similar to each other, hence just one or two iterations should be required in making each step. -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org

[R] How do I access with the name of a (passed) function

2009-10-17 Thread Ajay Shah
How would I do something like this: f - function(x, g) { s - as.character(g) # THIS DOES NOT WORK sprintf(The %s of x is %.0f\n, s, g(x)) } f(c(2,3,4), median) f(c(2,3,4), mean) and get the results The median of x is 3 The mean of x is 3 -- Ajay Shah

[R] Bootstrap inference for the sample median?

2009-08-30 Thread Ajay Shah
lower than 1, then any sample median of these bootstrap samples should be lower than 1. The upper cutoff of the 95% confidence interval should also be below 1. Is this a bug in the boot package? Or should I be using `Percentile' or `BCa' in this situation? -- Ajay Shah

[R] Better weight management / weight loss through science

2009-08-22 Thread Ajay Shah
Folks, I wrote some text and code to help people think more clearly about weight loss or weight management. This is at: http://www.mayin.org/ajayshah/MISC/weightloss.html I hope this is useful to others. Do tell me if there are things there which I can improve. -- Ajay Shah

[R] How to do a pretty panel plot?

2009-05-14 Thread Ajay Shah
plot of these two series, both of which share a common time axis? -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org http://ajayshahblog.blogspot.com *(:-? - wizard who doesn't know the answer

Re: [R] How to do a pretty panel plot?

2009-05-14 Thread Ajay Shah
=black, at=NULL, labels=T) axis(1, col=lightgrey, at=NULL, labels=T) grid(col = lightgrey, lty=1) box(col = grey) -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org http://ajayshahblog.blogspot.com *(:-? - wizard who

[R] cbind(NULL,zoo.object)?

2009-03-15 Thread Ajay Shah
deeply confused; is there a way out? :-) -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org http://ajayshahblog.blogspot.com *(:-? - wizard who doesn't know the answer. __ R

[R] Please help me to understand environments

2009-03-15 Thread Ajay Shah
I want to write: zap - function(v) { if (exists(v)) {rm(v)} } But of course this doesn't work because the rm() acts on v which is within zap() and doesn't affect the parent environment: x - 1 zap(x) x [1] 1 How would I make this zap() function work? -- Ajay Shah

[R] Stuck on building a package

2009-03-15 Thread Ajay Shah
) : unexpected end of input at 63: ft=winsorised.left, winsorised.right=winsorised.right) 64: } Calls: Anonymous - code2LazyLoadDB - sys.source - parse Execution halted ERROR: lazy loading failed for package 'ansecon' ** Removing '/Users/ajayshah/L/R/packages/ansecon.Rcheck/ansecon' -- Ajay Shah

[R] R badly lags matlab on performance?

2009-01-03 Thread Ajay Shah
version0.099242.209 425.5x So the R is 1.5x costlier for the vector version and 425.5x costlier with matlab. I wonder what we're doing wrong! -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org

Re: [R] R badly lags matlab on performance?

2009-01-03 Thread Ajay Shah
On Sat, Jan 03, 2009 at 06:59:29PM +0100, Stefan Grosse wrote: On Sat, 3 Jan 2009 22:25:38 +0530 Ajay Shah ajays...@mayin.org wrote: AS system.time(for (i in 1:1000) {a[i] - a[i] + 1}) AS I wonder what we're doing wrong! it is no secret that R does badly with loops. Thats why

Re: [R] R badly lags matlab on performance?

2009-01-03 Thread Ajay Shah
should by all means use Matlab. A good chunk of statistical computation involves loops. We are all happy R users. I was surprised to see that we are so far from matlab in the crucial dimension of performance. -- Ajay Shah http://www.mayin.org/ajayshah ajays

[R] Question about regression without an intercept

2008-12-27 Thread Ajay Shah
this could be. The estimated coefficient of x is quite different between the two cases. There must be an interesting theoretical angle to this. I would greatly appreciate some help in understanding this, and (more generally) in interpreting the R2 of regressions where the intercept is absent. -- Ajay Shah

[R] Heuristic optimisation?

2008-10-15 Thread Ajay Shah
I wondered was people on this list felt about this article: http://www.voxeu.org/index.php?q=node/2363 which talks about the problems of obtaining sound answers in numerical optimisation in settings such as MLE or NLS. -- Ajay Shah http://www.mayin.org

[R] Puzzled at generating combinations

2008-03-18 Thread Ajay Shah
a clean way to do it but I find myself thinking in loops. -- Ajay Shah http://www.mayin.org/ajayshah [EMAIL PROTECTED] http://ajayshahblog.blogspot.com *(:-? - wizard who doesn't know the answer

[R] How does one do simple string concatenation?

2008-03-17 Thread Ajay Shah
How does one convert objects c(a,b,c) and d into abcd? paste(c(a,b,c), d) of course yields [1] a d b d c d -- Ajay Shah http://www.mayin.org/ajayshah [EMAIL PROTECTED] http://ajayshahblog.blogspot.com *(:-? - wizard who

Re: [R] Reading microsoft .xls format and openoffice OpenDocument files

2008-03-11 Thread Ajay Shah
On Tue, Mar 11, 2008 at 08:57:49AM +0100, Hans-Peter wrote: I looked at the package (it's http://cran.r-project.org/web/packages/xlsReadWrite/index.html) but it's windows only. So no joy yet. which platform would you need it? Mac OS X and Linux. -- Ajay Shah

Re: [R] Reading microsoft .xls format and openoffice OpenDocument files

2008-03-10 Thread Ajay Shah
similar to R-Excel (connecting R to Calc). Not sure if that helps you any though. I wasn't able to locate this. Could you please describe this further? -- Ajay Shah http://www.mayin.org/ajayshah [EMAIL PROTECTED] http

[R] Reading microsoft .xls format and openoffice OpenDocument files

2008-03-07 Thread Ajay Shah
this? Am I correct in thinking that our goal is reading OpenDocument files (http://en.wikipedia.org/wiki/OpenDocument) ? -- Ajay Shah http://www.mayin.org/ajayshah [EMAIL PROTECTED] http://ajayshahblog.blogspot.com *(:-? - wizard

[R] New data source - now how do we build an R interface?

2008-03-05 Thread Ajay Shah
which can then be wget. There's some javascript going on that I'm not understanding. Perhaps someone on the mailing list can think about this? -- Ajay Shah http://www.mayin.org/ajayshah [EMAIL PROTECTED] http

[R] How do I obtain the design matrix of an lm()?

2007-10-10 Thread Ajay Shah
, of course, do this manually. But it seems that lm() has done all this hard work. I wonder if there's a way to ask him nicely so as to get it. :-) -- Ajay Shah http://www.mayin.org/ajayshah [EMAIL PROTECTED] http