-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode implementation.R
51 lines (31 loc) · 1.09 KB
/
code implementation.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
44
45
46
47
48
49
50
51
h_c<-read.csv("C:/Users/bhati/Desktop/SimpliLearn/Data Science with R/projects to solve/Healthcare/Healthcare/HospitalCosts.csv")
summary(h_c)
hist(h_c$AGE, main = "Histogram for age frequency", xlab = "Age Group", ylab = "Frequency of Patients", prob= TRUE, col = "red")
lines(density(h_c$AGE))
summary(as.factor(h_c$AGE))
x <- aggregate(TOTCHG~AGE,FUN = sum,data = h_c)
x
max(x)
which.max(summary(as.factor(h_c$APRDRG)))
diagnosiscost <- aggregate(TOTCHG ~ APRDRG, FUN = sum, data = h_c)
diagnosiscost
diagnosiscost[which.max(diagnosiscost$TOTCHG),]
summary(as.factor(h_c$RACE))
head(h_c)
h_c<-na.omit(h_c)
h_c$RACE<-as.factor(h_c$RACE)
mod<- aov(TOTCHG ~ RACE, data = h_c)
mod
summary(mod)
summary(h_c$RACE)
model1 <- lm(TOTCHG ~ AGE + FEMALE, data = h_c)
h_c$FEMALE<-as.factor(h_c$FEMALE)
model1 <- lm(TOTCHG ~ AGE + FEMALE, data = h_c)
summary(model1)
summary(h_c$FEMALE)
head(h_c)
h_c$RACE<-as.factor(h_c$RACE)
model2 <- lm(TOTCHG ~ AGE + FEMALE + RACE, data = h_c)
summary(model2)
model3 <- lm(TOTCHG ~ ., data = h_c)
summary(model3)