Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Census2022
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SERG
Census2022
Commits
b1c0f98c
Commit
b1c0f98c
authored
Mar 31, 2016
by
Ben Anderson
Browse files
Options
Downloads
Patches
Plain Diff
updated notes and added analysis of autocorrelation coefficient
parent
7864ece7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Census2022.Rproj
+13
-0
13 additions, 0 deletions
Census2022.Rproj
Census2022_CER_CEUS_paper_analysis.R
+47
-11
47 additions, 11 deletions
Census2022_CER_CEUS_paper_analysis.R
with
60 additions
and
11 deletions
Census2022.Rproj
0 → 100644
+
13
−
0
View file @
b1c0f98c
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
This diff is collapsed.
Click to expand it.
Census2022_CER_CEUS_paper_analysis.R
+
47
−
11
View file @
b1c0f98c
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
# In addition the paper uses:
# In addition the paper uses:
# Multilevel regression results calculated using:
# Multilevel regression results
(Table 7)
calculated using:
# https://github.com/dataknut/CER/blob/master/Census2022-CER-mixed_model_0910.R
# https://github.com/dataknut/CER/blob/master/Census2022-CER-mixed_model_0910.R
# Logistic regression results calculated using:
# Logistic regression results
(Table 8 & 9)
calculated using:
# https://github.com/dataknut/CER/blob/master/Census2022-CER_regP_48_CLUSTER_std-1-5-15.R
# https://github.com/dataknut/CER/blob/master/Census2022-CER_regP_48_CLUSTER_std-1-5-15.R
# This work was funded by RCUK through the ESRC's Transformative Social Science Programme via the
# This work was funded by RCUK through the ESRC's Transformative Social Science Programme via the
...
@@ -318,7 +318,7 @@ print(paste0("Oct 09 IDs who both answered pre trial survey and recorded data: "
...
@@ -318,7 +318,7 @@ print(paste0("Oct 09 IDs who both answered pre trial survey and recorded data: "
# Linkage and analysis ----
# Linkage and analysis ----
# Descriptives for Table 1
(Table 1)
----
# Descriptives for Table 1 ----
# Pre-trial survey completions:
# Pre-trial survey completions:
uniqueN
(
cerResPreSurveyDTred
$
ID
)
uniqueN
(
cerResPreSurveyDTred
$
ID
)
# Number of households in residential data:
# Number of households in residential data:
...
@@ -329,7 +329,7 @@ uniqueN(cerResPostSurveyDTred$ID)
...
@@ -329,7 +329,7 @@ uniqueN(cerResPostSurveyDTred$ID)
cerSurveysDT
<-
cerResPreSurveyDTred
[
cerResPostSurveyDTred
]
cerSurveysDT
<-
cerResPreSurveyDTred
[
cerResPostSurveyDTred
]
table
(
cerSurveysDT
$
baCompletedPreSurvey
,
cerSurveysDT
$
baCompletedPostSurvey
,
useNA
=
"always"
)
table
(
cerSurveysDT
$
baCompletedPreSurvey
,
cerSurveysDT
$
baCompletedPostSurvey
,
useNA
=
"always"
)
# Descriptive statistics for mid-week (Table 2)
# Descriptive statistics for mid-week (Table 2)
----
# half hour level - all
# half hour level - all
describe
(
cerOct09DT
[
mid_week
==
1
,
kWh
])
describe
(
cerOct09DT
[
mid_week
==
1
,
kWh
])
# baseload 02:00 - 05:00
# baseload 02:00 - 05:00
...
@@ -343,7 +343,7 @@ describe(cerOct09DT[mid_week == 1 & r_hour >= 16 & r_hour <= 20,
...
@@ -343,7 +343,7 @@ describe(cerOct09DT[mid_week == 1 & r_hour >= 16 & r_hour <= 20,
]
]
)
)
# daily summaries
# daily summaries
for use in tables
octSummarybyDateDT
<-
cerOct09DT
[
mid_week
==
1
,
octSummarybyDateDT
<-
cerOct09DT
[
mid_week
==
1
,
.
(
.
(
N
=
length
(
kWh
),
# n half hour records
N
=
length
(
kWh
),
# n half hour records
...
@@ -359,15 +359,13 @@ octSummarybyDateDT[,
...
@@ -359,15 +359,13 @@ octSummarybyDateDT[,
Mean_daily_total
=
mean
(
Sum
)
Mean_daily_total
=
mean
(
Sum
)
),
),
by
=
baHeat
by
=
baHeat
][
order
(
baHeat
)]
][
order
(
baHeat
)]
# for use in discussion of affect of heat types
# test heat differences
boxplot
(
octSummarybyDateDT
$
Sum
~
octSummarybyDateDT
$
baHeat
)
# remember skew!
# remember skew!
#diff_heat <- kruskal.test(Sum~baHeat, data = octSummarybyDateDT, na.action = na.omit )
#diff_heat <- kruskal.test(Sum~baHeat, data = octSummarybyDateDT, na.action = na.omit )
#summary(diff_heat)
#summary(diff_heat)
# Descriptive statistics for mid-week (Table 3 - new)
# Descriptive statistics for mid-week (Table 3 - new)
----
# by number of people
# by number of people
cerOct09DT
[
mid_week
==
1
,
cerOct09DT
[
mid_week
==
1
,
.
(
.
(
...
@@ -437,7 +435,44 @@ boxHotWater <- ggplot(data = octSummarybyDateDT,
...
@@ -437,7 +435,44 @@ boxHotWater <- ggplot(data = octSummarybyDateDT,
boxHotWater
+
geom_boxplot
()
boxHotWater
+
geom_boxplot
()
ggsave
(
paste0
(
rPath
,
"boxHotWater.png"
),
width
=
10
,
height
=
10
)
ggsave
(
paste0
(
rPath
,
"boxHotWater.png"
),
width
=
10
,
height
=
10
)
# Analysis of autocorrelation coefficients ####
# kwh by time of day for Fig 1 ----
print
(
"Paid work"
)
cerOct09DT
[
mid_week
==
1
&
ba_empl
==
"paid_work"
,
.
(
Mean
=
mean
(
kWh
,
na.rm
=
TRUE
),
sd
=
sd
(
kWh
,
na.rm
=
TRUE
)
),
by
=
r_hour
,
][
order
(
r_hour
)]
# order results
print
(
"Unemployed"
)
cerOct09DT
[
mid_week
==
1
&
ba_empl
==
"unemployed"
,
.
(
Mean
=
mean
(
kWh
,
na.rm
=
TRUE
),
sd
=
sd
(
kWh
,
na.rm
=
TRUE
)
),
by
=
r_hour
,
][
order
(
r_hour
)]
# order results
print
(
"Retired"
)
cerOct09DT
[
mid_week
==
1
&
ba_empl
==
"retired"
,
.
(
Mean
=
mean
(
kWh
,
na.rm
=
TRUE
),
sd
=
sd
(
kWh
,
na.rm
=
TRUE
)
),
by
=
r_hour
,
][
order
(
r_hour
)]
# order results
print
(
"Carer"
)
cerOct09DT
[
mid_week
==
1
&
ba_empl
==
"carer"
,
.
(
Mean
=
mean
(
kWh
,
na.rm
=
TRUE
),
sd
=
sd
(
kWh
,
na.rm
=
TRUE
)
),
by
=
r_hour
,
][
order
(
r_hour
)]
# order results
# Analysis of autocorrelation coefficients - for Model 2.3 ----
# These were calculated using STATA and then aggregated, see
# These were calculated using STATA and then aggregated, see
# https://github.com/dataknut/CER/blob/master/Census2022-CER-calculate-AR.do
# https://github.com/dataknut/CER/blob/master/Census2022-CER-calculate-AR.do
...
@@ -474,6 +509,7 @@ archByEmpl
...
@@ -474,6 +509,7 @@ archByEmpl
boxArchByEmpl
<-
ggplot
(
data
=
cerArchrDT
[
lag_id
==
"mid-week"
&
lag
==
36
],
boxArchByEmpl
<-
ggplot
(
data
=
cerArchrDT
[
lag_id
==
"mid-week"
&
lag
==
36
],
aes
(
ba_empl
,
archr
)
aes
(
ba_empl
,
archr
)
)
)
# for discussion of model 2.3
boxArchByEmpl
+
geom_boxplot
()
boxArchByEmpl
+
geom_boxplot
()
ggsave
(
paste0
(
rPath
,
"boxArchByEmpl.png"
),
width
=
10
,
height
=
10
)
ggsave
(
paste0
(
rPath
,
"boxArchByEmpl.png"
),
width
=
10
,
height
=
10
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment