Articles by BioStatMatt

One-arm Bayesian Adaptive Trial Simulation Code

November 9, 2018 | 0 Comments

I had an opportunity recently to design a Bayesian adaptive trial with several interim analyses that allow for early stopping due to efficacy or futility. The code below implements the one-arm trial described in the great introductory article by Ben Saville et al. Three of the coauthors are current or ... [Read more...]

Quick illustration of Metropolis and Metropolis-in-Gibbs Sampling in R

June 3, 2017 | 0 Comments

The code below gives a simple implementation of the Metropolis and Metropolis-in-Gibbs sampling algorithms, which are useful for sampling probability densities for which the normalizing constant is difficult to calculate, are irregular, or have high dimension (Metropolis-in-Gibbs). ## Metropolis sampling ## x - current value of Markov chain (numeric vector) ## targ - ... [Read more...]

Round values while preserve their rounded sum in R

July 27, 2016 | 0 Comments

After an embarrassing teleconference in which I presented a series of percentages that did not sum to 100 (as they should have), I found some R code on to help me to avoid this in the future. In general, the sum of rounded numbers (e.g., using the base::... [Read more...]

Principal curves example (Elements of Statistical Learning)

April 21, 2016 | 0 Comments

The bit of R code below illustrates the principal curves methods as described in The Elements of Statistical Learning, by Hastie, Tibshirani, and Friedman (Ch. 14; the book is freely available from the authors' website). Specifically, the code generates some bivariate data that have a nonlinear association, initializes the principal curve ... [Read more...]

My Poster at Rocky 2015: Estimating parameters of the Hodgkin-Huxley cardiac cell model by integrating raw data from multiple types of voltage-clamp experiments

December 18, 2015 | 0 Comments

I'm recently returned from the 2015 Rocky Mountain Bioinformatics Conference, where I presented the above poster. This is work with a colleague, Rick Gray, at the FDA. He and I collaborate on our NIH award "Optimal Design of Challenge-Response Experiments in Cardiac Electrophysiology" (HL118392) The (original) poster abstract is below, but ... [Read more...]

Delta Method Confidence Bands for Gaussian Density

October 2, 2015 | 0 Comments

During one of our Department's weekly biostatistics "clinics", a visitor was interested in creating confidence bands for a Gaussian density estimate (or a Gaussian mixture density estimate). The mean, variance, and two "nuisance" parameters, were simultaneously estimated using least-squares. Thus, the approximate sampling variance-covariance matrix (4x4) was readily available. The ... [Read more...]

Notes on Multivariate Gaussian Quadrature (with R Code)

September 25, 2015 | 0 Comments

Statisticians often need to integrate some function with respect to the multivariate normal (Gaussian) distribution, for example, to compute the standard error of a statistic, or the likelihood function in of a mixed effects model. In many (most?) useful cases, these integrals are intractable, and must be approximated using computational ... [Read more...]

Nested vs. Non-nested (crossed) Random Effects in R

June 13, 2015 | 0 Comments

The R script below illustrates the nested versus non-nested (crossed) random effects functionality in the R packates lme4 and nlme. Note that crossed random effects are difficult to specify in the nlme framework. Thus, I've included a back-of-the-envelope (literally a scanned image of my scribble) interpretation of the 'trick' to ... [Read more...]

Some 3D Graphics (rgl) for Classification with Splines and Logistic Regression (from The Elements of Statistical Learning)

February 1, 2015 | 0 Comments

This semester I'm teaching from Hastie, Tibshirani, and Friedman's book, The Elements of Statistical Learning, 2nd Edition. The authors provide a Mixture Simulation data set that has two continuous predictors and a binary outcome. This data is used to demonstrate classification procedures by plotting classification boundaries in the two predictors. ... [Read more...]

Read sas7bdat files in R with GGASoftware Parso library

September 12, 2014 | 0 Comments

... using the new R package sas7bdat.parso. The software company GGASoftware has extended the work of myself and others on the sas7bdat R package by developing a Java library called Parso, which also reads sas7bdat files. They have worked out most of the remaining kinks. For example, ... [Read more...]

Making inferences about unusual population quantities.

April 4, 2014 | 0 Comments

This post builds on my last: Alternatives to model diagnostics for statistical inference?, where I had claimed that we could make quality inferences about the best linear approximation to a quadratic relationship. The R code below implements such a scenario, to establish a framework for discussion. I have inserted comments ... [Read more...]

Alternatives to model diagnostics for statistical inference?

March 28, 2014 | 0 Comments

Consider the problem of making statistical inferences, as opposed to predictions. The product of statistical inference is a probabilistic statement about a population quantity, for example a 100(1-)% confidence interval for a population median. In this context, the principal reason for diagnostics is to comfort ourselves about the quality of ... [Read more...]

Image CGI with R

March 24, 2014 | 0 Comments

I received an email recently with a question about using R in the common gateway interface (CGI) framework to create and pass image data to the web browser. I posted to stackoverflow about this some time ago, but had forgotten the details. The trouble is that R's graphics devices only ... [Read more...]
1 2 3 4

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)