## Thursday, December 23, 2010

### SAS and R: Example 8.17: Logistic regression via MCMC

SAS and R: Example 8.17: Logistic regression via MCMC: "In examples 8.15 and 8.16 we considered Firth logistic regression and exact logistic regression as ways around the problem of separation, ..."

### SAS and R: A plea for consistent style!

SAS and R: A plea for consistent style!: "As we get close to the end of the year, it's time to look back over the past year and think of resolutions for 2011 and beyond. One that's o..."

## Friday, December 17, 2010

## Thursday, December 16, 2010

### Why use R

Here's a link to a blog that lists some reasons to use R

http://blog.fosstrading.com/2010/12/why-use-r.html

http://blog.fosstrading.com/2010/12/why-use-r.html

## Thursday, December 9, 2010

### Learning R

I have had to be primarily self taught in R and I still have a long way to go. I like R way better than SAS but the documentation in SAS is way better (that's what happens when you pay people to do it full time). However, there are innumerable resources for R. The hard part is sorting through them all and finding the most useful stuff. As such, I will frequently post links to good R resources for teaching and self-teaching.

A good starting place is: http://www.splusbook.com/RIntro/RCourseMaterial.html

Also, don't forget that R is a dialect of the S language so you can use S/Splus resources for R even though there will be some small differences.

A good starting place is: http://www.splusbook.com/RIntro/RCourseMaterial.html

Also, don't forget that R is a dialect of the S language so you can use S/Splus resources for R even though there will be some small differences.

## Tuesday, December 7, 2010

### R Workflow

When working with R you end up using a large number of datasets, packages, functions, objects, output files, workspaces, etc. It can get a bit overwhelming trying to keep everything organized. That is why a consistent, well-organized workflow is needed. I definitely do not have one yet. I'll post more on script editors and IDEs another time but for now I just wanted to share this video on R Workflow that includes Eclipse, Sweave, LaTeX, and R.

http://www.vcasmo.com/video/drewconway/10362

Good luck and feel free to comment with any personal experiences or suggestions.

http://www.vcasmo.com/video/drewconway/10362

Good luck and feel free to comment with any personal experiences or suggestions.

## Monday, December 6, 2010

### JAGS - Bayesian Analysis

JAGS is used for Bayesian analysis using MCMC and stands for Just Another Gibbs Sampler. It is an alternative to WinBUGS and can be accessed through R just like WinBUGS (via R2jags or RJags). It will work on a Mac unlike WinBUGS. The only problem is that most books include WinBUGS examples and not JAGS examples. However, much of the language is similar. I haven't had time to try it out yet but plan to in the future. They just released an updated version: JAGS 2.2.0 if you want to check it out.

JAGS Wiki Guide

JAGS Wiki Guide

## Saturday, December 4, 2010

### GLMM and R issues

I have been trying to run a Generalized Linear Mixed Model (GLMM) for some count data with repeated measures on sub-sampled sites and fixed effects at the site level with covariates at both the sub-plot and time levels. Plus there are different numbers of sub-plots within each site and not all sub-plots are sampled the same number of times. It's quite the gnarly dataset. I tried to use binomial-mixture models for the analysis to account for differences in detection probability but unfortunately I didn't have a sufficient number of independent sites to differentiate between detection and abundance. Plus the sampling may have violated assumptions of closure. So, anyway, I am back to GLMM and the troubles with that will have to wait for another day.

I use Mac OS 10.5.8 (Leopard) to run R unless I need to run WinBUGS (via R2WinBUGS). Unfortunately, the R package "lme4" won't load on R for Macs. It works fine on my Windows shell. I have been looking up solutions. I think the problem is that I need a fortran add-on for Xcode. Now the problem is that I don't understand anything about compiling R or Fortran or any of the other things on this website. It does look like it might be part of the solution (maybe?) to my problems with running WinBUGS through Wine on my Mac. So here is the solution I've found: http://r.research.att.com/tools/

This is the specific part that I hope will work:

I use Mac OS 10.5.8 (Leopard) to run R unless I need to run WinBUGS (via R2WinBUGS). Unfortunately, the R package "lme4" won't load on R for Macs. It works fine on my Windows shell. I have been looking up solutions. I think the problem is that I need a fortran add-on for Xcode. Now the problem is that I don't understand anything about compiling R or Fortran or any of the other things on this website. It does look like it might be part of the solution (maybe?) to my problems with running WinBUGS through Wine on my Mac. So here is the solution I've found: http://r.research.att.com/tools/

This is the specific part that I hope will work:

Download: gfortran-42-5577.pkg (for Xcode 3.1.4 only!)

This package adds GNU Fortran 4.2.4 to Apple's Xcode 3.1.4 gcc 4.2 (build 5577) compilers on Mac OS X 10.5 (Leopard).**GNU Fortran 4.2.4 for Mac OS X 10.5 (Leopard)**:Download: gfortran-42-5577.pkg (for Xcode 3.1.4 only!)

This package adds GNU Fortran 4.2.4 to Apple's Xcode 3.1.4 gcc 4.2 (build 5577) compilers on Mac OS X 10.5 (Leopard).

**It does NOT work on Snow Leopard**. This binary has been built the Apple way with the gcc_42 (build 5577) sources (by adding the Fortran directories from gcc 4.2.4 release), so it features full Apple driver (i.e. all special flags work) and works directly with the gcc 4.2 system compiler. You have to install Xcode 3.1.4 first (from ADC).## Thursday, December 2, 2010

### Another boring blog

I recently decided to create two blogs as outlets for my research. The first (The Richness of Life) focuses more on the organisms I work with as an ecologist and my general interest as a student of natural history. This blog on Quantitative Ecology stems from my recent obsessive frustration with analyzing various data sets. I have a decent background in the design of ecological experiments but have recently been trying to increase my statistical fluency (see Ellison and Dennis 2010 - Frontiers in Ecology and the Environment). While searching for information on coding in R and WinBUGS, I have utilized a variety of sources including forums and blogs where people have shared their experiences and deciphered cryptic error messages. I also came across two articles on the benefits of blogging as an academic (here and here). Without duplicating everything they wrote, I'll say that my desire to blog about my research comes from a few different perspectives. First, this is what I spend my time thinking about and it's nice to share it with like-minded individuals. Second, I hope that this could contribute to fun and productive collaborations. Third, I hope to help people on their own (sometimes painful) journeys in the realm of experimental design and analysis (including statistics and inference). Finally, I believe it will help me as a teacher if I practice articulating my thoughts and questions on these complex subjects.

I will start this first blog with a recommendation of one of my favorite books on data analysis that I've come across. Introduction to WinBUGS for Ecologists: Bayesian approach to regression, ANOVA, mixed models and related analyses is an exceptional book for self-teaching and offers a nice introduction to using WinBUGS for analyzing ecological data in a Bayesian framework.

I will start this first blog with a recommendation of one of my favorite books on data analysis that I've come across. Introduction to WinBUGS for Ecologists: Bayesian approach to regression, ANOVA, mixed models and related analyses is an exceptional book for self-teaching and offers a nice introduction to using WinBUGS for analyzing ecological data in a Bayesian framework.

Subscribe to:
Posts (Atom)