Blog Archives

Second year of entries!

June 28, 2010
By
Second year of entries!

Hello, readers new and old!We started adding examples a year ago, in advance of the book's publication. To mark the occasion, we're closing chapter 7 and starting chapter 8 next week. We've crafted a listing of all entries from the first year and mad...

Read more »

Example 7.41: hazard function plotting

June 14, 2010
By
Example 7.41: hazard function plotting

As we continue with our series on survival analysis, we demonstrate how to plot estimated (smoothed) hazard functions. RWe will utilize the routines available in the muhaz package. Background information on the methods can be found in K.R. Hess, D.M....

Read more »

Example 7.40: Nelson-Aalen plotting

June 7, 2010
By
Example 7.40: Nelson-Aalen plotting

In our previous entry, we described how to calculate the Nelson-Aalen estimate of cumulative hazard. In this entry, we display the estimates for the time to linkage to primary care for both the treatment and control groups in the HELP study.RWe use the...

Read more »

Example 7.39: Nelson-Aalen estimate of cumulative hazard

May 31, 2010
By
Example 7.39: Nelson-Aalen estimate of cumulative hazard

In our previous example, we demonstrated how to calculate the Kaplan-Meier estimate of the survival function for time to event data. A related quantity is the Nelson-Aalen estimate of cumulative hazard. In addition to summarizing the hazard incurred ...

Read more »

Example 7.38: Kaplan-Meier survival estimates

May 24, 2010
By
Example 7.38: Kaplan-Meier survival estimates

In example 7.30 we demonstrated how to simulate data from a Cox proportional hazards model.In this and the next few entries, we expand upon support in R and SAS for survival (time-to-event) models. We'll start with a small, artificial dataset of 19 su...

Read more »

Example 7.37: calculation of Hotelling’s T^2

May 17, 2010
By
Example 7.37: calculation of Hotelling’s T^2

Hotelling's T^2 is a multivariate statistic used to compare two groups, where multiple outcomes are observed for each subject. Here we demonstrate how to calculate Hotelling's T^2 using R and SAS, and test the code using a simulation study then apply ...

Read more »

Example 7.32: Add reference lines to a plot; fine control of tick marks

April 12, 2010
By
Example 7.32: Add reference lines to a plot; fine control of tick marks

Sometimes it's useful to plot regular reference lines along with the data. For a time-series plot, this can show when critical values are reached in a clearer way than simple tick marks.As an example, we revisit the empirical CDF plot shown in Example...

Read more »

Augmented support for complex survey designs in R

March 3, 2010
By
Augmented support for complex survey designs in R

We'll get back to code examples later this week, but wanted to let you know about an R package with updated functionality in the meantime.The appropriate analysis of sample surveys requires incorporation of complex design features, including stratification, clustering, weights, and finite population correction. These can be address in SAS and R for many common models. Section...

Read more »

Example 7.24: Sampling from a pathological distribution

March 1, 2010
By
Example 7.24:  Sampling from a pathological distribution

Evans and Rosenthal consider ways to sample from a distribution with density given by:f(y) = c e^(-y^4)(1+|y|)^3where c is a normalizing constant and y is defined on the whole real line.Use of the probability integral transform (section 1.10.8) is not feasible in this setting, given the complexity of inverting the cumulative density function.The Metropolis--Hastings algorithm is a Markov...

Read more »

Example 7.22: the Knapsack problem

January 13, 2010
By
Example 7.22: the Knapsack problem

The website http://rosettacode.org/wiki/Knapsack_Problem describes a fanciful trip by a traveler to Shangri La. They can take as many as they want of three valuable items, as long as they fit in a knapsack. The knapsack will hold no more than 25 weight units, and no more than 25 volume units. The problem is to maximize the...

Read more »