Learn R Programming

glmtoolbox (version 0.1.12)

advertising: Advertising

Description

The advertising data set consists of sales of that product in 200 different markets. It also includes advertising budgets for the product in each of those markets for three different media: TV, radio, and newspapers.

Usage

data(advertising)

Arguments

Format

A data frame with 200 rows and 4 variables:

TV

a numeric vector indicating the advertising budget on TV.

radio

a numeric vector indicating the advertising budget on radio.

newspaper

a numeric vector indicating the advertising budget on newspaper.

sales

a numeric vector indicating the sales of the interest product.

References

James G., Witten D., Hastie T., Tibshirani R. (2013, page 15) An Introduction to Statistical Learning with Applications in R, Springer, New York.

Examples

Run this code
data(advertising)
breaks <- with(advertising,quantile(radio,probs=c(0:3)/3))
labels <- c("low","mid","high")
advertising2 <- within(advertising,radioC <- cut(radio,breaks,labels,include.lowest=TRUE))
dev.new()
with(advertising2,plot(TV,sales,pch=16,col=as.numeric(radioC)))
legend("topleft",legend=c("low","mid","high"),fill=c(1:3),title="Radio",bty="n")

Run the code above in your browser using DataLab