LoslegenKostenlos loslegen

BMI versus age

In this exercise, your task is to manipulate the age and body mass index (BMI) data to generate a plot illustrating the average BMI progression among policyholders as they age. You will compare two approaches: one using the StatsPlots plotting recipe for DataFrames and the other without it. Additionally, you will utilize chains to perform data manipulation and visualization.

The necessary packages, DataFrames, StatsPlots, Statistics and Chain, have already been imported for you, and the insurance DataFrame is readily available.

Diese Übung ist Teil des Kurses

Introduction to Data Visualization with Julia

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

grouped = groupby(insurance, :Age)
mean_bmis = combine(grouped, :BMI => mean)

# Scatter plot
scatter(____.____, ____.____,
	label=false, smooth=____,
    linewidth=3, linecolor=:maroon1)
xlabel!("Age")
ylabel!("Body Mass Index (BMI)")
Code bearbeiten und ausführen