Lucas S. Macoris
  • Home
  • Overview
  • Financial Management
  • Financial Strategy
  • Quantitative Finance
  • Quantitative Methods

Quantitative Methods


About the course

This is a graduate-level course in Quantitative Methods in Marketing for the Master’s Program in Economics and Finance (MEF), organized by the University of Navarra (UNAV). This course aims to provide a hands-on approach to some of the methods widely used to solve practical questions in the advertisement industry, nurturing students with enough methodological background to understand the methods’ differences, advantages and limitations, and ultimately apply them with enough technical rigor to solve business-oriented questions.

This course will be divided into two distinct sections:

  1. The first section will focus on choice models, where students will be exposed to a series of techniques used in practical applications to estimate consumer’s choices over a defined set of possibilities, either that being a binary choice (i.e, opt-out of a subscription or renew) or a multinomial choice (i.e, choosing which product to buy from a set of possibilities).

  2. The second section will be focused on market response models - measuring the effects of marketing efforts on sales metrics - and will discuss methods ranging from experimental design to panel-data estimation. This part of the course will be covered by Prof. Xavi Vidal-Berastain.

Additional papers and references not covered will be organized and outlined in the course’s official bibliography. Students are expected to apply the methods discussed in Sections 1 and 2 and replicate the codes developed during class. All coding routines will be discussed during class, and a handout notebook will be provided at the end of each class.

The evaluation will grade students based on their ability to develop, analyze, and discuss the results of a quantitative marketing case study. Students are expected to work in groups and create a report (code + discussions) applying some techniques discussed in class in a data case. The due date is 48 hours. Performance will be evaluated regarding reproducibility, organization, and quality of the discussion.

Tech-setup: setting up your environment

Throughout the course, students will also be exposed to a series of practical coding sessions, where the instructors will walk through practical applications of the methods discussed in class. All coding sessions will be developed using Python. Using the correct Python version ensures compatibility with dependencies, preventing installation failures and runtime errors. Some packages require specific versions for stability or features, while newer releases may break existing code.

To make sure you are fully able to perform all analyses, I recommend using the latest Python version (3.13.2), which you can download using this link.

After you are done with your Python installation, it is time to install all package dependencies that will be used throughout the lectures. To that point, ensure to call pip install your_package on your terminal all Python packages that we’ll be using. If you are using Python for other applications, is always recommended to create a separate virtual environment (venv) using your terminal. Virtual environments help isolate projects with different Python versions, avoiding conflicts and making sure that the outputs are reproducible.

For Windows users, use the Windows button + R and type cmd:

python -m venv /path/to/new/virtual/environment-name

Note that environment-name can be any name of your choice. After you do this, ensure that your machine points to the environment by running:

cd /path/to/new/virtual/environment

Finally, activate your environment so that Python knows that we’ll be using it:

python activate environment/Scripts/activate

If you have followed all the steps, you should see your enviroment-name surround by parenthesis. You’re now ready to install the packages that we’ll need! In order to do that, I’ve already stored it for you inside a notepad:

matplotlib
pandas
numpy
statsmodels
jupyter
scikit-learn
plotnine
great_tables
pyarrow
mlxtend

Now, create a .txt file called requirements.txt and copy-paste the contents outlined above. These are the python packages that we’ll require in order to get things moving. After you’ve done this, place the requirements.txt file inside your enviroment. Before you install any packages, you can check the packages that are currently installed in your environment and store in a .txt file by calling:

pip freeze >> installed_packages.txt

Not surprisingly, you’ll noticed that this action has created an empty file. In other words, there are still no packages installed in your newly created environment. Now, to install the packages inside requirements.txt, do:

pip install -r requirements.txt

This can take some time, depending on the packages and your current computer settings. After you’re done with this part, you can use pip freeze installed.packages.txt again and see that there are new dependencies installed!

2. Using Quarto

In the first section of this course, you’ll be assigned with a data case, where you’ll need to manipulate code and write your insights altogether. I want to encourage you to give Quarto a try:

  1. It has multi-language support (Python, R, Julia, JavaScript), parses equations and mathematical notations via pandoc, and integrates seamlessly with GitHub
  2. Advanced document formatting and output options: you can choose pdf, html, docx, or even a reveal.js presentation (like the ones from this course!)
  3. It is easy, intuitive, and lets you focus on the most important aspect of your work

To install Quarto, follow this link and choose your Operating System. RStudio will automatically locate it and make it as an option whenever creating a new file with Ctrl+N.

There are several IDEs that integrate well with Quarto. In special, I’d recommend RStudio, VSCode, and Positron. While the former is more suited for R programming, it does work quite well for rendering Quarto documents using both R and Python. VSCode and Positron (which is built on top of the open-source VSCode), on the other hand, provide support for Quarto through the Extensions panel.

3. Replications

Along with the slides, each lecture will also contain a replication file with all examples that have been showcased during the in-class meeting. In this way, you can follow along and replicate all contents from the lectures on your end.

To ensure everyone can easily follow and replicate the code used in our lectures, we will be using Google Colab. Colab is a free, cloud-based platform that allows you to run Python code directly in your browser without any installation. It supports real-time collaboration and comes pre-installed with most of the libraries we’ll need.

To make sure you are able to replicate those notebooks, please follow, for each lecture, the instructions present on ADI. You can simply download all necessary files, drag and drop them to the Collab notebook, and run the code.

For each lecture, please refer to the following links:

  1. Binary Models and its Applications - access here
  2. Evaluating Logistic Regression Outcomes - access here
  3. Multinomial Choice Models and its applications - access here
  4. Market Basket Analysis - access here

Contents

Below you can find the persistent links to all lectures of the course. As they are continuously updated with fixes and new implementations, you might expect some changes from time to time in the contents of each file.

Note
  1. Hit F for full-screen mode
  2. If you are interest in getting a .pdf version of the slides, hit E to switch to print mode and then Ctrl + P
Title Reading Time
Choice Models and its Applications 32 min
Evaluating Logistic Regresion Outcomes 18 min
Market Basket Analysis 12 min
Multiple Choice Models 19 min
No matching items

Copyright 2025, Lucas Macoris. Photography by Juliana Rizieri.

 
  • Edit this page
  • Report an issue

Built with Quarto