Monday, 12 October 2015

Analysis of the numbers of views of my blog part 2

Last time I looked at the number of views per month I was getting on my blog. This time I will go into more detail on the numbers behind this.

First up is the number of views per day for each entry by time. This should give me an indication of which entries are more popular. I've divided the number of views by the number of days since the entry was written so that individual entries can be compared on an equal basis.




The picture is possibly a little hard to see when plotted like this but it does show that there are some entries that have a much higher 'popularity rating than others. To put this in a better perspective I've plotted a frequency distribution of them:



There are roughly four entries/posts that have more than 1 view per day. These are my 'popular' entries (and yes, this is popular in a very relative sense).

Let's look at the titles for the top 20 posts. Is there something in common? If I want to make this blog more popular is there something I should focus on? Something other than statistics probably. Anyway here is the chart:



Well, 2 of the popular posts are Java related, 2 are Excel related. I only have 4 Java related posts so this is fairly good for Java. However I have over 20 Excel related posts - not so good for Excel. Especially as one of those is to do with rim weighting.

My next chart shows the number of times that a post label appears. For those that don't know, the labels are just descriptive words or phrases that describe the post.



You can see that I've been concentrating on Excel quite a bit over the years.

The last chart shows the average views per day for these labels ranked by the average.



This just re-iterates the points above - Java is popular. Having said that, Java also has a very high standard deviation. Only one post has ever been relatively very high. And it was one of the first that I did and was about JavaFX rather than plain old Java.

As for whether I can make the blog more popular by picking what to write about based on these figures, I'm not sure. I think that there is far too much noise in the data. It's hard to pick a common theme. I'm sure I could do more analysis on this data but one for the future I think.

Wednesday, 7 October 2015

Analysis of the numbers from my blog

I've decided to write shorter entries for my blog. The entries end up being very long and cover a lot of aspects so I'm splitting them up to cover only one to a few aspects at a time.

So for my first shorty, I'm going to look at the numbers of views to this blog. Initially it will just be a look at the number of views per month. I'll then go into the views per post, what looks most interesting for people etc.

So, without further ado, here are the numbers of views per month plotted with the number of posts per month:


The left hand y-axis shows the number of views per month. The right hand y-axis shows the number of blog posts per month.

So, I'm getting on average about 800 views per month since the beginning of 2014. I've no idea if this is good or bad. Probably really bad as I don't connect with other people or mention the blog to anyone.

You can also see that there has been a major slowdown in blog entries recently. This corresponds to a drop in the number of views.

The next chart shows the difference in views from one month to the next plotted against the number of blog entries per month.



By simply calculating the correlation between the two series in the chart above we get a value of 0.2. This would seem to suggest that there is no correlation between the number of blog posts and the monthly increase in the number of views. It's all very random.

I will leave you with one final chart:

This shows the cumulative number of views and the cumulative number of posts. As you can see the number of views rises linearly with time. So much so, in fact, that you can fit a linear trendline through the data from January 2014 onwards to get the gradient of ~869 views per month.

From this it would seem that nothing I have, or have not done, has affected the upward trend.

Next time, I'll look at the data from the individual blog entries.

Monday, 3 August 2015

London Land Use 2005

I've put another article on my website about London land use statistics.

I've used R, R markdown, ggplot2, d3heatmap and maptools to plot the data. This does unfortunately mean that it can't be easily posted here and that it's a fairly sizeable page (about 1.4Mb when created in R Studio).

Here are some pictures from the page:



Anyway, see what you think.

Wednesday, 3 June 2015

Rim weighting web tool

Another rim weighting tool. This time I've stuck it on my site and programmed it in JavaScript.

It uses the same conventions as the Excel tool and you will need:

  1. A tab delimited file holding the demographics. It will need to have a header labelling each of the columns of data.
  2. A tab delimited file holding the targets. This will need to have a header and 3 columns with the rim name, the cell name and the target. The rim name will need to correspond to one of the headers in the demographic file.
Drag these files to the relevant boxes on the page, set the parameters and then click on the rim weight button.

The weights will then be placed in the weights tab below the button.

The tool is still in a beta stage so improvements will be made but it does work. I do need to test the speed of it though.

As it's JavaScript it all happens in the browser. This means that nothing has to be loaded to a server but it does also mean that nothing is saved.



Comments always welcome.

Tuesday, 5 May 2015

Sample size estimator

I've decided to put some of the tools from my Excel add-in on my website. The first one I've done is the sample size estimator for surveys found here.

Give it a go and see what you think. As ever, comments are welcome.

Friday, 17 April 2015

D3 Tooltips for a line chart

I wrote a blog entry on my attempts to write a line chart for D3 here. One thing it didn't have was tooltips when you hovered over the chart to tell you what the data was at that point.

I've added these for an article I recently wrote for my website. Their behaviour is limited but it's a start.

Composition

The tips themselves are constructed of one SVG 'rect' element and two SVG 'text' elements. They are positioned via the mouseover event.

Code

The first thing to do is to create the SVG element to hang all the child elements off:
    var chk = d3.select("#cht1")
.append("svg")
.attr("class", "chk")
.attr("width", 960)
.attr("height", 600);

Then we need to create the tooltip elements:
     chk.append("rect")
.attr("width", 70)
.attr("height", 50)
.attr("x","-2000")
.attr("y","-2000")
.attr("rx","2")
.attr("ry","2")
.attr("class", "tooltip_box")
.attr("id", "tooltip1")
.attr("opacity", "0.0");
    chk.append("text")
.attr("class","bbd_tooltip_text")
.attr("id","bbd_tt_txt1")
.attr("x", "-2000")
        .attr("y", "-2000")
        .attr("dy", ".35em")
        .attr("dx", ".35em")
        .text(" ");
    chk.append("text")
.attr("class","bbd_tooltip_text")
.attr("id","bbd_tt_txt2")
.attr("x", "-2000")
        .attr("y", "-2000")
        .attr("dy", ".35em")
        .attr("dx", ".35em")
        .text(" ");

I've given the elements a starting position of (-2000,-2000). It's not strictly necessary as I could have just made their opacity attribute equal to zero. I've also given the elements ids and classes.

Now we need to make them move with the mouse. I've added <rect> elements over the data points and it is to these that we add the event function:
    .on("mouseover", function(d, i) {
//Select mouse position
var ym = d3.mouse(this)[1];
d3.select("#tooltip1")
.attr("x", x_scale(resp_data[i].x)+10)
.attr("y", ym)
.attr("opacity", "0.5");
d3.select("#bbd_tt_txt1")
.attr("x", x_scale(resp_data[i].x)+10)
.attr("y", ym+12)
.text("x="+resp_data[i].x);
d3.select("#bbd_tt_txt2")
.attr("x", x_scale(resp_data[i].x)+10)
.attr("y", ym+32)
.text("y="+resp_data[i].y);
   })

In the code above resp_data is an array holding all the data, x_scale is a D3 scale object and ym holds the y position of the mouse.

For the three elements of the tooltip I've changed the opacity, the position and the text.

We also need to clear up the tooltip when we exit the <rect> element:
    .on("mouseout", function() {
d3.select("#tooltip1")
.attr("x", "-2000")
.attr("y", "-2000")
.attr("opacity", "0.0");
d3.select("#bbd_tt_txt1")
.attr("x", "100")
.attr("y", "100")
.text(" ");
d3.select("#bbd_tt_txt2")
.attr("x", "-2000")
.attr("y", "-2000")
.text(" ");
    })

and finally we need to change the tooltip when the mouse moves:
    .on("mousemove", function(d, i) {
var ym = d3.mouse(this)[1];
d3.select("#tooltip1")
.attr("x", x_scale(resp_data[i].x)+10)
.attr("y", ym)
.attr("opacity", "0.5");
d3.select("#bbd_tt_txt1")
.attr("x", x_scale(resp_data[i].x)+10)
.attr("y", ym+12)
.text("x="+resp_data[i].x);
d3.select("#bbd_tt_txt2")
.attr("x", x_scale(resp_data[i].x)+10)
.attr("y", ym+32)
.text("y="+resp_data[i].y);
    })

And that's it, apart from CSS to style the elements. I'll leave that up to you though.

Thursday, 16 April 2015

Ofcom Broadband Report 2013 Analysis

I still can't get D3 to work with blogger so I've written this as an article on my website.

It basically just looks at the data contained within the Ofcom 2013 broadband report with charts and maps created using D3.

I'll create some posts to explain how I did it later. Hope you enjoy!