-
Notifications
You must be signed in to change notification settings - Fork 0
/
excercise.Rmd
61 lines (41 loc) · 1.51 KB
/
excercise.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
---
title: "The Iris Data Set"
author: "Fabian Schroeder"
date: "September 13, 2017"
output: pdf_document
bibliography: bibliography.bib
---
```{r setup, include=FALSE}
library("xtable")
library("stargazer")
data("iris")
```
***
## Description
This famous dataset [@fisher, @anderson] gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species or iris. The species are *Iris setosa, versicolor*, and *virginica*.
![Illustration of the Variables of the iris data set.](iris.png)
Iris is a data frame with 150 cases (rows) and 5 variables (columns) named Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, and Species.
```{r echo=FALSE}
#summary(iris)
```
```{r echo=FALSE, results="asis"}
options(xtable.comment = FALSE)
xtable::xtable(summary(iris), type = "latex", comment = FALSE, caption = "Summary of the data set")
```
## Scatterplot Matrix
```{r echo=FALSE}
plot(iris)
```
## Logistic Regression Analysis
```{r echo = FALSE, include=FALSE}
iris[['Is.Versicolor']] <- as.numeric(iris[['Species']] == 'versicolor')
iris[['Is.Virginica']] <- as.numeric(iris[['Species']] == 'virginica')
fit.1 <- glm(Is.Versicolor ~ Petal.Length + Sepal.Length, data = iris)
fit.2 <- glm(Is.Virginica ~ Petal.Length + Sepal.Length, data = iris)
#summary(fit)
output <- capture.output(stargazer(fit.1, fit.2, title = 'Regression Results', summary=FALSE, header=FALSE))
```
```{r echo = FALSE, results='asis'}
cat(output)
```
## References