Example 7.12: Calculate and plot a running average

September 17, 2009
By
Example 7.12: Calculate and plot a running average

The Law of Large Numbers concerns the stability of the mean, as sample sizes increase. This is an important topic in mathematical statistics. The convergence (or lack thereof, for certain distributions) can easily be visualized in SAS and R (see also Horton, Qian and Brown, 2004).Assume that X1, X2, ..., Xn are independent and identically distributed realizations...

Read more »

Comments on “Introduction to Scientific Programming and Simulation Using R”

September 17, 2009
By
Comments on “Introduction to Scientific Programming and Simulation Using R”

I've just been reading Introduction to Scientific Programming and Simulation Using R by Owen Jones, Robert Maillardet, and Andrew Robinson. It seems like it would make a good introductory book for a course on, as the title suggests, scientific programm...

Read more »

R clinic this week: Regression Modeling Strategies in R

September 16, 2009
By

At this week's R clinic Frank Harrell will unveil the new rms (Regression Modeling Strategies) package that is a replacement for the R Design package.  He will demonstrate the differences with Design, especially related to enhanced graphics for displaying effects in regression models.  Frank will also discuss the implementation of quantile regression in rms.  The rms package website has...

Read more »

Multiple Linear Regression

September 14, 2009
By
Multiple Linear Regression

A multiple linear regression (MLR) model that describes a dependent variable y by independent variables x1, x2, ..., xp (p > 1) is expressed by the equation as follows, where the numbers α and βk (k = 1, 2, ..., p) are the parameter...

Read more »

Find the function you’re looking for in R

September 14, 2009
By

Any R user no matter what level of experience has had trouble finding the package or the function to do what you want to do and then figuring out how to use it.  The sos package in R just made that a lot easier. First, fire up R, then install the sos package (don't omit the quotes): install.packages("sos") It'll ask you to...

Read more »

Chicago Half Marathon 2009

September 13, 2009
By

Today it was once again time for the Chicago Half Marathon (which I have now been running in 2003, 2004, 2005, 2006, 2007 and 2008). Conditions were much much better than last year's very heavy rainfall---we were once again treated to a sunny and clear Chicago sky. It was however a little on the humid side and got...

Read more »

Finding an R function

September 13, 2009
By
Finding an R function

Suppose you want a function to fit a neural network. What’s the best way to find it? Here are three steps that help to find the elusive function relatively quickly. First, use help.search("neural") or the shorthand ??neural. This will search the help files of installed packages for the word “neural”. Actually, fuzzy matching is used

Read more »

Finding an R function

September 13, 2009
By

Suppose you want a function to fit a neural network. What’s the best way to find it? Here are three steps that help to find the elusive function relatively quickly. First, use help.search("neural") or the shorthand ??neural. This will search the help...

Read more »

New R package: sos

September 12, 2009
By

Searching help pages of contributed packages just got easier with the release of the new sos package. This is a replacement for and substantial enhancement of the existing "RSiteSearch" package. To learn more about it, try vignette("sos") We hope...

Read more »

CO2: Emissions & Changes in Atmospheric Levels

September 11, 2009
By
CO2: Emissions & Changes in Atmospheric Levels

In previous posts, I have shown the 1750-2008 global CO2 emission trends and the atmospheric CO2 concentrations at Mauna Loa, Hawaii. In this post, I compare annual CO2 emissions with annual changes in atmospheric CO2.  The resulting chart shows the portion of CO2 emissions that remains in the atmosphere and the portion that

Read more »

MATLAB style stem plot with R

September 10, 2009
By
MATLAB style stem plot with R

Recently I wanted to plot an impulse response function with R and missed the MATLAB style stem plot for doing it. I couldn't find an R function for it with a quick Google search so I made my own. So here is the function and a small example: #The function stem <- function(x,y,pch=16,linecol=1,clinecol=1,...){ if (missing(y)){ y = x ...

Read more »

MATLAB style stem plot with R

September 10, 2009
By
MATLAB style stem plot with R

Recently I wanted to plot an impulse response function with R and missed the MATLAB style stem plot for doing it. I couldn't find an R function for it with a quick Google search so I made my own. So here is the function and a small example: #The function stem <- function(x,y,pch=16,linecol=1,clinecol=1,...){ if (missing(y)){ y = x ...

Read more »

Aggregating SSURGO Data in R

September 10, 2009
By
Aggregating SSURGO Data in R

  Premise SSURGO is a digital, high-resolution (1:24,000), soil survey database produced by the USDA-NRCS. It is one of the largest and most complete spatial databases in the world; and is available for nearly the entire USA at no cost. These data are distributed as a combination of geographic and text data, representing soil map units and their...

Read more »

Machine Learning in R

September 10, 2009
By

Revolutions blog recently posted a link to R code by Joshua Reich with self-contained examples of using machine learning techniques in R, including various clustering methods (k-means, nearest neighbor, and kernel), recursive partitioning (CART), principle components analysis, linear discriminant analysis, and support vector machines.  This post also links to some slides that go over the basics

Read more »

brew: Creating Repetitive Reports

September 9, 2009
By
brew: Creating Repetitive Reports

United Nations report World Population Prospects: The 2008 Revision (highlights available here) provides data about the historical and forecasted population of the country. In exploring the future and past population trends it is relatively easy to subset the dataset by your selected variable. > file <- c("UNdata_Population.csv") > population <- read.csv(file) > names(population) <- c("code", "country", "year", +

Read more »

search the graph gallery from R

September 8, 2009
By

pre{ font-size:xx-small !important ; border: 1px black solid; } This is a short code snippet that is motivated by this thread on r-help yesterday. The gallery contains a search engine textbox (top-right) that can be used to search for content i...

Read more »

new R package : ant

September 8, 2009
By

The ant package has been released to CRAN yesterday. As discussed in previous posts in this blog (here and here), the ant R package provides an R-aware version of the ant build tool from the apache project. The package contains an R script that c...

Read more »

Comparison between 15 different cities…

September 6, 2009
By
Comparison between 15 different cities…

The other day I was thinking about how expensive will it be to live in London (as I'm going to live in London for almost one year), and also thinking about how expensive are the cities where some of my best friends live and I got a report by UBS called "Prices and Earnings 2009", it's all...

Read more »

Comparison between 15 different cities…

September 6, 2009
By
Comparison between 15 different cities…

The other day I was thinking about how expensive will it be to live in London (as I'm going to live in London for almost one year), and also thinking about how expensive are the cities where some of my best friends live and I got a report by UBS called "Prices and Earnings 2009", it's all...

Read more »

Global Mean Sea Level Trends

September 6, 2009
By
Global Mean Sea Level Trends

In this post, I show an R script that downloads the University  of Colorado, Boulder’s 1993-2009 global mean sea level (msl) change (link) data, converts the ASCII file into a usable R data frame, calculates moving average and msl change  trend rate and develops a trend  chart that shows msl change  and trend rates

Read more »

RQuantLib 0.3.0 Windows build snag

September 6, 2009
By

Yesterday's upload of RQuantLib 0.3.0 contained one minor oversight: I had failed to update src/Makefile.win to the new and enlarged set of source files. The proper fix (of using wildcards and implicit rules) was simple, and Uwe Ligges kindly rebuilt...

Read more »

RQuantLib 0.3.0 Windows build snag

September 6, 2009
By

Yesterday's upload of RQuantLib 0.3.0 contained one minor oversight: I had failed to update src/Makefile.win to the new and enlarged set of source files. The proper fix (of using wildcards and implicit rules) was simple, and Uwe Ligges kindly rebuilt R...

Read more »

RQuantLib 0.3.0 Windows build snag

September 6, 2009
By

Yesterday's upload of RQuantLib 0.3.0 contained one minor oversight: I had failed to update src/Makefile.win to the new and enlarged set of source files. The proper fix (of using wildcards and implicit rules) was simple, and Uwe Ligges kindly rebuilt...

Read more »

RQuantLib 0.3.0 released

September 5, 2009
By

Earlier this evening, I rolled up a new version of RQuantLib. It has been pushed to CRAN and Debian, and source and binary version should appear on the respective mirror networks in due course. This version, the first in a new '0.3.*' release seri...

Read more »

RQuantLib 0.3.0 released

September 5, 2009
By

Earlier this evening, I rolled up a new version of RQuantLib. It has been pushed to CRAN and Debian, and source and binary version should appear on the respective mirror networks in due course. This version, the first in a new '0.3.*' release series, ...

Read more »

RQuantLib 0.3.0 released

September 5, 2009
By

Earlier this evening, I rolled up a new version of RQuantLib. It has been pushed to CRAN and Debian, and source and binary version should appear on the respective mirror networks in due course. This version, the first in a new '0.3.*' release seri...

Read more »

Polynomial regression techniques

September 5, 2009
By
Polynomial regression techniques

Suppose we want to create a polynomial that can approximate better the following dataset on the population of a certain Italian city over 10 years. The table summarizes the data:$$\begin{tabular}{|1|1|}\hline Year & Population\\ \hline 1959&4835\\ 1960&4970\\ 1961&5085\\ 1962&5160\\ 1963&5310\\ 1964&5260\\ 1965&5235\\ 1966&5255\\ 1967&5235\\ 1968&5210\\ 1969&5175\\ \hline \end{tabular}$$First we import the data into R:Year Population Now we create the dataframe...

Read more »

Polynomial regression techniques

September 5, 2009
By
Polynomial regression techniques

Suppose we want to create a polynomial that can approximate better the following dataset on the population of a certain Italian city over 10 years. The table summarizes the data:$$\begin{tabular}{|1|1|}\hline Year & Population\\ \hline 1959&4835\\ 1960&4970\\ 1961&5085\\ 1962&5160\\ 1963&5310\\ 1964&5260\\ 1965&5235\\ 1966&5255\\ 1967&5235\\ 1968&5210\\ 1969&5175\\ \hline \end{tabular}$$First we import the data into R:Year Population Now we create the dataframe...

Read more »

R Flashmob

September 4, 2009
By

Today I noticed a call for R users to gather around a single campfire for one hour and share their questions and answers. The campfire name is stackoverflow.com, a site dedicated for handling programming questions. The event details are bellow: From: The R Flashmob Project Subject: R Flashmob #2 You are invited to take part in R Flashmob, the

Read more »