This document provides a breakdown of the statistical analysis from a research study.
Below loads the raw data file into the system and outputs the file list of headers in the data set.
# Import dataset
dat <- read.csv("DisgustData.csv")
# Return the names of the datset
names(dat)
## [1] "Id"
## [2] "Start.Date"
## [3] "Submit.Date"
## [4] "IP"
## [5] "Please.type.your.age"
## [6] "Please.select.your.sex"
## [7] "The.established.authorities.generally.turn.out.to.be.right.about.things..while.the.radicals.and.protestors.are.usually.just..loud.mouths..showing.off.their.ignorance."
## [8] "Women.should.have.to.promise.to.obey.their.husbands.when.they.get.married."
## [9] "Our.country.desperately.needs.a.mighty.leader.who.will.do.what.has.to.be.done.to.destroy.the.radical.new.ways.and.sinfulness.that.are.ruining.us."
## [10] "Gays.and.lesbians.are.just.as.healthy.and.moral.as.anybody.else."
## [11] "It.is.always.better.to.trust.the.judgment.of.the.proper.authorities.in.government.and.religion.than.to.listen.to.the.noisy.rabble.rousers.in.our.society.who.are.trying.to.create.doubt.in.people.s.minds."
## [12] "Atheists.and.others.who.have.rebelled.against.the.established.religions.are.no.doubt.every.bit.as.good.and.virtuous.as.those.who.attend.church.regularly."
## [13] "The.only.way.our.country.can.get.through.the.crisis.ahead.is.to.get.back.to.our.traditional.values..put.some.tough.leaders.in.power..and.silence.the.troublemakers.spreading.bad.ideas."
## [14] "There.is.absolutely.nothing.wrong.with.nudist.camps."
## [15] "Our.country.needs.free.thinkers.who.have.the.courage.to.defy.traditional.ways..even.if.this.upsets.many.people."
## [16] "Our.country.will.be.destroyed.someday.if.we.do.not.smash.the.perversions.eating.away.at.our.moral.fiber.and.traditional.beliefs."
## [17] "Everyone.should.have.their.own.lifestyle..religious.beliefs..and.sexual.preferences..even.if.it.makes.them.different.from.everyone.else."
## [18] "The..old.fashioned.ways..and.the..old.fashioned.values..still.show.the.best.way.to.live."
## [19] "You.have.to.admire.those.who.challenged.the.law.and.the.majority.s.view.by.protesting.for.women.s.abortion.rights..for.animal.rights..or.to.abolish.school.prayer."
## [20] "What.our.country.really.needs.is.a.strong..determined.leader.who.will.crush.evil..and.take.us.back.to.our.true.path."
## [21] "Some.of.the.best.people.in.our.country.are.those.who.are.challenging.our.government..criticizing.religion..and.ignoring.the..normal.way.things.are.supposed.to.be.done.."
## [22] "God.s.laws.about.abortion..pornography.and.marriage.must.be.strictly.followed.before.it.is.too.late..and.those.who.break.them.must.be.strongly.punished."
## [23] "There.are.many.radical..immoral.people.in.our.country.today..who.are.trying.to.ruin.it.for.their.own.godless.purposes..whom.the.authorities.should.put.out.of.action."
## [24] "A..woman.s.place..should.be.wherever.she.wants.to.be..The.days.when.women.are.submissive.to.their.husbands.and.social.conventions.belong.strictly.in.the.past."
## [25] "Our.country.will.be.great.if.we.honor.the.ways.of.our.forefathers..do.what.the.authorities.tell.us.to.do..and.get.rid.of.the..rotten.apples..who.are.ruining.everything."
## [26] "There.is.no..ONE.right.way..to.live.life..everybody.has.to.create.their.own.way."
## [27] "Homosexuals.and.feminists.should.be.praised.for.being.brave.enough.to.defy..traditional.family.values."
## [28] "This.country.would.work.a.lot.better.if.certain.groups.of.troublemakers.would.just.shut.up.and.accept.their.group.s.traditional.place.in.society."
## [29] "On.a.rating.of.1.to.10.how.likely.would.you.be.to.eat.a.cooked.cricket..an.insect.similar.to.a.grasshopper.or.locust.."
## [30] "On.a.rating.of.1.to.10.how.likely.would.you.be.to.eat.a.food.that.contains.cricket.flour."
## [31] "Select.a.group"
## [32] "On.a.rating.of.1.to.10.how.likely.would.you.be.to.eat.a.food.that.contains.cricket.flour..1"
## [33] "On.a.rating.of.1.to.10.how.likely.would.you.be.to.eat.a.cooked.cricket..an.insect.similar.to.a.grasshopper.or.locust...1"
## [34] "Additional.comments.please"
## [35] "Debrief"
Next up the headers of the dataset are renamed to make things a little easier.
# Recoding the data for use
# Shorten some of the names
names(dat)[5] <- "Age"
names(dat)[6] <- "Sex"
names(dat)[7] <- "RWA01"
names(dat)[8] <- "RWA02"
names(dat)[9] <- "RWA03"
names(dat)[10] <- "RWA04"
names(dat)[11] <- "RWA05"
names(dat)[12] <- "RWA06"
names(dat)[13] <- "RWA07"
names(dat)[14] <- "RWA08"
names(dat)[15] <- "RWA09"
names(dat)[16] <- "RWA10"
names(dat)[17] <- "RWA11"
names(dat)[18] <- "RWA12"
names(dat)[19] <- "RWA13"
names(dat)[20] <- "RWA14"
names(dat)[21] <- "RWA15"
names(dat)[22] <- "RWA16"
names(dat)[23] <- "RWA17"
names(dat)[24] <- "RWA18"
names(dat)[25] <- "RWA19"
names(dat)[26] <- "RWA20"
names(dat)[27] <- "RWA21"
names(dat)[28] <- "RWA22"
names(dat)[29] <- "BeforeCricket"
names(dat)[30] <- "BeforeCricketBar"
names(dat)[31] <- "Group"
names(dat)[32] <- "AfterCricketBar"
names(dat)[33] <- "AfterCricket"
names(dat)[34] <- "Comments"
The Right Wing Authoritarianism scale still needs to be calculated.
We also need to calculate the changes in rating for the food types and add these to the dataset.
# Function to change the Likert results from the long form to a number
library(plyr)
likert_to_number <- function(x){
x <- revalue(x, c("-4 You very strongly disagree with the statement."="-4",
"-3 You strongly disagree with the statement. "="-3",
"-2 You moderately disagree with the statement."="-2",
"-1 You slightly disagree with the statement."="-1",
"0 You feel exactly and precisely neutral about an item."="0",
"+1 You slightly agree with the statement. "="1",
"+2 You moderately agree with the statement."="2",
"+3 You strongly agree with the statement. "="3",
"+4 You very strongly agree with the statement."="4"
) )
return(x)
}
dat$RWA01 <- likert_to_number(dat$RWA01)
dat$RWA02 <- likert_to_number(dat$RWA02)
dat$RWA03 <- likert_to_number(dat$RWA03)
dat$RWA04 <- likert_to_number(dat$RWA04)
dat$RWA05 <- likert_to_number(dat$RWA05)
dat$RWA06 <- likert_to_number(dat$RWA06)
dat$RWA07 <- likert_to_number(dat$RWA07)
dat$RWA08 <- likert_to_number(dat$RWA08)
dat$RWA09 <- likert_to_number(dat$RWA09)
dat$RWA10 <- likert_to_number(dat$RWA10)
dat$RWA11 <- likert_to_number(dat$RWA11)
dat$RWA12 <- likert_to_number(dat$RWA12)
dat$RWA13 <- likert_to_number(dat$RWA13)
dat$RWA14 <- likert_to_number(dat$RWA14)
dat$RWA15 <- likert_to_number(dat$RWA15)
dat$RWA16 <- likert_to_number(dat$RWA16)
dat$RWA17 <- likert_to_number(dat$RWA17)
dat$RWA18 <- likert_to_number(dat$RWA18)
dat$RWA19 <- likert_to_number(dat$RWA19)
## The following `from` values were not present in `x`: +4 You very strongly agree with the statement.
dat$RWA20 <- likert_to_number(dat$RWA20)
dat$RWA21 <- likert_to_number(dat$RWA21)
dat$RWA22 <- likert_to_number(dat$RWA22)
# Next lets score the RWA results
# Scores go from 20 to 180
# Question 1 and 2 are test questions and not used
# Positive scores are 3, 5, 7, 10, 12, 14, 16, 17, 19 and 22
# Add all the positive scores and add 50
# The remainder are reversed questions, we could recode but its easier to do the following
# Start with 50 and substract the total of the negative scores
dat$RWAscore <- 100 + as.numeric(as.character(dat$RWA03)) + as.numeric(as.character(dat$RWA05)) +
as.numeric(as.character(dat$RWA07)) + as.numeric(as.character(dat$RWA10)) + as.numeric(as.character(dat$RWA12)) +
as.numeric(as.character(dat$RWA14)) + as.numeric(as.character(dat$RWA16)) + as.numeric(as.character(dat$RWA17)) +
as.numeric(as.character(dat$RWA19)) + as.numeric(as.character(dat$RWA22)) - as.numeric(as.character(dat$RWA04)) -
as.numeric(as.character(dat$RWA06)) - as.numeric(as.character(dat$RWA08)) - as.numeric(as.character(dat$RWA09)) -
as.numeric(as.character(dat$RWA11)) - as.numeric(as.character(dat$RWA13)) - as.numeric(as.character(dat$RWA15)) -
as.numeric(as.character(dat$RWA18)) - as.numeric(as.character(dat$RWA20)) - as.numeric(as.character(dat$RWA21))
# Calculate the changes in rating
dat$CricketChange <- dat$AfterCricket - dat$BeforeCricket
dat$BarChange <- dat$AfterCricketBar - dat$BeforeCricket
# Return the updated names of the dataset
names(dat)
## [1] "Id" "Start.Date" "Submit.Date"
## [4] "IP" "Age" "Sex"
## [7] "RWA01" "RWA02" "RWA03"
## [10] "RWA04" "RWA05" "RWA06"
## [13] "RWA07" "RWA08" "RWA09"
## [16] "RWA10" "RWA11" "RWA12"
## [19] "RWA13" "RWA14" "RWA15"
## [22] "RWA16" "RWA17" "RWA18"
## [25] "RWA19" "RWA20" "RWA21"
## [28] "RWA22" "BeforeCricket" "BeforeCricketBar"
## [31] "Group" "AfterCricketBar" "AfterCricket"
## [34] "Comments" "Debrief" "RWAscore"
## [37] "CricketChange" "BarChange"
Some basic descriptive info on the data in numbers
library(psych)
describe(dat$Age)
## vars n mean sd median trimmed mad min max range skew kurtosis
## 1 1 352 35.24 11.82 34 34.41 13.34 18 68 50 0.52 -0.35
## se
## 1 0.63
describe(dat$BeforeCricket)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## 1 1 352 5.44 3.35 6 5.42 4.45 1 10 9 -0.03 -1.49 0.18
describe(dat$BeforeCricketBar)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## 1 1 352 6.86 3.07 8 7.18 2.97 1 10 9 -0.61 -1 0.16
describe(dat$AfterCricket)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## 1 1 352 5.64 3.4 6 5.67 4.45 1 10 9 -0.12 -1.51 0.18
describe(dat$AfterCricketBar)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## 1 1 352 7.33 3 8 7.76 2.97 1 10 9 -0.88 -0.57 0.16
describe(dat$RWAscore)
## vars n mean sd median trimmed mad min max range skew kurtosis
## 1 1 352 48.12 20.36 44 45.46 15.57 20 134 114 1.46 2.68
## se
## 1 1.09
describe(dat$CricketChange)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## 1 1 352 0.2 0.93 0 0.12 0 -5 6 11 0.94 13.37 0.05
describe(dat$BarChange)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## 1 1 352 1.89 2.21 1 1.63 1.48 -5 9 14 0.92 0.75 0.12
Back to the main page