October 2012

Fit and Visualize A MARS Model

October 7, 2012 | statcompute

[This article was first published on Yet Another Blog in Statistical Computing » S+/R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. ################################################# ## FIT A MULTIVARIATE ADAPTIVE REGRESSION ## ## SPLINES MODEL (MARS) USING MDA PACKAGE ## ## DEVELOPED BY HASTIE AND TIBSHIRANI ## ################################################# # LOAD LIBRARIES AND DATA library(MASS); library(mda); data(Boston); # FIT AN ADDITIVE MARS MODEL mars.fit <- mars(Boston[, -14], Boston[14], degree = 1, prune = TRUE, forward.step = TRUE) # SHOW CUT POINTS OF MARS cuts <- mars.fit$cuts[mars.fit$selected.terms, ]; dimnames(cuts) <- list(NULL, names(Boston)[-14]); print(cuts); factor <- mars.fit$factor[mars.fit$selected.terms, ]; dimnames(factor) <- list(NULL, names(Boston)[-14]); print(factor); # EXAMINE THE FITTED FUNCTION BETWEEN EACH IV AND DV par(mfrow = c(3, 5), mar=c(2, 2, 2, 2), pty="s") for (i in 1:13) { xp <- matrix(sapply(Boston[1:13], mean), nrow(Boston), ncol(Boston) - 1, byrow = TRUE); xr <- sapply(Boston, range); xp[, i] <- seq(xr[1, i], xr[2, i], len=nrow(Boston)); xf <- predict(mars.fit, xp); plot(xp[, i], xf, xlab = names(Boston)[i], ylab = "", type = "l"); } To leave a comment for the author, please follow the link [...] [Read more...]

Weekend Reading – Facebook’s P/E ratio

October 7, 2012 | systematicinvestor

The Barron’s article Still Too Pricey by Andrew Bary looks at the share price of the Facebook and based on the P/E ration valuation metrics concludes that even at the current prices, stock is overvalued. I want to show how to do this type of fundamental analysis using ... [Read more...]

EDA Before CDA

October 6, 2012 | John Myles White

One Paragraph Summary Always explore your data visually. Whatever specific hypothesis you have when you go out to collect data is likely to be worse than any of the hypotheses you’ll form after looking at just a few simple visualizations of that data. The most effective hypothesis testing framework ... [Read more...]

A quick introduction to ggplot()

October 5, 2012 | Noam Ross

I gave a short talk today to the [Davis R Users’ Group] about ggplot. This what I presented. Additional resources at the bottom of this post ggplot is an R package for data exploration and producing plots. It produces fantastic-looking graphics and allows one to slice and dice one’s ... [Read more...]

DIY ZeroAccess GeoIP Plots

October 5, 2012 | hrbrmstr

Since F-Secure was #spiffy enough to provide us with GeoIP data for mapping the scope of the ZeroAccess botnet, I thought that some aspiring infosec data scientists might want to see how to use something besides Google Maps & Google Earth to view the data. If you look at the CSV ...
[Read more...]

Running motivation #An R amusement

October 5, 2012 | ibartomeus

Henry John-Alder told me once that in a marathon, twice as runners cross the line at 2h 59m than at 3h 00m. He pointed out that this anomaly in the distribution of finishers per minute (roughly normal shaped) is due … Continue reading → [Read more...]

Calculating distances (across matrices)

October 5, 2012 | is.R()

This Gist is mostly for my future self, as a reminder of how to find distances between each row in two different matrices. To create a distance matrix from a single matrix, the function dist(), from the stats package is sufficient. There are times, ho... [Read more...]

How to upgrade R in Ubuntu 12.04

October 4, 2012 | Hidden Treasures

Open your sources.list file in geditsudo gedit /etc/apt/sources.listand add the following line:deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ precise/Note that you don't have to use that mirror. You may use any mirror from the list here : http://cran.r-project.org/mirrors.htmlAdd ... [Read more...]

Permanent Portfolio – Simple Tools

October 4, 2012 | systematicinvestor

I have previously described and back-tested the Permanent Portfolio strategy based on the series of posts at the GestaltU blog. Today I want to show how we can improve the Permanent Portfolio strategy perfromance using following simple tools: Volatility targeting Risk allocation Tactical market filter First, let’s load the ... [Read more...]

RcppArmadillo 0.3.4.3

October 4, 2012 | Thinking inside the box

Another bug-fix release of Armadillo, now at version 3.4.3 whike the 3.4.* stabilizes, and with it a version 0.3.4.3 of RcppArmadillo, our wrapper for R and Armadillo. The new version is already on CRAN as of earlier today. Once again no R level or i... [Read more...]

RProtoBuf 0.2.6

October 4, 2012 | Thinking inside the box

Release 0.2.6 of RProtoBuf arrived on CRAN earlier this morning. RProtoBuf provides GNU R bindings for the Google Protobuf data encoding library used and released by Google. This release was once more driven largely by Murray whom we have now add... [Read more...]
1 11 12 13 14 15 16

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)