Quantcast
Channel: R – BioStatMatt
Browsing all 33 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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

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...

View Article



Image may be NSFW.
Clik here to view.

Recipe for Centered Horizontal Stacked Barplots (Useful for Likert scale...

There is a nice package and paper about this here: http://www.jstatsoft.org/v57/i05/paper. However, the associated code is complex and uses lattice. Here's a brief recipe using base graphics that...

View Article

Image may be NSFW.
Clik here to view.

Recipe for Computing and Sampling Multivariate Kernel Density Estimates (and...

The code snippet below creates the above graphic: ## radially symmetric kernel (Gussian kernel) RadSym

View Article

Image may be NSFW.
Clik here to view.

Notes on Multivariate Gaussian Quadrature (with R Code)

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...

View Article

Image may be NSFW.
Clik here to view.

Delta Method Confidence Bands for Gaussian Density

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,...

View Article


Image may be NSFW.
Clik here to view.

Delta Method Confidence Bands for Gaussian Mixture Density (Can Behave Badly)

This post follows from a previous post (2798), in which the delta method was used to create an approximate pointwise 95% confidence band for a Gaussian density estimate. Note that the quality of this...

View Article

Image may be NSFW.
Clik here to view.

Reference Chart for Precision of Wilson Binomial Proportion Confidence Interval

I am often asked about the number of subjects needed to study a binary outcome, which usually leads to a discussion of confidence intervals for binary proportions, and the associated precision....

View Article

Image may be NSFW.
Clik here to view.

My Poster at Rocky 2015: Estimating parameters of the Hodgkin-Huxley cardiac...

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...

View Article


Image may be NSFW.
Clik here to view.

Principal curves example (Elements of Statistical Learning)

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...

View Article


Round values while preserve their rounded sum in R

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 stackoverflow.com to help me to avoid this in the...

View Article

Image may be NSFW.
Clik here to view.

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

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...

View Article

Image may be NSFW.
Clik here to view.

One-arm Bayesian Adaptive Trial Simulation Code

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, binary...

View Article

"Increase sample size until statistical significance is reached" is not a...

TLDR: Begin with N of 10, increase by 10 until p < 0.05 or max N reached. This design has inflated type-I error. Lower p-value threshold needed to ensure specified type-I error rate. The number of...

View Article

Browsing all 33 articles
Browse latest View live


Latest Images