Convert decimal to IEEE-754 in R

October 6, 2010
By

For some theory on the standard IEEE-754, you can read the Wikipedia page. Here I will post only the code of the function to make the conversion in R.First we write some functions to convert decimal numbers to binary numbers:decInt_to_8bit q r xx for(i in 1:precs){xx q r xx }rr return(rr)}devDec_to_8bit nas nbs xxs for(i in 1:precs){xxs...

Read more »

Convert decimal to IEEE-754 in R

October 6, 2010
By

For some theory on the standard IEEE-754, you can read the Wikipedia page. Here I will post only the code of the function to make the conversion in R.First we write some functions to convert decimal numbers to binary numbers:decInt_to_8bit q r xx for(i in 1:precs){xx q r xx }rr return(rr)}devDec_to_8bit nas nbs xxs for(i in 1:precs){xxs...

Read more »

How fast is JAGS?

October 6, 2010
By
How fast is JAGS?

From Martyn Plummer, on the JAGS news blog. Key graph below, showing a few outlying cases in which JAGS is substantially slower than OpenBUGS, but generally, JAGS performs quite favorably. Key point from Martyn: Incidentally, these figures are for JAGS with the glm module loaded. The glm module is not loaded by default. If you

Read more »

Typos…

October 5, 2010
By
Typos…

Edward Kao just sent another typo found both in  Monte Carlo Statistical Methods (Problem 3.21) and in Introducing Monte Carlo Methods with R (Exercise 3.17), namely that should be I also got another email from Jerry Sin mentioning that matrix summation in the matrix commands of Figure 1.2 of Introducing Monte Carlo Methods with R

Read more »

The Data Science Venn Diagram

October 5, 2010
By
The Data Science Venn Diagram

Whenever I'm asked, "Who uses R?", I usually rattle off a long list of job titles: statistician, analyst, quant, researcher ... and that's before all the domain-specific titles. It would be nice if there were a simple, succinct phrase to describe the process of working with, analyzing, and communicating with real data. At the new blog, "dataists", the inaugural...

Read more »

Arctic Sea Ice Extent Trends: 1979-2010; Update 1

October 5, 2010
By
Arctic Sea Ice Extent Trends: 1979-2010; Update 1

Now that the 2010 Arctic sea ice melt season is over, we can see how 2010 fits into the long-term trends Arctic  Sea Ice Extent. This post shows an R Climate chart that I have made to look at the … Continue reading →

Read more »

Example 8.8: more Hosmer and Lemeshow

October 5, 2010
By
Example 8.8: more Hosmer and Lemeshow

This is a special R-only entry.In Example 8.7, we showed the Hosmer and Lemeshow goodness-of-fit test. Today we demonstrate more advanced computational approaches for the test.If you write a function for your own use, it hardly matters what it looks l...

Read more »

India Australia test cricket matches over the years

October 5, 2010
By
India Australia test cricket matches over the years

If you're like me - chewing your nails, sitting in the same position for the last 2 hours to watch India battle Australia in the Mohali test match and enjoying the fascinating duel, watch how closely these two teams have fought in the past. This plot s...

Read more »

India Australia test cricket matches over the years

October 5, 2010
By
India Australia test cricket matches over the years

If you're like me - chewing your nails, sitting in the same position for the last 2 hours to watch India battle Australia in the Mohali test match and enjoying the fascinating duel, watch how closely these two teams have fought in the past. This plot s...

Read more »

Why R is better than Excel for teaching statistics

October 4, 2010
By
Why R is better than Excel for teaching statistics

This was the topic of a recent conversation on the Australian and New Zealand R mailing list. Here is an edited list of some of the comments made. R is free. R is well-documented. R runs (really well) on *nix as well as Windows and Mac OS. R is open-source. Trust in the R software

Read more »

S4 classes in R: printing function definition and getting help

October 4, 2010
By

I’m not very familiar with S4 classes and methods, but I assume it’s the recommended way to write new packages since it is newer than S3; this of course is open to debate. I’ll outline my experience of programming with S4 classes and methods in a later post, but in the mean time, I want... Read more »

Use R to Analyze Players for your Fantasy Hockey League

October 4, 2010
By
Use R to Analyze Players for your Fantasy Hockey League

I am in a fantasy hockey league for the first time this seasons and I wanted to use R to analyze players.  Since I am relatively new to R, I am quite certain this code could be improved.  The code below is functional, however, and while this isn’t my complete analysis, I think it outlines

Read more »

Max Heart Rate Calculations Compared

October 4, 2010
By
Max Heart Rate Calculations Compared

Physical fitness has become increasingly technical and data driven.  I started running a bit in the last few months and have been delving into the prevailing wisdom related to assessing ones health as a baseline for pursuing various fitness goals....

Read more »

Max Heart Rate Calculations Compared

October 4, 2010
By
Max Heart Rate Calculations Compared

Physical fitness has become increasingly technical and data driven.  I started running a bit in the last few months and have been delving into the prevailing wisdom related to assessing ones health as a baseline for pursuing various fitness goals....

Read more »

Means By

October 4, 2010
By

The other day I was asked by a coworker hos to do a SAS Means By statement in R. I embarrassingly did not know how to so I wrote something up, and this is what I came up with, it takes a data.frame and an indexing variable and computes the means for each group defined

Read more »

Code Snippets in Revolution R

October 4, 2010
By

Ajay Ohri has been trying out the Code Snippets feature in Revolution R (available free to academics), and has found it handy for writing code for statistical analysis: Now even if you are averse to using a GUI /or GUI creators don’t have your particular analysis you can basically type in code at an extremely fast pace. It is...

Read more »

The ARIMAX model muddle

October 4, 2010
By
The ARIMAX model muddle

There is often confusion about how to include covariates in ARIMA models, and the presentation of the subject in various textbooks and in R help files has not helped the confusion. So I thought I’d give my take on the issue. To keep it simple, I will only describe non-seasonal ARIMA models although the ideas

Read more »

A tale of two returns

October 4, 2010
By
A tale of two returns

It was the best of times, it was the worst of times. As you may have guessed, this is a mashup of a novel by Charles Dickens and an explanation of financial returns. The key plot element of A Tale of Two Cities is that there are two men, Charles Darnay and Sydney Carton, who … Continue reading...

Read more »

V3 Station mash up

October 3, 2010
By
V3 Station mash up

Hmm, lets see how a fusion table works with map maker. The process works like this. We read in the GHCN inventory file into R. ( see code below ) We then clean it up ( the names fields and missing values) and we output it to a  *csv  file. Then open the csv in

Read more »

More BLAS, BLASter, BLAStest: Updates on gcbd

October 3, 2010
By
More BLAS, BLASter, BLAStest: Updates on gcbd

Following up on my initial post announcing gcbd, here is a brief note on a new version. The initial post announced version 0.2.2 which was the first CRAN version of gcbd. I updated to 0.2.3 when I made the aforementioned first blog post about gcbd w...

Read more »

Le Monde puzzle [34]

October 3, 2010
By
Le Monde puzzle [34]

Since the puzzle in this week (-end) edition of Le Monde is not (easily) solvable via an R program, I chose to go back to an older puzzle that my students can solve. Eleven token are distributed around a 200 meter perimeter-long ring. They all start moving at the same speed, 18km/h, in

Read more »

ICOADS

October 3, 2010
By
ICOADS

Just a short update on ICOADS. I started out an ICOADS project with grand plan to reprocess the observation files into a “raster” format. That ends up being a really big job. Along the way I had to learn a new package Rcurl and relearn some old Unix skills for compiling RCurl. Along the way

Read more »

Plotting time vs date in R

October 2, 2010
By
Plotting time vs date in R

Having done the plot with python+matplotlib, thought I would have a go reproducing it in R, using only the builtin "plot". So, just to recap - this is a plot of the sun times (rise/set,twilight and blinding) as generated by the great python library pyephem. The R code reads in a csv file as output from a...

Read more »

Here is how to improve your charts, graphs, maps, and…

October 2, 2010
By
Here is how to improve your charts, graphs, maps, and…

Here is how to improve your charts, graphs, maps, and plots: Erase non-data ink. Erase redundant data ink. Maximize the ratio of data to ink. Show data variation, not design variation. The surface area of graphical elements should be directly proportio...

Read more »

ProjectTemplate Version 0.1-3 Released

October 2, 2010
By

I’ve just released the newest version of ProjectTemplate. The primary change is a completely redesigned mechanism for automatically loading data. ProjectTemplate can now read compressed CSV files, access CSV data files over HTTP, read Stata, SPSS and RData binary files and even load MySQL database tables automatically. For my own projects, this is a big

Read more »

>_ StatET, eclipse plug-in for R

October 2, 2010
By
>_ StatET, eclipse plug-in for R

Install the plug-in is quite simple, we only need to follow the instructions that we’ll find at the project’s page: http://www.walware.de/goto/statet The requirements are Java 5 (1.5) or higher, Eclipse IDE and the R package: rJava. The rj package is also recommended. In my case, I have installed Eclipse Helios for PHP (eclipse-php-helios-linux-gtk-x86_64.tar.gz). Eclipse download

Read more »

Typo in Example 5.18

October 2, 2010
By
Typo in Example 5.18

Edward Kao pointed out several typos in Example 5.18 of Monte Carlo Statistical Methods. First, the customers in area i should be double-indexed, i.e. which implies in turn that . Then the summary T should be defined as and as given that the first m customers have the fifth plan missing. Filed under: Books, R,

Read more »

Millionaire’s advice

October 2, 2010
By
Millionaire’s advice

Viktor Uspaskich is euro-parliamentarian delegated by Lithuania. His was born in Russia, Arkhangelsk Oblast and later on he moved to Lithuania where he made his fortune and first millions. Recently, I saw an interview with him and I found interesting to test his claim, that  gold and oil are negatively correlated. Meaning that, when the price

Read more »

head and tail for strings

October 2, 2010
By

The functions head and tail are very useful for working with lists, tables, data frames and even functions.But they do not work on strings. It is easy to define such functions> strtail + if(n+ substring(s,1-n) + else + substring(s,nchar(s)-n+1)+ }> strhead + if(n+ ...

Read more »