Sie sind auf Seite 1von 3

> Dataset <-

+ read.table("C:/Users/sophie.wegscheider/Documents/Universit�t/Master/Vertiefung
statistische Methoden/H�1/moral-g15.txt",
+ header=TRUE, sep="", na.strings="NA", dec=",", strip.white=TRUE)

> Dataset$Income <- with(Dataset, factor(Income, levels=c('Less than $30,000',


+ '$30,001 to $60,000','$60,001 to $90,000','$90,001 to $120,000',
+ '$120,001 to $150,000','$150,001 to $180,000','$180,001 to $210,000',
+ '$210,001 to $240,000','more than $240,001')))

> Dataset <- within(Dataset, {


+ Obliged4 <- factor(Obliged4, labels=c('1','2','3','4','5'))
+ })

> Dataset <- within(Dataset, {


+ Obliged8 <- factor(Obliged8, labels=c('1','2','3','4','5'))
+ Obliged17 <- factor(Obliged17, labels=c('1','2','3','4','5'))
+ Obliged19 <- factor(Obliged19, labels=c('1','2','3','4','5'))
+ Obliged30 <- factor(Obliged30, labels=c('1','2','3','4','5'))
+ })

> Dataset <- na.omit(Dataset)

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> Boxplot( ~ Age, data=Dataset, id.method="y")


[1] "49"

> Boxplot( ~ Age, data=Dataset, id.method="y")


[1] "49"

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> library(colorspace, pos=16)

> with(Dataset, Barplot(Obliged4, xlab="Obliged4", ylab="Frequency"))

> with(Dataset, Barplot(Obliged8, xlab="Obliged8", ylab="Frequency"))

> with(Dataset, pie(table(Income), labels=levels(Income), xlab="", ylab="",


+ main="Income", col=rainbow_hcl(9)))

> LinearModel.1 <- lm(sobl ~ Age + Gender + Income + Relationship_Status + State +


+ Occupation, data=Dataset)
> summary(LinearModel.1)

Call:
lm(formula = sobl ~ Age + Gender + Income + Relationship_Status +
State + Occupation, data = Dataset)

Residuals:
Min 1Q Median 3Q Max
-68.655 -10.401 1.245 12.601 43.745

Coefficients:
Estimate Std. Error t value Pr(>|t|)

(Intercept) 98.30897 8.28977 11.859 < 2e-16


***
Age 0.25263 0.08341 3.029 0.002608
**
Gender[T.Male] -7.54290 2.11101 -3.573 0.000394
***
Income[T.$30,001 to $60,000] 2.67983 3.00089 0.893 0.372368

Income[T.$60,001 to $90,000] 6.07399 3.21693 1.888


0.059705 .
Income[T.$90,001 to $120,000] -1.27317 3.53403 -0.360 0.718836

Income[T.$120,001 to $150,000] 7.38634 4.31191 1.713


0.087458 .
Income[T.$150,001 to $180,000] -2.34494 5.86920 -0.400 0.689706

Income[T.$180,001 to $210,000] 2.80729 8.38297 0.335 0.737884

Income[T.$210,001 to $240,000] -9.91764 10.13168 -0.979 0.328212

Income[T.more than $240,001] 4.23974 10.03882 0.422 0.673000

Relationship_Status[T.married] -3.57025 2.70544 -1.320 0.187678

Relationship_Status[T.separated or divorced] 3.08662 3.87921 0.796 0.426670

Relationship_Status[T.single] 4.37575 3.16800 1.381 0.167951

Relationship_Status[T.widowed] 1.93757 10.32053 0.188 0.851173

State[T.NSW] 5.15817 6.36079 0.811 0.417870

State[T.NT] -31.82785 12.80740 -2.485 0.013344


*
State[T.QLD] 4.34565 6.47386 0.671 0.502428

State[T.SA] 8.72256 6.96706 1.252 0.211285

State[T.Tas] -1.25917 10.67763 -0.118 0.906183

State[T.VIC] 5.66855 6.34387 0.894 0.372082

State[T.WA] 4.54265 6.80334 0.668 0.504690

Occupation[T.home-duties] 1.84688 4.37237 0.422 0.672954


Occupation[T.labourer] 3.12201 6.85337 0.456 0.648956

Occupation[T.manager or administrator] -3.54126 3.83616 -0.923 0.356479

Occupation[T.professional] 0.42799 3.66238 0.117 0.907026

Occupation[T.retired] -0.84269 4.71055 -0.179 0.858108

Occupation[T.sales] 0.01417 4.65070 0.003 0.997570

Occupation[T.small business owner] 0.07773 4.49943 0.017 0.986225

Occupation[T.tradesperson] 0.13185 5.68101 0.023 0.981495

Occupation[T.transport worker] 10.85119 6.84775 1.585 0.113811

Occupation[T.unemployed] -8.42761 5.54408 -1.520 0.129245

---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 18.89 on 415 degrees of freedom


Multiple R-squared: 0.1386, Adjusted R-squared: 0.07421
F-statistic: 2.153 on 31 and 415 DF, p-value: 0.0004417

> LinearModel.2 <- lm(sobl ~ Age, data=Dataset)

> summary(LinearModel.2)

Call:
lm(formula = sobl ~ Age, data = Dataset)

Residuals:
Min 1Q Median 3Q Max
-79.990 -10.116 1.566 13.413 39.038

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 102.98904 2.87329 35.844 <2e-16 ***
Age 0.19447 0.06287 3.093 0.0021 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 19.45 on 445 degrees of freedom


Multiple R-squared: 0.02105, Adjusted R-squared: 0.01885
F-statistic: 9.569 on 1 and 445 DF, p-value: 0.002103

> oldpar <- par(oma=c(0,0,3,0), mfrow=c(2,2))

> plot(LinearModel.2)

> par(oldpar)

> with(Dataset, Barplot(Obliged8, xlab="Obliged8", ylab="Frequency"))

Das könnte Ihnen auch gefallen