Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

icecream

Icecream sales and temperature


Description

A synthetic dataset on weekly ice cream sales in two locations in Amsterdam, along with air temperature. The idea is that the ice cream salesman first sold icecream in 'Oosterpark', and decided to move shop to the 'Dappermarkt' the year after. Did sales improve? This dataset can be used to show that naive conclusions from simple linear model fits can be misleading, and that the use of covariates (here, air temperature) can change conclusions about effects.

Usage

icecream

Format

A data frame with 40 rows and 3 variables:

temperature

double Air temperature (C)

sales

double Icecream sales per week (in local currency)

location

factor Either 'Dappermarkt' or 'Oosterpark'

Examples

data(icecream)

# Linear model, temperature as covariate
fit_ice <- lm(sales ~ temperature*location, data=icecream)

# Try to guess from coefficients where the sales were higher:
summary(fit_ice)

# What about now?
with(icecream, plot(temperature, sales, pch=19, col=location))
legend("topleft", levels(icecream$location), fill=palette())

lgrdata

Example Datasets for a Learning Guide to R

v0.1.1
CC0
Authors
Remko Duursma [aut, cre], Jeff Powell [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.