Vi må installere noen pakker og da får vi Housing datafilen gjennom pakken Ecdat.
Enten bruker vi base R eller den mer kraftige pakken ggplot som vi fikk via tidyverse.
Stolpediagram for preferred area:
1-sample proportions test without continuity correction
data: 28 out of 56, null probability 0.5
X-squared = 0, df = 1, p-value = 1
alternative hypothesis: true p is not equal to 0.5
90 percent confidence interval:
0.392661 0.607339
sample estimates:
p
0.5
One Sample t-test
data: alder
t = 9.5681, df = 5, p-value = 0.0002112
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
29.61922 51.38078
sample estimates:
mean of x
40.5
Call:
lm(formula = oppmøte ~ poeng)
Residuals:
Min 1Q Median 3Q Max
-4.8698 -0.8058 -0.3470 1.0486 4.1302
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.4107 3.1388 -2.361 0.045887 *
poeng 0.8140 0.1573 5.176 0.000847 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.527 on 8 degrees of freedom
Multiple R-squared: 0.77, Adjusted R-squared: 0.7413
F-statistic: 26.79 on 1 and 8 DF, p-value: 0.0008471