library(ggplot2)
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.4.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
load("providerspokane.Rda")
gender.mean=providerspokane%>%group_by(Gender.of.the.Provider)%>%summarize(numberofservices=mean(Number.of.Services),numberofdailydistinctservices=mean(Number.of.Distinct.Medicare.Beneficiary.Per.Day.Services),medicareallowed=mean(Average.Medicare.Allowed.Amount),medicarecharged=mean(Average.Submitted.Charge.Amount),medicarepayment=mean(Average.Medicare.Payment.Amount),medicarestandarizedamount=mean(Average.Medicare.Standardized.Amount))
gender.mean.filter=filter(gender.mean, numberofservices<1000)
gendermeanfiltergather=gather(gender.mean.filter, "Service", "mean", c(2, 3, 4, 5, 6, 7))
## Warning in if (!is.finite(x)) return(FALSE): the condition has length > 1
## and only the first element will be used
ggplot(gendermeanfiltergather,aes(Gender.of.the.Provider,mean, fill=Gender.of.the.Provider))+geom_bar(stat="identity")+
facet_wrap(~Service)
providertype.mean.numberofservices=providerspokane%>%group_by(Provider.Type)%>%summarize(numberofservices=mean(Number.of.Services))
providertype.mean.numberofservices$numberofservices.factor=ifelse(providertype.mean.numberofservices$numberofservices<=100,"low",ifelse(providertype.mean.numberofservices$numberofservices>300,"high","medium"))
providertype.mean.numberofservices.tier=providertype.mean.numberofservices%>%group_by(numberofservices.factor)%>%summarize(numberofservices=mean(numberofservices))
ggplot(providertype.mean.numberofservices.tier,aes(numberofservices.factor,numberofservices, fill=numberofservices.factor))+geom_bar(stat="identity")
providertype.mean.distinctdailyservices=providerspokane%>%group_by(Provider.Type)%>%summarize(distinctdailyservices=mean(Number.of.Distinct.Medicare.Beneficiary.Per.Day.Services))
providertype.mean.distinctdailyservices$distinctdailyservices.factor=ifelse(providertype.mean.distinctdailyservices$distinctdailyservices<=100,"low",ifelse(providertype.mean.distinctdailyservices$distinctdailyservices>300,"high","medium"))
providertype.mean.distinctdailyservices.tier=providertype.mean.distinctdailyservices%>%group_by(distinctdailyservices.factor)%>%summarize(distinctdailyservices=mean(distinctdailyservices))
ggplot(providertype.mean.distinctdailyservices.tier,aes(distinctdailyservices.factor,distinctdailyservices, fill=distinctdailyservices.factor))+geom_bar(stat="identity")
providertype.mean.averagemedicareallowed=providerspokane%>%group_by(Provider.Type)%>%summarize(averagemedicareallowed=mean(Average.Medicare.Allowed.Amount))
providertype.mean.averagemedicareallowed$averagemedicareallowed.factor=ifelse(providertype.mean.averagemedicareallowed$averagemedicareallowed<=100,"low",ifelse(providertype.mean.averagemedicareallowed$averagemedicareallowed>500,"high","medium"))
providertype.mean.averagemedicareallowed.tier=providertype.mean.averagemedicareallowed%>%group_by(averagemedicareallowed.factor)%>%summarize(averagemedicareallowed=mean(averagemedicareallowed))
ggplot(providertype.mean.averagemedicareallowed.tier,aes(averagemedicareallowed.factor,averagemedicareallowed, fill=averagemedicareallowed.factor))+geom_bar(stat="identity")
providertype.mean.averagemedicarecharged=providerspokane%>%group_by(Provider.Type)%>%summarize(averagemedicarecharged=mean(Average.Submitted.Charge.Amount))
providertype.mean.averagemedicarecharged$averagemedicarecharged.factor=ifelse(providertype.mean.averagemedicarecharged$averagemedicarecharged<=200,"low",ifelse(providertype.mean.averagemedicarecharged$averagemedicarecharged>400,"high","medium"))
providertype.mean.averagemedicarecharged.tier=providertype.mean.averagemedicarecharged%>%group_by(averagemedicarecharged.factor)%>%summarize(averagemedicarecharged=mean(averagemedicarecharged))
ggplot(providertype.mean.averagemedicarecharged.tier,aes(averagemedicarecharged.factor,averagemedicarecharged, fill=averagemedicarecharged.factor))+geom_bar(stat="identity")
providertype.mean.averagemedicarepaid=providerspokane%>%group_by(Provider.Type)%>%summarize(averagemedicarepaid=mean(Average.Medicare.Payment.Amount))
providertype.mean.averagemedicarepaid$averagemedicarepaid.factor=ifelse(providertype.mean.averagemedicarepaid$averagemedicarepaid<=50,"low",ifelse(providertype.mean.averagemedicarepaid$averagemedicarepaid>100,"high","medium"))
providertype.mean.averagemedicarepaid.tier=providertype.mean.averagemedicarepaid%>%group_by(averagemedicarepaid.factor)%>%summarize(averagemedicarepaid=mean(averagemedicarepaid))
ggplot(providertype.mean.averagemedicarepaid.tier,aes(averagemedicarepaid.factor,averagemedicarepaid, fill=averagemedicarepaid.factor))+geom_bar(stat="identity")
providertype.mean.averagestandardizedamount=providerspokane%>%group_by(Provider.Type)%>%summarize(averagestandardizedamount=mean(Average.Medicare.Standardized.Amount))
providertype.mean.averagestandardizedamount$averagestandardizedamount.factor=ifelse(providertype.mean.averagestandardizedamount$averagestandardizedamount<=100,"low",ifelse(providertype.mean.averagestandardizedamount$averagestandardizedamount>200,"high","medium"))
providertype.mean.averagestandardizedamount.tier=providertype.mean.averagestandardizedamount%>%group_by(averagestandardizedamount.factor)%>%summarize(averagestandardizedamount=mean(averagestandardizedamount))
ggplot(providertype.mean.averagestandardizedamount.tier,aes(averagestandardizedamount.factor,averagestandardizedamount, fill=averagestandardizedamount.factor))+geom_bar(stat="identity")
Place.of.Service.mean=providerspokane%>%group_by(Place.of.Service)%>%summarize(numberofservices=mean(Number.of.Services),numberofdailydistinctservices=mean(Number.of.Distinct.Medicare.Beneficiary.Per.Day.Services),medicareallowed=mean(Average.Medicare.Allowed.Amount),medicarecharged=mean(Average.Submitted.Charge.Amount),medicarepayment=mean(Average.Medicare.Payment.Amount),medicarestandarizedamount=mean(Average.Medicare.Standardized.Amount))
Place.of.Service.mean.gather=gather(Place.of.Service.mean, "Service", "mean", c(2, 3, 4, 5, 6, 7))
## Warning in if (!is.finite(x)) return(FALSE): the condition has length > 1
## and only the first element will be used
ggplot(Place.of.Service.mean.gather,aes(Place.of.Service,mean, fill=Place.of.Service))+geom_bar(stat="identity")+
facet_wrap(~Service)
Type.of.Service.mean=providerspokane%>%group_by(HCPCS.Description)%>%summarize(numberofservices=mean(Number.of.Services),numberofdailydistinctservices=mean(Number.of.Distinct.Medicare.Beneficiary.Per.Day.Services),medicareallowed=mean(Average.Medicare.Allowed.Amount),medicarecharged=mean(Average.Submitted.Charge.Amount),medicarepayment=mean(Average.Medicare.Payment.Amount),medicarestandarizedamount=mean(Average.Medicare.Standardized.Amount))
Type.of.Service.mean.gather=gather(Type.of.Service.mean, "Service", "mean", c(2, 3, 4, 5, 6, 7))
## Warning in if (!is.finite(x)) return(FALSE): the condition has length > 1
## and only the first element will be used
ggplot(Type.of.Service.mean.gather,aes(HCPCS.Description,mean))+geom_bar(stat="identity")+
facet_wrap(~Service)
The biggest limitation we have is the usefullness and reliablility of our graphs comparing provider type against the various statistical factors. By switching from the name of the provider to the tiers of provider types, we lose the uniqueness of each provider type. The figures in affect say nothing about the provider type and only make reference to the range of values within the graphs.
Based on this exploration, we found that gender does not affect the various statistical factors we examined;they remain reletively constant. On the other hand, place of service is extremely vital to the statistical factors examined. Costs increase in facility based place of services whereas service options increase in non-facility place of service. Based on how we looked at the data, the affect of provider type is still unknown.