This question is off topic here.
--
Sent from my phone. Please excuse my brevity.
On February 13, 2017 9:08:18 AM PST, Allan Tanaka
wrote:
>Correction, it should look like this:**def hurst(ts): lags = range(2,
>100) tau = [np.sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in
>lags] poly = np
Correction, it should look like this:**def hurst(ts): lags = range(2, 100) tau
= [np.sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in lags] poly =
np.polyfit(log(lags), log(tau), 1) return poly[0]*2.0
On Tuesday, 14 February 2017, 0:06, Allan Tanaka
wrote:
Hi. Not sure why this cod
Hi. Not sure why this code produces the error like this. This error appears
when i run the code of print "Hurst(GBM): %s" % hurst(gbm):
Traceback (most recent call last): File "", line 1, in
print "Hurst(GBM): %s" % hurst(gbm)NameError: name 'hurst' is not defined
Here is the full code
There is a package "rJython", which claims to provide an "R interface to
Python via Jython". I haven't used it, but the lead author, Gabor
Grothendieck, is well known in the R community. Spencer
On 7/28/2011 9:15 AM, Prof Brian Ripley wrote:
On Thu, 28 Jul 2011, Bert Gunter wrote:
Paul:
On Thu, 28 Jul 2011, Bert Gunter wrote:
Paul:
1. I do not know if any such library exists.
Not to my knowledge, and we have contemplated providing such
functions. But for files see e.g. tools::Rdiff, and generally R will
not be a good way to do this sort of thing on files (since the
flexi
Item 1 below should be changed to:
1. I do not know if any such PACKAGE exists.
(A "library" in R is a file directory where R packages are stored)
-- Bert
On Thu, Jul 28, 2011 at 8:05 AM, Bert Gunter wrote:
> Paul:
>
> 1. I do not know if any such library exists.
>
> 2. However, if I understa
Paul:
1. I do not know if any such library exists.
2. However, if I understand correctly, one usually does this sort of
thing in R with functions like ?match (or ?"%in%") and logical
comparison operations like ?"==" . Of course, for numeric
comparisons, you need to be aware of R FAQ 7.31
If you
Hi,
Does anyone know of a R library that is equivalent in functionality to
the Python standard libraries' difflib library? The python docs say
this about difflib:
"This module provides classes and functions for comparing sequences.
It can be used for example, for comparing files, and can produce
On Fri, Dec 31, 2010 at 04:07:07PM -0800, Martin Morgan wrote:
[...]
> Better to use an environment (and live with reference semantics)
>
> e <- new.env(parent=emptyenv()); t0 <- Sys.time()
> for (i in seq_len(1e6)) {
> key <- as.character(i)
> e[[key]] <- i
> if (0 == i %% 1)
>
On 12/30/2010 02:30 PM, Paul Rigor wrote:
> Thanks gang,
> I'll work with named vectors and concatenate as needed.
This might be ok for small problems, but concatenation is an inefficient
R pattern -- the objects being concatenated are copied in full, so
becomes longer, and the concatenation slowe
Thanks gang,
I'll work with named vectors and concatenate as needed.
Paul
On Thu, Dec 23, 2010 at 7:39 AM, Seth Falcon wrote:
> On Wed, Dec 22, 2010 at 7:05 PM, Martin Morgan wrote:
> > On 12/22/2010 05:49 PM, Paul Rigor wrote:
> >> Hi,
> >>
> >> I was wondering if anyone has played around this
On Wed, Dec 22, 2010 at 7:05 PM, Martin Morgan wrote:
> On 12/22/2010 05:49 PM, Paul Rigor wrote:
>> Hi,
>>
>> I was wondering if anyone has played around this this package called
>> "rdict"? It attempts to implement a hash table in R using skip lists. Just
>> came across it while trying to look f
On 12/22/2010 05:49 PM, Paul Rigor wrote:
> Hi,
>
> I was wondering if anyone has played around this this package called
> "rdict"? It attempts to implement a hash table in R using skip lists. Just
> came across it while trying to look for simpler text manipulation methods:
>
> http://userprimary
Paul -
You can also use named vectors as something similar to
a python dictionary:
nvec = c('one'=20,'two'=30,'three'=40)
nvec['four'] = 50
nvec['one']
one
20
nvec['four']
four
50
Although the result is named, it can be used as a regular R
value:
20 + nvec['three']
three
60
If t
Hi,
I was wondering if anyone has played around this this package called
"rdict"? It attempts to implement a hash table in R using skip lists. Just
came across it while trying to look for simpler text manipulation methods:
http://userprimary.net/posts/2010/05/29/rdict-skip-list-hash-table-for-R/
Dear R users,
I'd like to invite interested members to join the LinkedIn group for
R-Python (RPy).
http://www.linkedin.com/e/vgh/2925347/eml-grp-sub/
This group seeks to bring like minded users together, for sharing
knowledge\resources to encourage the use of RPy.
I apologize if
Anyway I think it was just a toy example.
Any additionnal information is welcome.
Best,
Jean
2009/11/22 Peter Ehlers
>
>
> Stefan Evert wrote:
>
>> Sure, badly written R code does not perform as well as well written python
>>> code or C code. On the other hand badly written python code does no
Stefan Evert wrote:
Sure, badly written R code does not perform as well as well written
python code or C code. On the other hand badly written python code
does not perform as well as well written R code.
What happens when you try one of these :
sum <- sum( 1:N )
R runs out of memory and c
Thank you Gabor, Romain and Stefan.
Gabor this looks like really interesting for speeding up loops. I just have
to install it and add jit(1) before a loop ! Is the result faster than
Python ?
I have seen the name of L. Tierney among the contributors. I guess it is
good for MCMC :-)
Best,
Jean
200
Sure, badly written R code does not perform as well as well written
python code or C code. On the other hand badly written python code
does not perform as well as well written R code.
What happens when you try one of these :
sum <- sum( 1:N )
R runs out of memory and crashes. :-) I didn't
On 11/21/2009 11:32 PM, Stefan Evert wrote:
My hunch is that Python and R run at about the same speed, and both
use C libraries for speedups (Python primarily via the numpy package).
That's not necessarily true. There can be enormous differences between
interpreted languages, and R appears to
There is work going on on two byte compilers for R:
http://www.stat.uiowa.edu/~luke/R/compiler/
http://www.milbo.users.sonic.net/ra
You could check whether running under either of those speeds up your R
code sufficiently that you don't need to rewrite it.
On Sat, Nov 21, 2009 at 9:29 AM, Jean
Thank you Stefan. That's really interesting.
My guess is that Python is not much more complicated to program than R, and
that we can integrate some codes into R. If it can be 10 times faster,
that's great !
Best,
Jean
2009/11/21 Stefan Evert
> My hunch is that Python and R run at about the same
My hunch is that Python and R run at about the same speed, and both
use C libraries for speedups (Python primarily via the numpy package).
That's not necessarily true. There can be enormous differences
between interpreted languages, and R appears to be a particularly slow
one (which doesn't
Thank you Whit.
So you have experience with both R and Python ? How do they compare ?
Best,
Jean
2009/11/21 Whit Armstrong
> We have been using pymc as an alternative to WinBUGS, and have been
> very pleased with it. I've begun working on an R2Pymc package, but
> don't have anything ready for
We have been using pymc as an alternative to WinBUGS, and have been
very pleased with it. I've begun working on an R2Pymc package, but
don't have anything ready for sharing yet.
Here's the pymc page:
http://code.google.com/p/pymc/
and the repo is here:
http://github.com/pymc-devs/pymc
I've conv
Thank you Paul, Barry and Patrick.
I will do what you recommand (the profiling).
I have heard several times that for example Matlab would be faster than R...
This is why I thought of switching to Python, though it is also interpreted.
I thought it would be faster.
Best,
Jean
2009/11/21 Patrick
One little thing that I think Barry
meant to say.
If the bottleneck is in your code, you
may be able to improve the situation
enough by merely rewriting the R code
of your function. If that doesn't work,
then you can move to C.
Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://w
On Sat, Nov 21, 2009 at 2:29 PM, Jean Legeande wrote:
> Dear R users,
>
> I would like to make my R code for MCMC faster. It is possible to integrate
> C code into R but I think C is too complicated for me. I would need a C
> introduction only for MCMC and I do not know if such a thing exists.
>
>
Hi Jean,
You can integrate R and Python using RSPython or Rpy. But why would
Python be faster than R? Both are interpreted languages and probably
about as fast (please someone correct me if I'm wrong). It probably only
help if there is a C mcmc implementation linked to python (that you link
t
Dear R users,
I would like to make my R code for MCMC faster. It is possible to integrate
C code into R but I think C is too complicated for me. I would need a C
introduction only for MCMC and I do not know if such a thing exists.
I was thinking of Python (and scipy). Where could I read about its
Dear List,
I recently got the chance to interview Jon Peck of SPSS Inc, a pioneering
technical statistician working since 1983 (when there were only two
substantial statistical software companies as per him ;) (not anymore ;)
and currently he is a Principal Software Engineer and Technical Advisor
Different methods of performing least squares calculations in R are discussed in
@Article{Rnews:Bates:2004,
author = {Douglas Bates},
title= {Least Squares Calculations in {R}},
journal = {R News},
year = 2004,
volume = 4,
number = 1,
pages
Note that using solve can be numerically unstable for certain problems.
On Fri, Feb 20, 2009 at 6:50 AM, Kenn Konstabel wrote:
> Decyphering formulas seems to be the most time consuming part of lm:
>
> mylm1 <- function(formula, data) {
> # not perfect but works
> F <- model.frame(formula
Decyphering formulas seems to be the most time consuming part of lm:
mylm1 <- function(formula, data) {
# not perfect but works
F <- model.frame(formula,data)
y <- model.response(F)
mt <- attr(F, "terms")
x <- model.matrix(mt,F)
coefs <- solve(crossprod(x), crossprod(x,y))
On Thu, Feb 19, 2009 at 8:30 AM, Esmail Bonakdarian wrote:
> Hi Kenn,
>
> Thanks for the suggestions, I'll have to see if I can figure out how to
> convert the relatively simple call to lm with an equation and the data file
> to the functions you mention (or if that's even feasible).
X <- model.m
Hi Kenn,
Thanks for the suggestions, I'll have to see if I can figure out how to
convert the relatively simple call to lm with an equation and the data file
to the functions you mention (or if that's even feasible).
Not an expert in statistics myself, I am mostly concentrating on the
programming
Doran, Harold wrote:
lm(y ~ x-1)
solve(crossprod(x), t(x))%*%y# probably this can be done more
efficiently
You could do
crossprod(x,y) instead of t(x))%*%y
that certainly looks more readable (and less error prone) to an R newbie
like myself :-)
Gabor Grothendieck wrote:
On Wed, Feb 18, 2009 at 7:27 AM, Esmail Bonakdarian wrote:
Gabor Grothendieck wrote:
See ?Rprof for profiling your R code.
If lm is the culprit, rewriting your lm calls using lm.fit might help.
Yes, based on my informal benchmarking, lm is the main "bottleneck", th
> lm(y ~ x-1)
> solve(crossprod(x), t(x))%*%y# probably this can be done more
> efficiently
You could do
crossprod(x,y) instead of t(x))%*%y
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posti
lm does lots of computations, some of which you may never need. If speed
really matters, you might want to compute only those things you will really
use. If you only need coefficients, then using %*%, solve and crossprod will
be remarkably faster than lm
# repeating someone else's example
# lm(DAX
On Wed, Feb 18, 2009 at 7:27 AM, Esmail Bonakdarian wrote:
> Gabor Grothendieck wrote:
>>
>>
>> See ?Rprof for profiling your R code.
>>
>> If lm is the culprit, rewriting your lm calls using lm.fit might help.
>
> Yes, based on my informal benchmarking, lm is the main "bottleneck", the
> rest
> o
Barry Rowlingson wrote:
- and the bulk of the time in the regression calls will be taken up
by C code in the underlying linear algebra libraries (lapack, blas,
atlas and friends).
ah, good point.
Your best bet for optimisation in this case would be making sure you
have the best libraries
Gabor Grothendieck wrote:
See ?Rprof for profiling your R code.
If lm is the culprit, rewriting your lm calls using lm.fit might help.
Yes, based on my informal benchmarking, lm is the main "bottleneck", the rest
of the code consists mostly of vector manipulations and control structures.
I
2009/2/17 Esmail Bonakdarian :
> Well, I have a program written in R which already takes quite a while
> to run. I was
> just wondering if I were to rewrite most of the logic in Python - the
> main thing I use
> in R are its regression facilities - if it would speed things up. I
> suspect not sinc
On Tue, Feb 17, 2009 at 6:59 PM, Esmail Bonakdarian wrote:
> Well, I have a program written in R which already takes quite a while
> to run. I was
> just wondering if I were to rewrite most of the logic in Python - the
> main thing I use
> in R are its regression facilities - if it would speed thi
h the next
> generation Rpy2 (which I've not got into yet). Google for rpy for
> info.
Will do!
>> Is there much of a performance hit either way? (as both are interpreted
>> languages)
>
> Not sure what you mean here. Do you mean is:
>
> R> sum(x)
>
> fast
Hello!
On Tue, Feb 17, 2009 at 5:58 PM, Warren Young wrote:
>
> Esmail Bonakdarian wrote:
>>
>> I am just wondering if any of you are doing most of your scripting
>> with Python instead of R's programming language and then calling
>> the relevant R functions as needed?
>
> No, but if I wanted to
an is:
R> sum(x)
faster than
Python> sum(x)
and how much worse is:
Python> from rpy import r
Python> r.sum(x)
?
Knuth's remark on premature optimization applies, as ever
Barry
__
R-help@r-project.org mailing list
https://stat.et
Esmail Bonakdarian wrote:
I am just wondering if any of you are doing most of your scripting
with Python instead of R's programming language and then calling
the relevant R functions as needed?
No, but if I wanted to do such a thing, I'd look at Sage:
http://sagemath.org/
It'll give you acc
Hello all,
I am just wondering if any of you are doing most of your scripting
with Python instead of R's programming language and then calling
the relevant R functions as needed?
And if so, what is your experience with this and what sort of
software/library do you use in combination with Python
51 matches
Mail list logo