Script that I use to check and predict the cost and results of Facebook Campaigns. The campaigns are based upon “click in external links”, so the results that I expect are how much do I need to invest in order to get some numbers of clicks.
### Load data
df = read.csv("./data/cmkbr_full.csv", header = TRUE, sep = ",")
## Resultados Alcance Custo.por.resultados Valor.gasto..BRL.
## Min. : 11.0 Min. : 278 Min. : 0.1665 Min. : 7.71
## 1st Qu.: 61.0 1st Qu.: 2852 1st Qu.: 0.2834 1st Qu.: 27.48
## Median : 142.0 Median : 5848 Median : 0.3704 Median : 49.61
## Mean : 340.1 Mean :11719 Mean : 5.2327 Mean :118.85
## 3rd Qu.: 368.5 3rd Qu.:14021 3rd Qu.: 0.5400 3rd Qu.:100.00
## Max. :2342.0 Max. :64245 Max. :263.0000 Max. :932.56
## Pessoas.executando.uma.ação
## Min. : 15.0
## 1st Qu.: 79.0
## Median : 183.0
## Mean : 454.7
## 3rd Qu.: 624.0
## Max. :2040.0
## Resultados Alcance Custo.por.resultados
## Resultados 1.000000000 0.9295720543 0.0084991563
## Alcance 0.929572054 1.0000000000 0.0001948107
## Custo.por.resultados 0.008499156 0.0001948107 1.0000000000
## Valor.gasto..BRL. 0.755092352 0.8148605265 -0.0112340984
## Pessoas.executando.uma.ação 0.839330668 0.8226345495 -0.0201093177
## Valor.gasto..BRL. Pessoas.executando.uma.ação
## Resultados 0.7550924 0.83933067
## Alcance 0.8148605 0.82263455
## Custo.por.resultados -0.0112341 -0.02010932
## Valor.gasto..BRL. 1.0000000 0.65861092
## Pessoas.executando.uma.ação 0.6586109 1.00000000
##
## Call:
## lm(formula = df$Resultados ~ df$Valor.gasto..BRL.)
##
## Residuals:
## Min 1Q Median 3Q Max
## -948.42 -51.50 -17.46 17.60 836.81
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.797 35.157 0.165 0.87
## df$Valor.gasto..BRL. 3.192 0.191 16.708 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 211.3 on 51 degrees of freedom
## Multiple R-squared: 0.8455, Adjusted R-squared: 0.8425
## F-statistic: 279.2 on 1 and 51 DF, p-value: < 2.2e-16