head(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
library(printr)
head(iris)
Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
---|---|---|---|---|
5.1 | 3.5 | 1.4 | 0.2 | setosa |
4.9 | 3.0 | 1.4 | 0.2 | setosa |
4.7 | 3.2 | 1.3 | 0.2 | setosa |
4.6 | 3.1 | 1.5 | 0.2 | setosa |
5.0 | 3.6 | 1.4 | 0.2 | setosa |
5.4 | 3.9 | 1.7 | 0.4 | setosa |
unloadNamespace('printr')
summary(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100
## 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300
## Median :5.800 Median :3.000 Median :4.350 Median :1.300
## Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199
## 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800
## Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500
## Species
## setosa :50
## versicolor:50
## virginica :50
##
##
##
library(printr)
summary(iris)
Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species | |
---|---|---|---|---|---|
Min. :4.300 | Min. :2.000 | Min. :1.000 | Min. :0.100 | setosa :50 | |
1st Qu.:5.100 | 1st Qu.:2.800 | 1st Qu.:1.600 | 1st Qu.:0.300 | versicolor:50 | |
Median :5.800 | Median :3.000 | Median :4.350 | Median :1.300 | virginica :50 | |
Mean :5.843 | Mean :3.057 | Mean :3.758 | Mean :1.199 | NA | |
3rd Qu.:6.400 | 3rd Qu.:3.300 | 3rd Qu.:5.100 | 3rd Qu.:1.800 | NA | |
Max. :7.900 | Max. :4.400 | Max. :6.900 | Max. :2.500 | NA |
unloadNamespace('printr')
knitr::kable(summary(iris),digits = 2)
Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species | |
---|---|---|---|---|---|
Min. :4.300 | Min. :2.000 | Min. :1.000 | Min. :0.100 | setosa :50 | |
1st Qu.:5.100 | 1st Qu.:2.800 | 1st Qu.:1.600 | 1st Qu.:0.300 | versicolor:50 | |
Median :5.800 | Median :3.000 | Median :4.350 | Median :1.300 | virginica :50 | |
Mean :5.843 | Mean :3.057 | Mean :3.758 | Mean :1.199 | NA | |
3rd Qu.:6.400 | 3rd Qu.:3.300 | 3rd Qu.:5.100 | 3rd Qu.:1.800 | NA | |
Max. :7.900 | Max. :4.400 | Max. :6.900 | Max. :2.500 | NA |
library(stargazer)
stargazer(iris, type='html')
Statistic | N | Mean | St. Dev. | Min | Pctl(25) | Pctl(75) | Max |
Sepal.Length | 150 | 5.843 | 0.828 | 4.300 | 5.100 | 6.400 | 7.900 |
Sepal.Width | 150 | 3.057 | 0.436 | 2.000 | 2.800 | 3.300 | 4.400 |
Petal.Length | 150 | 3.758 | 1.765 | 1.000 | 1.600 | 5.100 | 6.900 |
Petal.Width | 150 | 1.199 | 0.762 | 0.100 | 0.300 | 1.800 | 2.500 |
library(summarytools)
dfSummary(iris, style='grid', plain.ascii = FALSE, graph.col = FALSE)
Dimensions: 150 x 5
Duplicates: 1
No | Variable | Stats / Values | Freqs (% of Valid) | Valid | Missing |
---|---|---|---|---|---|
1 |
Sepal.Length |
Mean (sd) : 5.8 (0.8) |
35 distinct values |
150 |
0 |
2 |
Sepal.Width |
Mean (sd) : 3.1 (0.4) |
23 distinct values |
150 |
0 |
3 |
Petal.Length |
Mean (sd) : 3.8 (1.8) |
43 distinct values |
150 |
0 |
4 |
Petal.Width |
Mean (sd) : 1.2 (0.8) |
22 distinct values |
150 |
0 |
5 |
Species |
1. setosa |
50 (33.3%) |
150 |
0 |
summary(linear.1)
##
## Call:
## lm(formula = rating ~ complaints + privileges + learning + raises +
## critical, data = attitude)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.9102 -5.2839 0.6959 5.8278 11.3886
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.01113 11.70394 0.941 0.356178
## complaints 0.69205 0.14886 4.649 0.000101 ***
## privileges -0.10356 0.13473 -0.769 0.449591
## learning 0.24906 0.15962 1.560 0.131768
## raises -0.03346 0.20228 -0.165 0.869999
## critical 0.01549 0.14725 0.105 0.917104
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.139 on 24 degrees of freedom
## Multiple R-squared: 0.7154, Adjusted R-squared: 0.6561
## F-statistic: 12.06 on 5 and 24 DF, p-value: 6.497e-06
library(printr)
summary(linear.1)
##
## Call:
## lm(formula = rating ~ complaints + privileges + learning + raises +
## critical, data = attitude)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.9102 -5.2839 0.6959 5.8278 11.3886
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.01113 11.70394 0.941 0.356178
## complaints 0.69205 0.14886 4.649 0.000101 ***
## privileges -0.10356 0.13473 -0.769 0.449591
## learning 0.24906 0.15962 1.560 0.131768
## raises -0.03346 0.20228 -0.165 0.869999
## critical 0.01549 0.14725 0.105 0.917104
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.139 on 24 degrees of freedom
## Multiple R-squared: 0.7154, Adjusted R-squared: 0.6561
## F-statistic: 12.06 on 5 and 24 DF, p-value: 6.497e-06
unloadNamespace('printr')
library(stargazer)
stargazer( linear.1 , linear.2 , probit.model
, title = "Results"
, align = TRUE
, type = 'html'
, keep.stat=c("n","ser","adj.rsq"))
Dependent variable: | |||
rating | high.rating | ||
OLS | probit | ||
(1) | (2) | (3) | |
complaints | 0.692*** | 0.682*** | |
(0.149) | (0.129) | ||
privileges | -0.104 | -0.103 | |
(0.135) | (0.129) | ||
learning | 0.249 | 0.238* | 0.164*** |
(0.160) | (0.139) | (0.053) | |
raises | -0.033 | ||
(0.202) | |||
critical | 0.015 | -0.001 | |
(0.147) | (0.044) | ||
advance | -0.062 | ||
(0.042) | |||
Constant | 11.011 | 11.258 | -7.476** |
(11.704) | (7.318) | (3.570) | |
Observations | 30 | 30 | 30 |
Adjusted R2 | 0.656 | 0.682 | |
Residual Std. Error | 7.139 (df = 24) | 6.863 (df = 26) | |
Note: | p<0.1; p<0.05; p<0.01 |