-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnalyze multiple linear regression model.Rmd
90 lines (72 loc) · 2.15 KB
/
Analyze multiple linear regression model.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
title: "Analizar modelo regresion lineal multiple"
author: "Felipe Yépez"
date: "2022-11-26"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Predict Amount From Donators and Non-donators
```{r}
datos = read.csv("PreprocessedDouble.csv")
```
```{r}
reg = lm(AmtGiven~Woman+Age+Salary+SeniorList+NbActivities+Referrals+Recency+Frequency+Seniority+TotalGift+MinGift+MaxGift+Elementary+HighSchool+University+Downtown+Rural+Suburban+JustGave+MeanGift, data=datos)
```
```{r}
summary(reg)
```
```{r}
step(reg, direction="both", trace=1)
```
```{r}
best_reg = lm(formula = AmtGiven ~ Woman + Age + Salary + SeniorList + NbActivities +
Referrals + Frequency + TotalGift + MaxGift + Elementary +
Downtown + Rural + MeanGift, data = datos)
```
```{r}
summary(best_reg)
```
# Predict Amount Just from Donators
```{r}
datos = read.csv("PreprocessedDoubleGave.csv")
```
```{r}
reg = lm(AmtGiven~Woman+Age+Salary+SeniorList+NbActivities+Referrals+Recency+Frequency+Seniority+TotalGift+MinGift+MaxGift+Elementary+HighSchool+University+Downtown+Rural+Suburban+JustGave+MeanGift, data=datos)
```
```{r}
summary(reg)
```
```{r}
step(reg, direction="both", trace=1)
```
```{r}
best_reg = lm(formula = AmtGiven ~ Woman + Age + Salary + SeniorList + NbActivities +
Referrals + Recency + Frequency + Seniority + TotalGift +
MinGift + MaxGift + Rural + JustGave + MeanGift, data = datos)
```
```{r}
summary(best_reg)
```
# Probability of Donating
```{r}
datos = read.csv("PreprocessedDouble.csv")
```
```{r}
reg = lm(Gave~Woman+Age+Salary+SeniorList+NbActivities+Referrals+Recency+Frequency+Seniority+TotalGift+MinGift+MaxGift+Elementary+HighSchool+University+Downtown+Rural+Suburban+JustGave+MeanGift, data=datos)
```
```{r}
summary(reg)
```
```{r}
step(reg, direction="both", trace=1)
```
```{r}
best_reg = lm(formula = Gave ~ SeniorList + NbActivities + Referrals + Recency +
Frequency + Seniority + TotalGift + MinGift + HighSchool +
Downtown + Rural + Suburban + JustGave + MeanGift, data = datos)
```
```{r}
summary(best_reg)
```