Statistical models chapter in OOP in R

I just finished an additional chapter in Object-oriented Programming in R. I’m trying to make it just a little longer before I try to sell it to a publisher.

If you have bought it on Amazon it should be updated automatically. Well, if you bought the Kindle version; obviously, paperbacks are not updated automatically. Still, if you have bought the paperback you get the ebook for free, so you can still get it there. I am uploading a new paperback version as well right now, but wait a few days before ordering; I don’t know how fast the new file becomes the one they print.

In any case, since people have also bought the book on Leanpub, I don’t want to make this chapter exclusive to Amazon, although the book is signed up with Kindle Select, so everyone can just download it here.

Beginning Data Science is out

My Data Science book Beginning Data Science in R is now out and you can order it on Amazon or Apress. It looks like the ebook version is only available on Apress so far. I don’t know if it will also be available as a Kindle version on Amazon later.

Anyway, let me know what you think, and please leave reviews and recommendations on Amazon or Goodreads.

Adding a chapter to Object-oriented programming in R

Yeah, as I mentioned in the previous post, I think I need to add at least one chapter to OOP in R to get it a bit longer before I sell it to a publisher. And since I don’t think I can write a full book on how to fit models—and since I already have the code for fitting Bayesian linear regression models—I am going to write a chapter on that.

It will be a bit of an example of the generic functions you typically expect a model have have and a bit about how to construct model matrices and use formulas in your code.

Since I’ve signed OOP in R up to Kindle Select I am not sure I can update the book for those who bought it on Leanpub, but I will try. If not, I’ll make this chapter available for free somewhere.

Review of Object-oriented Programming in R

I got the following review of Object-oriented Programming in R on Amazon:

I am, of course, not happy with only three stars, but I don’t think it is entirely wrong. I don’t think I give any good examples of the usefulness of object-oriented programming in R, and of the three R programming books, this, I feel, is the weakest. I do explain the various object-oriented systems in R, but do not really explain why object-oriented programming is any use in R.

For day-to-day analysis work in R, you typically use a lot of object-oriented features, but you don’t program them yourself. There, you are more likely to use functional programming. I had a hard time trying to come up with good exampels of object-oriented programming you would actually use in R, which delayed this book a lot, and I never really succeeded.

The examples I have with adding meta-information to numbers to add physical units, I think are good examples of how object-oriented systems can be used, but the truth is that I mostly use classes when implementing new statistical models, and I didn’t include that in the book. I had some plans for writing about that in a separate book, but I am not sure there is enough to write about there for a full book, so maybe I should add a chapter to this book about it instead.

When you fit different models to data and use the generic methods like predict() or coefficients() for analysis, you use the object-oriented features of R. Since I want to make this book a little longer before I can sell it as a reasonably length paperback book to Apress, such a chapter could kill two birds with one stone. I’ll have a look at this over the next week.