Type of paper: Essay

Topic: Information, Customers, Size, Cost, Summary, Plot, Education, Company

Pages: 2

Words: 550

Published: 2021/02/01

# Assignment #10 - Factors and dummy variables
# Dataset LDC.csv
# This dataset was used in the analysis of the effect
# of size of the Local Distribution Company (LDC)
# on cost of electricity in Ontario
# Variables
# X = community
# Customers = number of customers
# OMandA = Operating and Maintenance Costs
# Dist.Cost = distribution cost (cost of power
# to the company)
# Total.Bill + average total bill
#
# Student number 297127
#################################################
# load data
d <- file.choose()
LDC<- as.data.frame(read.csv(d, row.names=NULL),header=T, row.names=NULL)

LDC
# Student number 297127
a <- 29
b <- 71
c <- 27
# none is greater than 72
# delete observations:

Delete <- c(a,b,c)

LDC <- LDC[-Delete,]
# plots:
par(mfrow=c(2,1))
plot(LDC$Area, LDC$OMandA,
ylab = "OMandA",
xlab = "Area (N = North, S = South)")
plot(LDC$Size, LDC$OMandA,
ylab = "OMandA",
xlab = "Size (S = Small, M = Medium, L = Large, XL = Extra Large)")
# are there any significant differences?
var.test(LDC$OMandA ~ LDC$Area) # different variances
t.test(OMandA ~ Area, data = LDC) #p.value 0.00571
kruskal.test(OMandA ~ Size, data = LDC) #p.value 1.053e-05
# regress OMandA on Area
model1 <- lm(OMandA ~ Area, data = LDC)
summary(model1)
# regress Total.Bill on Customers, OMandA, and Area
model2 <- lm(Total.Bill ~ Customers + OMandA + Area, data = LDC)
summary(model2)
# add interaction:
model3 <- lm(Total.Bill ~ Customers + OMandA + Area + OMandA:Area, data = LDC)
summary(model3)
# bonus marks
install.packages("effects")
library(effects)
M <- lm(Total.Bill ~ Size:OMandA, data = LDC)
summary(M)
plot(allEffects(M))
plot(allEffects(M), multiline=T)
#####################
### END OF SCRIPT ###
#####################

Cite this page
Choose cite format:
  • APA
  • MLA
  • Harvard
  • Vancouver
  • Chicago
  • ASA
  • IEEE
  • AMA
WePapers. (2021, February, 01) Example Of Colnames(Ldc) Essay. Retrieved March 07, 2021, from https://www.wepapers.com/samples/example-of-colnames-ldc-essay/
"Example Of Colnames(Ldc) Essay." WePapers, 01 Feb. 2021, https://www.wepapers.com/samples/example-of-colnames-ldc-essay/. Accessed 07 March 2021.
WePapers. 2021. Example Of Colnames(Ldc) Essay., viewed March 07 2021, <https://www.wepapers.com/samples/example-of-colnames-ldc-essay/>
WePapers. Example Of Colnames(Ldc) Essay. [Internet]. February 2021. [Accessed March 07, 2021]. Available from: https://www.wepapers.com/samples/example-of-colnames-ldc-essay/
"Example Of Colnames(Ldc) Essay." WePapers, Feb 01, 2021. Accessed March 07, 2021. https://www.wepapers.com/samples/example-of-colnames-ldc-essay/
WePapers. 2021. "Example Of Colnames(Ldc) Essay." Free Essay Examples - WePapers.com. Retrieved March 07, 2021. (https://www.wepapers.com/samples/example-of-colnames-ldc-essay/).
"Example Of Colnames(Ldc) Essay," Free Essay Examples - WePapers.com, 01-Feb-2021. [Online]. Available: https://www.wepapers.com/samples/example-of-colnames-ldc-essay/. [Accessed: 07-Mar-2021].
Example Of Colnames(Ldc) Essay. Free Essay Examples - WePapers.com. https://www.wepapers.com/samples/example-of-colnames-ldc-essay/. Published Feb 01, 2021. Accessed March 07, 2021.
Copy

Share with friends using:

Please remember that this paper is open-access and other students can use it too.

If you need an original paper created exclusively for you, hire one of our brilliant writers!

GET UNIQUE PAPER
Contact us
Chat now