statistics

Problem storing plot objects in a list in R

I asked this question yesterday about storing a plot within an object. I tried implementing the first approach (aware that I did not specify that I was using qplot() in my original question) and noticed that it did not work as expected. library(ggplot2) # add ggplot2 string = "C:/example.pdf" # Setup pdf pdf(string,h...

Best way to keep track of current online users

I have a requirement that my site always display the number of users currently online. For example, "35741 Users Currently Online". This is not based on a log in, simply how many users are currently on my site. I have tried using Session Start/Session End for this, however session end is not reliable. Therefore I get inflated numbers...

Statistical mathematics issues

Hello, I'm developing a Texas Hold 'em hand-range equity evaluator, which evaluates hand-distributions with Monte Carlo -simulation. I've faced two annoying problems which behaviors I cannot give any reason. Problem #1: In a nut shell, the evaluator works by first picking up hands from player's hand-distributions. Say, that we have th...

Generating statistics from Git repository

I'm looking for some good tools/scripts that allow me to generate a few statistics from a git repository. I've seen this feature on some code hosting sites, and they contained information like... commits per author commits per day/week/year/etc. lines of code over time graphs ... much more Basically I just want to get an idea how muc...

Best method for gathering NTFS file access statistics?

I'd like advice on choosing a method to collect file access statistics on NTFS volumes under Windows Vista and Windows 7 (32 & 64-bit). I'd like to count file create/open, delete, read/write accesses for every file. API hooking is out. I need system-wide counts, and both 32 and 64-bit OS without mucking up the OS. Also, I don't thi...

What is a good pure Perl on-line or streaming statistics package?

Are there any prerolled streaming statistics libraries for Perl à la: http://en.wikipedia.org/wiki/Algorithms%5Ffor%5Fcalculating%5Fvariance#On-line%5Falgorithm I haven't found anything on CPAN yet and I really don't want to have to code one myself. ...

What to use to create bar, line and pie charts with javascript compatible with all major browsers?

I used to work with flot but it doesn't support pie charts so I'm forced to change. I just saw JS Charts, but their documentation is very obscure regarding cross browser compatibility (I need it to be IE6+ compliant :). Also this will be for commercial use, so I'd rather have something that I can use free of charge jQuery Google chart...

How many times was a Ruby gem installed via `gem install` or `gem update`

I am trying to find out how many times a gem was installed via gem install or gem update. For example, Watir 1.6.2: it was installed 97 times via gemcutter (http://gemcutter.org/gems/watir/versions/1.6.2) it is downloaded 4,027 times from http://rubyforge.org/frs/?group%5Fid=104 I have been told that 4,027 does not include installs ...

Plotting functions in R

Is there a way of overlaying a mathematical function on top of data using ggplot? ## add ggplot2 library(ggplot2) # function eq = function(x){x*x} # Data x = (1:50) y = eq(x) # Make plot object p = qplot( x, y, xlab = "X-axis", ylab =...

Implementing Wilson Score in SQL

We have a relatively small table that we would like to sort based on rating, using the Wilson interval or a reasonable equivalent. I'm a reasonably smart guy, but my math fu is nowhere near strong enough to understand this: The above formula, I am told, calculates a score for a positive/negative (thumbs up/thumbs down) voting system. ...

1 vs 1 vote: calculate ratings (Flickchart.com)

Instead of rating items with grades from 1 to 10, I would like to have 1 vs 1 "fights". Two items are displayed beside each other and you pick the one which you like more. Based on these "fight" results, an algorithm should calculate ratings for each item. You can see this approach on Flickchart.com where movies are rated using this app...

R + user defined function

I have a situation in which I have to give a formula as input to the nls() function. I have data which is between time and variance. For example: Time Variance 1 0.15 2 0.23 3 0.67 4 0.85 Now I am using the formula Vt = ((1-e^kt)/kt)) (q^2)/2k, where Vt is the variance at time t. I have the two variables (k,q) in the above ...

Modeling distribution of performance measurements

How would you mathematically model the distribution of repeated real life performance measurements - "Real life" meaning you are not just looping over the code in question, but it is just a short snippet within a large application running in a typical user scenario? My experience shows that you usually have a peak around the average exe...

R function that returns a string literal

I have a vector: c(1,2,3) Calling print() on this value gives "[1] 1 2 3" Is there a function that takes a vector and gives the string "c(1,2,3)"? ...

Plot multiple sets of points in R

I have multiple sets of xy pairs that I want to plot. I want each set of xy pairs to be connected by a line. In other words the goal is to have multiple experimental instances each approximated by a line plotted on one plot. Also how would I colour the lines differently? The plot function does what I want, but takes on one set of xy ...

Combining 3D/2D plots

I'm trying to make a visualization that looks like this . The idea is to have a 3D surface plot overlapping a 2d representation of a surface. I can build arbitrary surfaces/polygon shapes (as in http://addictedtor.free.fr/graphiques/graphcode.php?graph=135 ) and I can make the respective 2D plot. What I don't seem to be able to figure ...

Unexpected value for length of a vector in R

I have the character vector below a = c("2009-07-31 18:00:33", "2009-07-31 18:00:38", "2009-07-31 18:00:43", "2009-07-31 18:00:49", "2009-08-01 01:58:49", "2009-08-01 01:53:16", "2009-08-01 08:04:13", "2009-08-01 16:16:13") I want to convert this to time objects so I do this: b = strptime(a, "%Y-%m-%d %H:%M:%S") Why do a and b ha...

Plotting a 3d surface plot with contour map overlay, using R

I have a 3-tuple data set (X,Y,Z points) that I want to plot using R. As the title of my question states, I want to create a surface plot from the data, and superimpose a contour map on the surface plot, so as to create the impression of the contour map being the "shadow" or projection from the surface plot. The contour map is to appear...

[R] GLM with autoregressive term to correct for serial correlation

Hi I have a stationary time series to which I want to fit a linear model with an autoregressive term to correct for serial correlation, i.e. using the formula At = c1*Bt + c2*Ct + ut, where ut = r*ut-1 + et (ut is an AR(1) term to correct for serial correlation in the error terms) Does anyone know what to use in R to model this? Than...

c++ m bits permutations of a number

Hi, I am searching for a function that get as an input a number x (assuming 15), number of bits d (4) and number of permutations m (2). The output of the function will be all the numbers that are m bit's permutations from the given number x at a d length bits. For the given numbers, (x = 15, d = 4 and m = 2) we get 6=\binom{4}{2}differ...