# rblogs

### Surviving a binomial mixed model

November 11, 2011 |

A few years ago we had this really cool idea: we had to establish a trial to understand wood quality in context. Sort of following the saying “we don’t know who discovered water, but we are sure that it wasn’t … Continue reading → [Read more...]

### Coming out of the (Bayesian) closet: multivariate version

November 7, 2011 |

This week I’m facing my—and many other lecturers’—least favorite part of teaching: grading exams. In a supreme act of procrastination I will continue the previous post, and the antepenultimate one, showing the code for a bivariate analysis of a randomized … Continue reading → [Read more...]

### Teaching with R: the tools

November 1, 2011 |

I bought an Android phone, nothing fancy just my first foray in the smartphone world, which is a big change coming from the dumb phone world(*). Everything is different and I am back at being a newbie; this is what … Continue reading → [Read more...]

### Multivariate linear mixed models: livin’ la vida loca

October 31, 2011 |

I swear there was a point in writing an introduction to covariance structures: now we can start joining all sort of analyses using very similar notation. In a previous post I described simple (even simplistic) models for a single response … Continue reading → [Read more...]

### Covariance structures

October 26, 2011 |

In most mixed linear model packages (e.g. asreml, lme4, nlme, etc) one needs to specify only the model equation (the bit that looks like y ~ factors...) when fitting simple models. We explicitly say nothing about the covariances that complete … Continue reading → [Read more...]

### Longitudinal analysis: autocorrelation makes a difference

October 25, 2011 |

Back to posting after a long weekend and more than enough rugby coverage to last a few years. Anyway, back to linear models, where we usually assume normality, independence and homogeneous variances. In most statistics courses we live in a … Continue reading → [Read more...]

### Teaching with R: the switch

October 21, 2011 |

There are several blog posts, websites (and even books) explaining the transition from using another statistical system (e.g. SAS, SPSS, Stata, etc) to relying on R. Most of that material treats the topic from the point of view of i- … Continue reading → [Read more...]

### Spatial correlation in designed experiments

October 20, 2011 |

Last Wednesday I had a meeting with the folks of the New Zealand Drylands Forest Initiative in Blenheim. In addition to sitting in a conference room and having nice sandwiches we went to visit one of our progeny trials at … Continue reading → [Read more...]

### On R, bloggers, politics, sex, alcohol and rock & roll

October 19, 2011 |

Yesterday morning at 7 am I was outside walking the dog before getting a taxi to go to the airport to catch a plane to travel from Christchurch to Blenheim (now I can breath after reading without a pause). It … Continue reading → [Read more...]

### Large applications of linear mixed models

October 18, 2011 |

In a previous post I summarily described our options for (generalized to varying degrees) linear mixed models from a frequentist point of view: nlme, lme4 and ASReml-R†, followed by a quick example for a split-plot experiment. But who is really … Continue reading → [Read more...]

### Lattice when modeling, ggplot when publishing

October 17, 2011 |

When working in research projects I tend to fit several, sometimes quite a few, alternative models. This model fitting is informed by theoretical considerations (e.g. quantitative genetics, experimental design we used, our understanding of the process under study, etc.) but … Continue reading → [Read more...]

### Linear mixed models in R

October 16, 2011 |

A substantial part of my job has little to do with statistics; nevertheless, a large proportion of the statistical side of things relates to applications of linear mixed models. The bulk of my use of mixed models relates to the … Continue reading → [Read more...]

### Maximum likelihood

October 13, 2011 |

This post is one of those ‘explain to myself how things work’ documents, which are not necessarily completely correct but are close enough to facilitate understanding. Background Let’s assume that we are working with a fairly simple linear model, where … Continue reading → [Read more...]

### Simulating data following a given covariance structure

October 12, 2011 |

Every year there is at least a couple of occasions when I have to simulate multivariate data that follow a given covariance matrix. For example, let’s say that we want to create an example of the effect of collinearity when … Continue reading → [Read more...]

### Setting plots side by side

October 11, 2011 |

This is simple example code to display side-by-side lattice plots or ggplot2 plots, using the mtcars dataset that comes with any R installation. We will display a scatterplot of miles per US gallon (mpg) on car weight (wt) next to … Continue reading → [Read more...]

October 10, 2011 |

I tend not to upgrade R very often—running from 6 months to 1 year behind in version numbers—because I had to reinstall all packages: a real pain. A quick search shows that people have managed to come up with good … Continue reading → [Read more...]

### Reading HTML pages in R for text processing

October 10, 2011 |

We were talking with one of my colleagues about doing some text analysis—that, by the way, I have never done before—for which the first issue is to get text in R. Not any text, but files that can be accessed … Continue reading → [Read more...]

### Operating on datasets inside a function

October 9, 2011 |

There are times when we need to write a function that makes changes to a generic data frame that is passed as an argument. Let’s say, for example, that we want to write a function that converts to factor any … Continue reading → [Read more...]

### A brief idea of style

October 8, 2011 |

Once one starts writing more R code the need for consistency increases, as it facilitates managing larger projects and their maintenance. There are several style guides or suggestions for R; for example, Andrew Gelman’s, Hadley Wickham’s, Bioconductor’s and this one. … Continue reading → [Read more...]

### All combinations for levelplot

October 7, 2011 |

In a previous post I explained how to create all possible combinations of the levels of two factors using expand.grid(). Another use for this function is to create a regular grid for two variables to create a levelplot or a … Continue reading → [Read more...]
1 2 3 4