Advanced R Programming 2400-MIKRO-AIBF-ARP
The course continues the practical work introduced in the Introduction to AI course and focuses on applying AI-assisted programming to more complex analytical problems. Participants work throughout the day in groups of five or six. Each group is assigned a different business topic based on the Brazilian E-Commerce Public Dataset by Olist. The topics include customer satisfaction, sales structure, delivery performance, product quality and the geographical distribution of customers.
The work is inspired by the research paper by Matuszelański and Kopczewska (2022), which demonstrates how the same dataset can be used to study customer behaviour and business processes. The article serves as an example of how analytical methods, programming and substantive business questions can be combined within a coherent empirical study.
Each group is expected to design its own analytical approach, formulate detailed research questions, prepare the required data, develop and run R code, interpret the results and prepare a short presentation in R Markdown. Participants use AI coding tools, including Codex, to support programming and workflow development. However, the generated code must be run in RStudio, inspected, tested and adapted to the specific analytical problem.
The course alternates between methodological instruction, advanced programming content and immediate hands-on application. New methods and programming techniques are introduced in short teaching blocks and then applied directly to the group projects.
The first methodological block introduces unsupervised learning and clustering. Participants learn the general purpose of clustering and discuss how it can be used to identify meaningful groups of customers, products, transactions or sales patterns. The course covers k-means clustering and Partitioning Around Medoids (PAM), including the logic of both methods, their implementation in R and the differences between them.
Participants learn how the choice of variables, data types, distance metrics, scaling procedures and the number of clusters influences the results. Particular attention is paid to interpreting clusters in substantive terms and assessing whether the identified groups provide meaningful business insights rather than merely reflecting technical properties of the data.
The second programming block focuses on organising more complex analytical projects. Participants are introduced to advanced functions, defensive programming and object-oriented programming in R using the S3 and R6 systems. The purpose of these tools is presented in relation to a common problem in AI-assisted coding: generating multiple disconnected scripts that are difficult to verify, modify and reuse.
Instead of treating analysis as a sequence of loosely connected prompts and scripts, participants learn to design a modular analytical workflow. Individual components may be responsible for data preparation, model specification, model training, prediction, evaluation, visualisation and reporting. Functions and objects are used to store related information and provide a consistent structure for adding or replacing analytical methods.
The course demonstrates how carefully designed functions, input checks, informative error messages and well-defined objects can make analytical code more reliable and easier to test. Participants are encouraged to plan the structure of the project before asking AI to generate individual elements of the implementation.
The supervised-learning block introduces Random Forest and XGBoost as predictive methods that can support the analysis of the business topics assigned to the groups. Participants learn the general principles of decision-tree ensembles and compare bagging, represented by Random Forest, with boosting, represented by XGBoost.
The block covers the interpretation of predictions, model performance and variable importance, while also emphasising the limitations of these measures. Participants apply the methods to their group questions and consider how predictive models can contribute to understanding customer satisfaction, delivery performance, sales outcomes, product quality or other relevant business phenomena.
The models are implemented as part of the modular R workflows developed during the programming block. Participants use functions and object-oriented structures to organise data preparation, model training, evaluation and presentation of results. This allows them to compare different models without rebuilding the entire analysis from the beginning.
The final part of the course is devoted to completing the projects and preparing group presentations. Each group presents the analytical process, the main results and the resulting business recommendations. The presentation should show a clear path from the original business question, through data preparation and modelling, to an interpretable conclusion.
The presentations are followed by a joint discussion of the methods, results and recommendations. Participants compare their approaches, reflect on the reliability of the conclusions and consider how the findings could be used in a real business context.
The course also provides an opportunity to reflect on working under an intensive deadline with AI support. Participants discuss how to divide analytical tasks within a team, how to coordinate code and results, where AI can increase efficiency, and where substantive expertise, critical thinking and human verification remain essential. Prompting techniques introduced earlier are therefore practised in the context of a complete analytical project rather than through isolated exercises.
The project ‘Application of Artificial Intelligence in Business and Finance’ (No. BPI/SPI/2024/1/00078) is implemented by the University of Warsaw as part of the Spinaker programme organised by the National Agency for Academic Exchange (within the project ‘Wsparcie tworzenia i realizacji międzynarodowych programów kształcenia’, funded by the European Funds for Social Development 2021–2027).
Course coordinators
Micro-credential certificate
Learning outcomes
Upon completing the course, the participant
in terms of knowledge:
● knows and understands the role of advanced programming practices in complex analytical projects;
● understands the principles of modular and reproducible analytical workflow design;
● knows and understands the basic principles of unsupervised and supervised machine learning;
● understands the logic of k-means and PAM clustering;
● knows how variable selection, scaling and distance metrics affect clustering results;
● understands the general principles of Random Forest and XGBoost;
● understands the difference between bagging and boosting;
● knows and understands the basic principles of object-oriented programming in R;
● knows the main characteristics of the S3 and R6 systems;
● understands the role of advanced functions and defensive programming in improving code quality;
● understands the benefits and limitations of AI-assisted programming;
● understands the importance of human verification in analytical work supported by AI.
in terms of skills:
● is able to formulate business and research questions that can be investigated using data;
● is able to design a structured analytical study;
● is able to work with a complex, multi-table business dataset;
● is able to prepare data for unsupervised and supervised learning;
● is able to apply and interpret k-means and PAM clustering in R;
● is able to select appropriate variables, transformations and distance measures for clustering;
● is able to train and compare Random Forest and XGBoost models;
● is able to assess model performance and interpret model outputs critically;
● is able to write reusable functions and apply defensive-programming principles;
● is able to use S3 and R6 objects to organise analytical code and results;
● is able to design a modular workflow covering data preparation, modelling, evaluation and presentation;
● is able to use AI tools to support code development without delegating responsibility for the final result;
● is able to inspect, test, correct and improve AI-generated R code;
● is able to translate analytical findings into clear and evidence-based business recommendations;
● is able to present and defend the results of a group analytical project.
in terms of social competences:
● is ready to work collaboratively on a complex analytical problem;
● is ready to divide tasks, coordinate work and share responsibility within a group;
● is ready to critically evaluate code and conclusions produced with the support of AI;
● is ready to take responsibility for the reliability of the final analysis;
● is ready to distinguish between predictive performance and substantive interpretation;
● is ready to communicate analytical findings to people with different levels of technical expertise;
● is ready to reflect on the opportunities and limitations of using AI under time pressure;
● is ready to revise their analytical approach in response to evidence, feedback and verification.
Assessment criteria
Learning outcomes are assessed through a group analytical project and its presentation.
Assessment considers the quality of the research questions, correctness and organisation of the R code, appropriate use of analytical methods, critical interpretation of results, reproducibility of the workflow and relevance of the business recommendations.
The final grade is provided individually, based on the post-test results.
Bibliography
Matuszelański, K., & Kopczewska, K. (2022). Customer churn in retail e-commerce business: Spatial and machine learning approach. Journal of Theoretical and Applied Electronic Commerce Research, 17(1), 165-198.
Course slides, datasets, group-work instructions and programming materials provided to participants.