-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprojecthealthcare.r
83 lines (52 loc) · 1.65 KB
/
projecthealthcare.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
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
#healthcare analysis
healthcare<-read.csv(file.choose(),header=T)
View(healthcare)
str(healthcare)
summary(healthcare)
names(healthcare)
table(healthcare$AGE)
table(healthcare$FEMALE)
table(healthcare$RACE)
#Which age category Has maximum Expenditure
summary(as.factor(healthcare$AGE))
max(table(healthcare$AGE))
max(summary(as.factor(healthcare$AGE)))
which.max(table(healthcare$AGE))
age <- aggregate(TOTCHG ~ AGE , data = healthcare, sum)
age
which.max(age$TOTCHG)
age[which.max(age$TOTCHG),]
# Diagnosis related group which has maximum hospitalized and expenditure
t <- table(healthcare$APRDRG)
d <- as.data.frame(t)
names(d)[1] = 'Diagnosis Group'
d
which.max(table(healthcare$APRDRG))
which.max(t)
which.max(d)
res <- aggregate(TOTCHG ~ APRDRG, data = healthcare, sum)
res
which.max(res$TOTCHG)
res[which.max(res$TOTCHG),]
#Race of patient related to Hospital cost or not
healthcare$RACE <- as.factor(healthcare$RACE)
R_A<- aov(TOTCHG ~ RACE, data=healthcare)
summary(R_A)
R_L<-lm(TOTCHG ~RACE,data= healthcare)
summary(R_L)
healthcare <- na.omit(healthcare)
#Hospital cost can be predicted by Age or Gender
T_A<- aov(TOTCHG ~ AGE+FEMALE, data=healthcare)
summary(T_A)
T_L<-lm(TOTCHG ~AGE+FEMALE,data= healthcare)
summary(T_L)
#length of stay can be predicted by AGE,Female or Race
L<- aov(LOS ~ AGE+FEMALE+RACE, data=healthcare)
summary(L)
fit<-lm(LOS ~AGE+FEMALE+RACE,data= healthcare)
summary(fit)
# Agency want to know which entity effects the hospital cost most
A<- aov(TOTCHG ~., data=healthcare)
summary(A)
B<- lm(TOTCHG ~.,data=healthcare)
summary(B)