-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAssignmet2-template.Rmd
71 lines (57 loc) · 2.69 KB
/
Assignmet2-template.Rmd
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
---
title: 'Assignment 2: Interpreting Quantitative Findings'
author: "[Your student number here]"
date: "[Date]"
output: html_document
---
<!-- This is a suggested template to write Assignment 2. Feel free to make changes as appropriate according to the guidance. -->
```{r setup, include=FALSE}
knitr::opts_chunk$set(message=FALSE, warning=FALSE)
```
```{r preamble, include=FALSE}
# Install packages if missing
list.of.packages <- c("tidyverse", "stargazer", "devtools")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
# Wordcount addin
devtools::install_github("benmarwick/wordcountaddin", type = "source", dependencies = TRUE)
# Load packages
library(tidyverse)
library(stargazer)
# Read data
nilt <- readRDS("data/fullnilt_2012.rds")
```
Word count: `r wordcountaddin::word_count("Assignmet2-template.Rmd") - 10`
# Introduction
<!-- Word count: approx. 400 -->
<!-- Look at the model in part 2 below. Based on this state a research question and a hypothesis. Remember a hypothesis needs at least two variables. -->
# Data and method
<!-- Word count: approx. 800 -->
<!-- In this section your goal is to demonstrate that you can describe data and that you understand research design and data collection. -->
# Results and discussion
<!-- Word count: approx. 1300 -->
<!-- In this section your goal is to demonstrate that you can interpret quantitative results. Additional credit is available if you are able to relate these findings to social science theories or if you can put the findings in context. -->
```{r, echo = FALSE, results='asis'}
# This chunk will run the linear regression and print the output
# run model
model <- lm(persinc2 ~ rsex + religcat + orient + uninatid + tunionsa + rsuper + rage, data = nilt)
# Set name of variables
cov_labels <-
c('Sex: Female (ref.: Male)', 'Religion: Protestant (ref.: Catholic)', 'Religion: No religion',
'Sexual Orientation: Homosexual (ref.: Heterosexual)', 'Sexual Orientation: bi-sexual', 'Sexual Orientation: Other',
'Constitutional View: Nationalist (ref.: Unionist)', 'Constitutional view: Neither',
'Trade union membership: No (ref.: Yes)', 'Supervisor: No (ref.: Yes)', 'Age', 'Constant')
# Print result
stargazer(model,
style = "ajs",
type = 'html',
title = "Regression results",
header = TRUE,
single.row = FALSE,
covariate.labels = cov_labels,
dep.var.caption = "Dependent Variable",
dep.var.labels = "Annual Personal Income (GBP)")
```
# Conclusion
<!-- Word count: approx. 500 -->
<!-- Clearly state your findings. Do the findings raise any questions for future research? -->