Team “CandyCrash”
BSC163
Gugnina Daria
Korolik Irina
Sokolova Anna
Country: Sweden
Topic: “Social inclusion and the level of happiness (desired and subjectively available) among men and women of different ages”
Downolading packages
# libraries for tables
library(knitr)
library(kableExtra)
# for spss
library(foreign)
# for select
library(dplyr)
# library for graphs
library(ggplot2)
library(corrplot)
# for Levene's test
library(car)
# to run post hoc tests
library(userfriendlyscience)
Let’s start with the selection of variables relevant to our topic:
#set new directory
setwd("E:/gfgrf/ESS8SE_spss")
getwd()
## [1] "E:/gfgrf/ESS8SE_spss"
ESS < read.spss("ESS8SE.sav", use.value.labels=T, to.data.frame=T)
ESS1 < select(ESS, c("happy", "sclmeet", "sclact", "inprdsc",
"gndr", "ipgdtim", "yrbrn"))
ESS1 = na.omit(ESS1)
Meaning  Qualitative or Quantitative  Level of measurement  Descrete or continious  

Gndr  Gender  Qualitative  Nominal  Descrete 
Yrbrn  Year of birth  Quantitative  Interval  Continuous 
Happy  How happy are you  Qualitative  Ordinal  Descrete 
Sclmeet  How often socially meet with friends, relatives or colleagues  Qualitative  Ordinal  Descrete 
Sclact  Take part in social activities compared to others of same age  Qualitative  Ordinal  Descrete 
Inprdsc  How many people with whom you can discuss intimate and personal matters  Qualitative  Ordinal  Descrete 
Ipgdtim  Important to have a good time  Qualitative  Ordinal  Descrete 
ESS1$yrbrn <as.numeric(ESS1$yrbrn)
typeof(ESS1$yrbrn)
## [1] "double"
class(ESS1$yrbrn)
## [1] "numeric"
Describe single variables using CTM
We find the mode of variables, it has all of our variables:
Mode < function(x) {
ux < unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
Mode(as.numeric(ESS1$yrbrn))
## [1] 28
Mode(ESS1$ipgdtim)
## [1] Somewhat like me
## 6 Levels: Very much like me Like me Somewhat like me ... Not like me at all
Mode(ESS1$happy)
## [1] 8
## Levels: Extremely unhappy 1 2 3 4 5 6 7 8 9 Extremely happy
Mode(ESS1$sclact)
## [1] About the same
## 5 Levels: Much less than most Less than most ... Much more than most
Mode(ESS1$sclmeet)
## [1] Several times a week
## 7 Levels: Never Less than once a month ... Every day
Mode(ESS1$inprdsc)
## [1] 46
## Levels: None 1 2 3 46 79 10 or more
Mode(ESS1$gndr)
## [1] Female
## Levels: Male Female
Also, we look at the median value of our variables:
median(as.numeric(ESS1$yrbrn), na.rm = T)
## [1] 45
On our only quantitative variable ( “Year of birth”) we looked at the first and third quartiles, median, mean, and maximum and minimum values:
summary(ESS1$yrbrn)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 30.00 45.00 45.64 61.00 82.00
For better data perception, we generated a table on CTM according to our variables:
Meaning  Moda  Median  Mean  

Gndr  Gender  Female 


Yrbrn  Year of birth  28  45  45.9 
Happy  How happy are you  8 


Sclmeet  How often socially meet with friends, relatives or colleagues  Several times a week 


Sclact  Take part in social activities compared to others of same age  About the same 


Inprdsc  How many people with whom you can discuss intimate and personal matters  46 


Ipgdtim  Important to have a good time  Somewhat like me 


year < c(mean(ESS1$yrbrn, na.rm = T), median(ESS1$yrbrn, na.rm = T), Mode(ESS1$yrbrn))
barplot(year, xlab="CTM", ylab="Age of respondents", col=c("slateblue1", "turquoise2", "plum2"), names=c("mean by age", "median by age", "moda by age"))
plot(ESS1$gndr, xlab="Gender", ylab="Number of people", col=c("paleturquoise1", "rosybrown1"), names=c("Male", "Female"))
This graph shows the average, median values and the value of fashion by age of respondents. It can be seen that the average value of age (45.5) takes the greatest value, while the median age is only slightly inferior to the average (45). The value of the age mode does not reach even thirty (28)  the majority of respondents were aged 28 years.
According to the second schedule, we can say that in our sample, the number of men only slightly exceeds the number of women: 773 men and 777 women.
The graph shows that the largest number of respondents  at the age of 28 years. In principle, respondents younger than twenty years less than respondents of other ages. The smallest number of respondents among respondents over the age of twenty  about 27 respondents at the age of about 75 years.
This chart reflects the level of happiness that respondents themselves attribute to themselves. Respondents were offered a scale, where 0  very unhappy, 10  extremely happy. As you can see, most of the answers are concentrated in the right part of the graph, from which it can be concluded that the level of happiness of the prevailing number of informants is quite high.
Here the respondents were asked to indicate the number of people with whom they can speak personal, intimate topics, where 0 is “with no one”, 6 with 10 or more (people). Most often in questionnaires, a figure of five was chosen, which is equivalent to 7 to 9 people with whom the respondent can share confidential information. The option “no one” is the least popular, so we can say that the majority of respondents have at least 2 people who are not trusted. Hence, the level of trust in people among the respondents is high.
On this point the respondents were offered the following situation: please listen to each description and tell me how much each person is or is not not like you. Use this card for your answer. Having a good time is important to her / him. She / he likes to “spoil” herself / himself. The level of “similarity” the respondent was to note on the scale, where 0  very similar to me, 6  absolutely different from me. The most common answers are 2 and 3  Like me and Somewhat like me.
People of all ages tend to meet with friends and colleagues several times a week. People under the age of twenty do not tend to leave the question about the frequency of meetings with friends. The smallest number of respondents never meets their friends, relatives and colleagues, but there is practically no such investment. Several times a month, people from about 14 to 72 years old, younger than 14 and older than 72, are not seen with their acquaintances.
Men and women respond equally to the question of time spent: they believe that descriptions of other people are somewhat similar to themselves.
We make a table for the variables that we will include in the hypotheses and check with the help of the chisquare test:
table(as.character(ESS1$gndr), as.character(ESS1$sclact))
##
## About the same Less than most More than most Much less than most
## Female 374 195 127 39
## Male 348 213 133 42
##
## Much more than most
## Female 26
## Male 19
table(as.character(ESS1$gndr), as.character(ESS1$ipgdtim))
##
## A little like me Like me Not like me Not like me at all
## Female 157 205 99 12
## Male 131 224 86 10
##
## Somewhat like me Very much like me
## Female 214 74
## Male 217 87
We want to test the following hypothesis for Chisquare test:
H0: there are no differences between chosen groups
The alternative will be:
H1: there are some differences between chosen groups
chisq.test(as.character(ESS1$gndr), as.character(ESS1$sclact))
##
## Pearson's Chisquared test
##
## data: as.character(ESS1$gndr) and as.character(ESS1$sclact)
## Xsquared = 3.0452, df = 4, pvalue = 0.5503
Conclusion: For pvalue> .05 (pvalue = 0.5503), Xsquared = 3.0452, df = 4, so we cannot reject the H0 hypothesis, so there are no significant differences in social