Get startedGet started for free

Marketing example

As described in the video, our client is interested in knowing if a friend's recommendation increases the number of people who buy, rather than pass, on his online product. He has given us a summary of his data as a data.frame called all_data. This data includes the number of Purchases and Passes for 4 test cities (city) as well as the customer ranking. This data structure lends itself to using cbind() on the two columns of interest to create a matrix (You could use other methods of making a matrix in R, but this is one of the easiest methods).

You are interested to see if the recommendation from a friend increases people buying the product. To answer this question, you will build a glmer() model and then examine the model's output.

If the parameter estimate for friend is significantly greater than zero, then a friend's recommendation increases the chance somebody makes a purchase. If the parameter estimate for friend is significantly less than zero, then a friend's recommendation decreases the chance somebody makes a purchase. If the parameter estimate for friend is not significantly different than zero, then a friend's recommendation has no effect on somebody making a purchase.

This exercise is part of the course

Hierarchical and Mixed Effects Models in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load lmerTest
library(lmerTest)

# Fit the model and look at its summary 
model_out <- ___
summary(model_out) 
Edit and Run Code