In many video games, damage taken by a player depends on factors such as enemy attack strength and player armor. This presentation explores how simple linear regression can be used to model game damage data.
In many video games, damage taken by a player depends on factors such as enemy attack strength and player armor. This presentation explores how simple linear regression can be used to model game damage data.
Each row in the dataset represents a single encounter.
The dataset includes: - player_id - enemy_attack - armor - damage_taken
## player_id enemy_attack armor damage_taken ## 1 1 74.9 27.1 48.6 ## 2 2 76.2 17.9 67.1 ## 3 3 37.2 26.3 27.3 ## 4 4 69.8 16.1 70.4 ## 5 5 58.5 8.9 46.3 ## 6 6 51.1 16.1 35.7
Damage Taken vs Enemy Attack
This plot shows a positive relationship between enemy attack strength and damage taken. As enemy attack increases, players generally receive more damage, suggesting enemy attack is a strong predictor of damage.
Damage Taken vs Armor
This plot shows a negative relationship between player armor and damage taken. As armor increases, the amount of damage received generally decreases. The fitted regression line reinforces the idea that armor is an effective defensive mechanic that reduces incoming damage.
\[ \text{Damage Taken} = \beta_0 + \beta_1 (\text{Enemy Attack}) + \varepsilon \] - \(\beta_1\) represents the change in damage for a one-unit increase in enemy attack.
This equation represents a simple linear regression model that predicts damage taken based on enemy attack strength. The intercept (\(\beta_0\)) represents the baseline damage, while the slope (\(\beta_1\)) measures how much damage increases for each additional unit of enemy attack. \(\varepsilon\) is the error term representing unexplained variation in damage.
The fitted model is:
## (Intercept) enemy_attack ## -9.6563141 0.9917666
This slide shows the R code used to fit the linear regression model. The lm() function estimates the relationship between enemy attack and damage taken using the observed game data.
## Estimate Std. Error t value Pr(>|t|) ## (Intercept) -9.6563141 1.45649354 -6.629837 3.152192e-10 ## enemy_attack 0.9917666 0.02688769 36.885521 2.151889e-90
The regression output provides estimated coefficients for the model. The slope coefficient for enemy attack is positive, indicating that higher enemy attack values lead to increased damage taken. The results suggest that enemy attack is a meaningful predictor of player damage.
This 3D visualization shows how damage taken varies jointly with enemy attack and armor. Higher damage values tend to occur when enemy attack is high and armor is low, illustrating the combined effects of offensive and defensive factors on damage outcomes.
Predicted vs Actual Damage
This plot compares the model’s predicted damage values to the actual observed values. Points close to the diagonal line indicate accurate predictions. The overall alignment suggests the linear regression model provides a reasonable fit, though some variability remains unexplained.