##################
# Exercise #4
##################
##################
sink(“C:/UMUC/week5exercise.txt”)
# install.packages(‘dplyr’)
library(dplyr)
# Step 2: Read your data
# Pl change the location of file
hosp <- read.csv("C:/UMUC/HMGT400HOSPITAL.csv", header=T, sep = ',')
#Step 3: See the variables' names
names (hosp)
#Step 4: Generate new variables
hosp$benefit <- (hosp$total_hosp_revenue-hosp$total_hosp_cost)
hosp$medicare_discharge_ratio <- (hosp$total_hospital_medicare_discharg/hosp$total_hospital_discharges)*100
hosp$medicaid_discharge_ratio <- (hosp$total_hospital_medicaid_discharg/hosp$total_hospital_discharges)*100
# Step 5; Mean selected variable
summarize (hosp, bed=mean(hospital_beds, na.rm=T),
member=mean(system_member, na.rm=T),
cost=mean(total_hosp_cost, na.rm=T),
revenue=mean(log_hosp_revenue, na.rm=T),
benefit=mean(benefit, na.rm=T),
medicare_ratio=mean(medicare_discharge_ratio, na.rm=T),
medicaid_ratio=mean(medicaid_discharge_ratio, na.rm=T))
mean(hosp$hospital_beds)
mean(hosp$system_member)
mean(hosp$total_hosp_cost)
mean(hosp$log_hosp_revenue)
mean(hosp$benefit)
mean(hosp$medicare_discharge_ratio)
mean(hosp$medicaid_discharge_ratio)
sd(hosp$hospital_beds)
sd(hosp$system_member)
sd(hosp$total_hosp_cost)
sd(hosp$log_hosp_revenue)
sd(hosp$benefit)
sd(hosp$medicare_discharge_ratio)
sd(hosp$medicaid_discharge_ratio)
# Step 6; SD selected variable
summarize (hosp, bed=sd(hospital_beds, na.rm=T),
member=sd(system_member, na.rm=T),
cost=sd(total_hosp_cost, na.rm=T),
revenue=sd(log_hosp_revenue, na.rm=T),
benefit=sd(benefit, na.rm=T),
medicare_ratio=sd(medicare_discharge_ratio, na.rm=T),
medicaid_ratio=sd(medicaid_discharge_ratio, na.rm=T))
# Step 7; N for categorical variable
# Step 7a
## Bed Size
##1) <50
##2) 51-150
##3) 151-250
##4) 251-350
##5) 351-450
##6) 451-550
##7) 551-650
##8) >651
table(hosp$bedsize_cat)
# Step 7b
## Ownership
## 0) non-for-profit
## 1) for profit
## 2) Public
## 3) Other
table(hosp$own)
# Cost
mytable <- table(hosp$total_hosp_cost)
summary(mytable)
# Revenue
mytable <- table(hosp$total_hosp_revenue)
summary(mytable)
# system_member
mytable <- table(hosp$system_member)
summary(mytable)
# benefit
mytable <- table(hosp$benefit)
summary(mytable)
# total_hospital_medicare_discharg
mytable <- table(hosp$total_hospital_medicare_discharg)
summary(mytable)
# total_hospital_medicaid_discharg
mytable <- table(hosp$total_hospital_medicaid_discharg)
summary(mytable)
# Step 8: Generate new variables
hosp$benefit <- (hosp$total_hosp_revenue-hosp$total_hosp_cost)
hosp$medicare_discharge_ratio <- (hosp$total_hospital_medicare_discharg/hosp$total_hospital_discharges)*100
hosp$medicaid_discharge_ratio <- (hosp$medicaid_discharge_ratio/hosp$total_hospital_discharges)*100
# Step 9: Generate Factor variables
own1 <- factor(hosp$own, levels = c(0, 1, 2, 3))
bed_cat1 <- factor(hosp$bedsize_cat, levels = c(1, 2, 3, 4, 5, 6, 7, 8))
# Step 10: run regression models
# 1st Model:
## 0) non-for-profit
## 1) for profit
## 2) Public
## 3) Other
# Model 1a: Using bed as a continuous variable
Benefit=function(beds, ownership)
y=B0+B1beds+B2FP+B3Pbl+B4Ot+e
model1a <- lm(benefit ~ hospital_beds + own1, data=hosp)
summary(model1a)
# Model 1b: Using bed as a categorical variable
model1b <- lm(benefit ~ bed_cat1 + own1, data=hosp)
summary(model1b)
# Model 2:
model2 <- lm(benefit ~ hospital_beds + own1 + system_member, data=hosp)
summary(model2)
# Model 3:
model3 <- lm(total_hosp_revenue ~ hospital_beds + own1 + system_member + medicare_discharge_ratio + medicaid_discharge_ratio , data=hosp)
summary(model3)
# You may like to look at the plot to have better understaning.
plot(hosp$benefit , hosp$hospital_beds, pch = 1,
cex =.5, col = "blue", main = "Figure 1. Hospital Revenues and Hospital Beds", cex.main =.8,
xlab = "Hospital Revenue ($)", ylab = "Hospital Beds(#)")
abline (hosp$benefit , hosp$hospital_beds)
hosp_sub <- subset(hosp, hosp$benefit>0 & hosp$benefit<200000000)
plot(hosp_sub$benefit , hosp_sub$hospital_beds, pch = 1,
cex =.5, col = "blue", main = "Figure 2. Hospital Benfit and Hospital Beds", cex.main =.8,
xlab = "Hospital Revenue ($)", ylab = "Hospital Beds(#)")
abline (hosp_sub$benefit , hosp_sub$hospital_beds)
# Thank you,
# Dr. Zare
sink()
Exercise #4
Linear Regression Model
If you have chosen to work with RStudio, please run the following model and complete the following tables.
1st Model:
Run a linear model and predict the difference between hospital beds (use the bed-tot) and hospital’s ownership on hospital net-benefit? Discuss your finding, do you think having higher beds has positive impact on the hospital net benefit? What about the ownership?
Model 1a
Hospital Characteristics
Coef.
St. Err
Hospital beds
Ownership
For Profit
Non-for profit
Other
N
R-Squared
2nd Model:
Now, estimate the impact of being a member of a system on hospital net benefit? And discuss your finding (nor more than 2 lines)? Is it significant?
Model 2
Hospital Characteristics
Coef.
St. Err
Hospital beds
Ownership
For Profit
Non-for profit
Other
Membership
System Membership
N
R-Squared
3nd Model:
Now, include the ratio of ratio-Medicare-discharge and ratio-Medicaid-discharge in your model? How do you evaluate the impact of having higher Medicare and Medicaid patients on hospital revenues?
Model 3
Hospital Characteristics
Coef.
St. Err
Hospital beds
Ownership
For Profit
Non-for profit
Other
Membership
System Membership
Socio-Economic Characteristics
Medicare discharge ratio
Medicaid discharge ratio
N
R-Squared
Based on your finding please recommend 3 policies to improve hospital performance, please make sure to use the final model for your recommendation.
Discuss your findings.
##################
# Exercise #4
##################
##################
sink(“C:/UMUC/week4exercise.txt”)
# install.packages(‘dplyr’)
# library(dplyr)
# Step 2: Read your data
# Pl change the location of file
hosp <- read.csv("C:/UMUC/HMGT400HOSPITAL.csv", header=T, sep = ',')
#Step 3: See the variables' names
names (hosp)
#Step 4: Generate new variables
hosp$benefit <- (hosp$total_hosp_revenue-hosp$total_hosp_cost)
hosp$medicare_discharge_ratio <- (hosp$total_hospital_medicare_discharg/hosp$total_hospital_discharges)*100
hosp$medicaid_discharge_ratio <- (hosp$total_hospital_medicaid_discharg/hosp$total_hospital_discharges)*100
# Step 5; Mean selected variable
# summarize (hosp, bed=mean(hospital_beds, na.rm=T),
#member=mean(system_member, na.rm=T),
# cost=mean(total_hosp_cost, na.rm=T),
# revenue=mean(log_hosp_revenue, na.rm=T),
# benefit=mean(benefit, na.rm=T),
# medicare_ratio=mean(medicare_discharge_ratio, na.rm=T),
# medicaid_ratio=mean(medicaid_discharge_ratio, na.rm=T))
mean(hosp$hospital_beds, na.rm=T)
mean(hosp$system_member, na.rm=T)
mean(hosp$total_hosp_cost, na.rm=T)
mean(hosp$log_hosp_revenue, na.rm=T)
mean(hosp$benefit, na.rm=T)
mean(hosp$medicare_discharge_ratio, na.rm=T)
mean(hosp$medicaid_discharge_ratio, na.rm=T)
sd(hosp$hospital_beds, na.rm=T)
sd(hosp$system_member, na.rm=T)
sd(hosp$total_hosp_cost, na.rm=T)
sd(hosp$log_hosp_revenue, na.rm=T)
sd(hosp$benefit, na.rm=T)
sd(hosp$medicare_discharge_ratio, na.rm=T)
sd(hosp$medicaid_discharge_ratio, na.rm=T)
# Step 6; SD selected variable
#summarize (hosp, bed=sd(hospital_beds, na.rm=T),
# member=sd(system_member, na.rm=T),
# cost=sd(total_hosp_cost, na.rm=T),
# revenue=sd(log_hosp_revenue, na.rm=T),
# benefit=sd(benefit, na.rm=T),
# medicare_ratio=sd(medicare_discharge_ratio, na.rm=T),
# medicaid_ratio=sd(medicaid_discharge_ratio, na.rm=T))
# Step 7: Generate new variables
#hosp$benefit <- (hosp$total_hosp_revenue-hosp$total_hosp_cost)
#hosp$medicare_discharge_ratio <- (hosp$total_hospital_medicare_discharg/hosp$total_hospital_discharges)*100
#hosp$medicaid_discharge_ratio <- (hosp$medicaid_discharge_ratio/hosp$total_hospital_discharges)*100
# Step 8; N for categorical variable
# Step 8a
## Bed Size
##1) <50
##2) 51-150
##3) 151-250
##4) 251-350
##5) 351-450
##6) 451-550
##7) 551-650
##8) >651
table(hosp$bedsize_cat)
# Step 8b
## Ownership
## 0) non-for-profit
## 1) for profit
## 2) Public
## 3) Other
table(hosp$own)
mytable <- table(hosp$total_hosp_cost)
summary(mytable)
# 10-7
mytable <- table(hosp$total_hosp_revenue)
summary(mytable)
# 10-12
mytable <- table(hosp$benefit)
summary(mytable)
# 10-13
mytable <- table(hosp$medicare_discharge_ratio)
summary(mytable)
mytable <- table(hosp$medicaid_discharge_ratio)
summary(mytable)
# Step 9: Generate Factor variables
own1 <- factor(hosp$own, levels = c(0, 1, 2, 3))
bed_cat1 <- factor(hosp$bedsize_cat, levels = c(1, 2, 3, 4, 5, 6, 7, 8))
# Step 10: run regression models
# 1st Model:
# Model 1a: Using bed as a continuous variable
model1a <- lm(benefit ~ hospital_beds + own1, data=hosp)
summary(model1a)
# Model 1b: Using bed as a categorical variable
model1b <- lm(benefit ~ bed_cat1 + own1, data=hosp)
summary(model1b)
# Model 2:
model2 <- lm(benefit ~ hospital_beds + own1 + system_member, data=hosp)
summary(model2)
# Model 3:
model3 <- lm(total_hosp_revenue ~ hospital_beds + own1 + system_member + medicare_discharge_ratio + medicaid_discharge_ratio , data=hosp)
summary(model3)
# You may like to look at the plot to have better understaning.
plot(hosp$benefit , hosp$hospital_beds, pch = 1,
cex =.5, col = "blue", main = "Figure 1. Hospital Revenues and Hospital Beds", cex.main =.8,
xlab = "Hospital Revenue ($)", ylab = "Hospital Beds(#)")
abline (hosp$benefit , hosp$hospital_beds)
hosp_sub <- subset(hosp, hosp$benefit>0 & hosp$benefit<200000000)
plot(hosp_sub$benefit , hosp_sub$hospital_beds, pch = 1,
cex =.5, col = "blue", main = "Figure 2. Hospital Benfit and Hospital Beds", cex.main =.8,
xlab = "Hospital Revenue ($)", ylab = "Hospital Beds(#)")
abline (hosp_sub$benefit , hosp_sub$hospital_beds)
# Thank you,
# Dr. Zare
sink()
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read moreOur specialists are always online to help you! We are available 24/7 via live chat, WhatsApp, and phone to answer questions, correct mistakes, or just address your academic fears.
See our T&Cs