Posts Tagged ‘ R ’

Random Data Sets Quickly

April 25, 2015
By
Random Data Sets Quickly

This post will discuss a recent GitHub package I’m working on, wakefield to generate random data sets. The post is broken into the following sections: Demo 1.1 Random Variable Functions 1.2 Random Data Frames 1.3 Missing Values 1.4 Default Data … Continue reading →

Read more »

scale acceleration

April 23, 2015
By
scale acceleration

Kate Lee pointed me to a rather surprising inefficiency in matlab, exploited in Sylvia Früwirth-Schnatter’s bayesf package: running a gamma simulation by rgamma(n,a,b) takes longer and sometimes much longer than rgamma(n,a,1)/b, the latter taking advantage of the scale nature of b. I wanted to check on my own whether or not R faced the same […]

Read more »

R: single plot with two different y-axes

April 21, 2015
By
R: single plot with two different y-axes

I forgot where I originally found the code to do this, but I recently had to dig it out again to remind myself how to draw two different y axes on the same plot to show the values of two different features of the data. This is somewhat distinct from th...

Read more »

Combining several lattice charts into one

April 21, 2015
By
Combining several lattice charts into one

Last week I mentioned the grid.arrange function of the gridExtra package that allows me to combine graphical grid objects onto one page. The latticeExtra package provides another elegant solution for trellis (lattice) plots: the function c.trellis() or...

Read more »

simulating correlated Binomials [another Bernoulli factory]

April 20, 2015
By
simulating correlated Binomials [another Bernoulli factory]

This early morning, just before going out for my daily run around The Parc, I checked X validated for new questions and came upon that one. Namely, how to simulate X a Bin(8,2/3) variate and Y a Bin(18,2/3) such that corr(X,Y)=0.5. (No reason or motivation provided for this constraint.) And I thought the following (presumably […]

Read more »

Reading fixed width formats in the Hadleyverse

April 19, 2015
By
Reading fixed width formats in the Hadleyverse

This is an update to a previous post on reading fixed width formats in R. A new addition to the Hadleyverse is the package readr, which includes a function read_fwf to read fixed width format files. I’ll compare the LaF approach to the readr approach using the same dataset as before. The variable wt is […]

Read more »

The Non-parametric Bootstrap as a Bayesian Model

April 17, 2015
By
The Non-parametric Bootstrap as a Bayesian Model

The non-parametric bootstrap was my first love. I was lost in a muddy swamp of zs, ts and ps when I first saw her. Conceptually beautiful, simple to implement, easy to understand (I thought back then, at least). And when she whispered in my ear, “I...

Read more »

Statistics journals network

April 16, 2015
By
Statistics journals network

Read more »

Python and R: Basic Sampling Problem

April 16, 2015
By

In this post, I would like to share a simple problem about sampling analysis. And I will demonstrate how to solve this using Python and R. The first two problems are originally from Sampling: Design and Analysis book by Sharon Lohr.ProblemsLet $N=6$ an...

Read more »

Bernoulli, Montmort and Waldegrave

April 14, 2015
By
Bernoulli, Montmort and Waldegrave

In the last issue of Statistical Science, David Belhouse [author of De Moivre’s biography]  and Nicolas Fillion published an accounting of a discussion between Pierre Rémond de Montmort, Nicolaus Bernoulli—”the” Bernoulli associated with the St. Petersburg paradox—, and Francis Waldegrave, about the card game of Le Her (or Hère, for wretch). Here is the abridged […]

Read more »


Subscribe

Email:

  Subscribe