-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathlab 9.Rmd
48 lines (42 loc) · 1.33 KB
/
lab 9.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
---
title: "Lab 9"
author: "Netanel Weinstein"
date: "December 2, 2018"
output:
html_document:
toc: true
toc_depth: 4
---
```{r plot, echo = FALSE}
library(rio)
library(tidyverse)
library(here)
data
data <- import(here("data", "ecls-k_samp.sav")) %>%
characterize() %>%
janitor::clean_names() %>%
mutate(ses_cat = factor(ses_cat,
levels = c("FIRST QUINTILE",
"SECOND QUINTILE",
"THIRD QUINTILE",
"FOURTH QUINTILE",
"FIFTH QUINTILE"),
labels = c("First",
"Second",
"Third",
"Fourth",
"Fifth")))
#recreation of plot:
ggplot(data, aes(x = t1mscale, y = t2mscale)) +
geom_point(color = "gray") +
geom_smooth(aes(color = ses_cat),
method = "lm",
se = FALSE) +
ggtitle("Math scores", "Relation from Time 1 to Time 2") +
xlab("Math Score (time 1)") +
ylab("Math Score (time 2)")
```
**Regression model** for *Math* Achievment:
$$
math_{t2_i} = \alpha + \beta_1(math_{t1_i}) + \beta_2(SES_{cat_i}) + \beta_3(math_{t1_i} \times SES_{cat_i}) \epsilon
$$