-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteraction_variables.R
44 lines (36 loc) · 1.7 KB
/
interaction_variables.R
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
############################################################################################################################
# interaction between independent variables
############################################################################################################################
setwd("C:/Users/janst/sciebo/Bachelor Thesis/data/")
data.d.a <- read.csv("created/samples/dresden_all.csv")
data.k.a <- read.csv("created/samples/krakow_all.csv")
data.s.a <- read.csv("created/samples/sevilla_all.csv")
##############
# pairwise correlations among the predictors
cor(data.k.a[4:14])
cor(data.d.a[4:14])
cor(data.s.a[4:14])
(correlation.k <- (abs(cor(data.k[5:15])) > 0.7))
(correlation.d <- (abs(cor(data.d[5:15])) > 0.7))
(correlation.s <- (abs(cor(data.s[5:15])) > 0.7))
###########################################################
# tried to have a look at other correlations
###########################################################
# continuous to categorical
summary(lm(mRoads_dist ~ factor(landuse)))
plot(mRoads_dist ~ factor(landuse))
# continuous to continuous
plot(data.k$pop_dens, data.k$built_dens)
abline(lm(pop_dens ~ built_dens, data = data.k))
plot(data.k$center_dist, data.k$airport_dist)
abline(lm(center_dist ~ airport_dist, data = data.k))
plot(data.d$pop_dens, data.d$built_dens)
plot(data.s$pop_dens, data.s$built_dens)
plot(data.s$center_dist, data.s$pRoads_dist)
plot(data.s$train_dist, data.s$pRoads_dist)
plot(data.s$center_dist, data.s$river_dist)
abline(lm(river_dist ~ center_dist, data = data.s))
plot(data.s$airport_dist, data.s$river_dist)
plot(data.s$center_dist, data.s$train_dist)
abline(h=mean(pRoads_dist),lty=2); abline(v=mean(built_dens),lty=2)
cor.test(pRoads_dist, built_dens)