data1 = read.csv("/Users/yashuvaishu/Downloads/Spotify1.csv")

I am considering danceability as my response variable here. valence, energy, and loudness as explanatory variables.

model <- glm(danceability ~ valence + energy + loudness, data = data1)

Summarizing the model.

summary(model)
## 
## Call:
## glm(formula = danceability ~ valence + energy + loudness, data = data1)
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.5859351  0.0093345  62.771  < 2e-16 ***
## valence      0.2946572  0.0067741  43.497  < 2e-16 ***
## energy      -0.0846162  0.0103897  -8.144 4.36e-16 ***
## loudness     0.0075264  0.0004547  16.553  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for gaussian family taken to be 0.01847037)
## 
##     Null deviance: 214.06  on 8511  degrees of freedom
## Residual deviance: 157.15  on 8508  degrees of freedom
## AIC: -9814.4
## 
## Number of Fisher Scoring iterations: 2

From above we can conclude that :

A one-unit increase in valence is associated with a increase in danceability of 0.294. A one-unit increase in energy is associated with a decrease in danceability of 0.084. A one-unit increase in loudness is associated with a increase in danceability of 0.007.

library(ggplot2)
qqnorm(model$residuals)

qplot(model$fitted.values, model$residuals)
## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

# Check the homoscedasticity of the residuals
plot(model$fitted.values, model$residuals^2)

acf(model$residuals)

# Interpret the coefficients
coef(model)
##  (Intercept)      valence       energy     loudness 
##  0.585935082  0.294657215 -0.084616215  0.007526443

The intercept is 0.585935082. This means that, on average, a song is expected to have 0.585935082 units of valence, even if all of the other explanatory variables are zero.

The valence coefficient is 0.294657215. This means that, on average, for each additional unit of valence, a song is expected to have 0.294657215 more units of valence.

The energy coefficient is -0.084616215. This means that, on average, for each additional unit of energy, a song is expected to have 0.084616215 fewer units of valence.

The loudness coefficient is 0.007526443. This means that, on average, for each additional unit of loudness, a song is expected to have 0.007526443 more units of valence.