# Monthly Archives: January 2012

## New R User Group in Cambridge, UK

January 31, 2012
By

Yet another new local R user group has launched this month, this time in Cambridge, UK. Cambridge RUG was created by data analyst Andrew Caines to promote the use of R in the Cambridge area. The group aims to encourage people try the R language, act as an advice centre to help people get where they want to with...

## Weak Law of Large Numbers

January 31, 2012
By

1 Description The weak law of large numbers is a result in probability theory also known as Bernoulli’s

## quick tips: within function assignment and specific object removal

January 31, 2012
By

If you’re familiar with the faster iterations on objects such as lapply, sapply, or apply for matrices, you might get surprised that the function call saves new assignments only locally. One of my favorite lines in R comes from the … Continue reading →

## Example: Two Sample t-Test

January 31, 2012
By

The recovery time (in days) is measured for 10 patients taking a new drug and for 10 different patients taking a placebo. We wish to test the hypothesis that the mean recovery time for patients taking the drug is less than for those taking placebo. The...

## Given a room with n people in it, what is the probability any two will have the same birthday?

January 31, 2012
By

Revisiting a fun puzzle I remember first encountering as an undergraduate. Nice example of creating a plot in R using ggplot2. I also plot the probability of someone in the room having the same birthday as you.

## Example: One Sample t-Test

January 31, 2012
By

Using the stack loss dataset, test the hypothesis that the mean of the stackloss is equal to 20 versus a two-sided alternative. Solution:Codes:Output:Interpretation: With the p-value greater than the level of significance alpha at 0.05, then we la...

## Surfaces in ternary plots

January 31, 2012
By

In mixture experiments there is a constraint that the variables are the proportions of components that are mixed together with the consequence that these proportions sum to one. When fitting regression models to data from mixture experiments we may be interested in reprenting the fitted model with a surface plot. The constraint on proportions means

## ultimate R recursion

January 31, 2012
By

One of my students wrote the following code for his R exam, trying to do accept-reject simulation (of a Rayleigh distribution) and constant approximation at the same time: which I find remarkable if alas doomed to fail! I wonder if there exists a (real as opposed to fantasy) computer language where you could introduce constants

## This graph makes me think Kobe is not that good, he just shoots a lot

January 31, 2012
By

I find it surprising that NBA commentators rarely talk about field goal percentage. Everybody knows that the more you shoot the more you score. But players that score a lot are admired without consideration of their FG%. Of course having a high FG% is ...

## Given a room with n people in it, what is the probability any two will have the same birthday?

January 31, 2012
By

Revisiting a fun puzzle I remember first encountering as an undergraduate. Nice example of creating a plot in R using ggplot2. I also plot the probability of someone in the room having the same birthday as you. ## See http://en.wikipedia.org/wiki/Bi...