Week 7 workbook and solutions

Joseph Bulbulia https://josephbulbulia.netlify.app (Victoria University of Wellington)https://www.wgtn.ac.nz
04-27-2021

Import the jittered NZAVS dataset:

# read data

nz_0 <- as.data.frame(readr::read_csv2(
  url(
    "https://raw.githubusercontent.com/go-bayes/psych-447/main/data/nzj.csv"
  )
))


# to relevel kessler 6 variables
f <-
  c(
    "None Of The Time",
    "A Little Of The Time",
    "Some Of The Time",
    "Most Of The Time",
    "All Of The Time"
  )

# get data into shape
nz <- nz_0 %>%
  dplyr::mutate_if(is.character, factor) %>%
  select(
    -c(
      SWB.Kessler01,
      SWB.Kessler02,
      SWB.Kessler03,
      SWB.Kessler04,
      SWB.Kessler05,
      SWB.Kessler06
    )
  ) %>%
  dplyr::mutate(Wave = as.factor(Wave)) %>%
  mutate(FeelHopeless = forcats::fct_relevel(FeelHopeless, f)) %>%
  mutate(FeelDepressed = forcats::fct_relevel(FeelDepressed, f)) %>%
  mutate(FeelRestless = forcats::fct_relevel(FeelRestless, f)) %>%
  mutate(EverythingIsEffort = forcats::fct_relevel(EverythingIsEffort, f)) %>%
  mutate(FeelWorthless = forcats::fct_relevel(FeelWorthless, f)) %>%
  mutate(FeelNervous = forcats::fct_relevel(FeelNervous, f)) %>%
  dplyr::mutate(Wave = as.factor(Wave)) %>%
  dplyr::mutate(male_id = as.factor(Male)) %>%
  dplyr::mutate(date = make_date(year = 2009, month = 6, day = 30) + TSCORE)%>%
  dplyr::filter(Wave == 2019)
dplyr::glimpse(nz)
Rows: 2,560
Columns: 82
$ Id                          <dbl> 2, 4, 6, 7, 9, 12, 14,…
$ Wave                        <fct> 2019, 2019, 2019, 2019…
$ years                       <dbl> 10.09446, 10.60917, 10…
$ Age                         <dbl> 69.82957, 48.49350, 36…
$ Male                        <fct> Male, Male, Male, Not_…
$ Gender                      <dbl> 1, 1, 1, 0, 0, 0, 1, 0…
$ w.GendAgeEthnic             <dbl> 1.0999955, 3.6685922, …
$ Edu                         <dbl> 4, 7, 7, 7, 8, 4, 9, 1…
$ Partner                     <dbl> 1, 1, 1, 0, 0, 1, 1, 1…
$ BornNZ                      <dbl> 0, 1, 1, 1, 1, 1, 1, 1…
$ Employed                    <dbl> 0, 1, 1, 1, 0, 1, 1, 1…
$ BigDoms                     <fct> Not_Rel, Not_Rel, Not_…
$ TSCORE                      <dbl> 3748, 3936, 3749, 3749…
$ GenCohort                   <fct> Gen Boombers: born >= …
$ Hours.Exercise              <dbl> 4, 7, 1, 10, 7, 4, 5, …
$ Hours.Work                  <dbl> 0.0, 35.0, 35.0, 40.0,…
$ Hours.News                  <dbl> 6.0, 5.0, 5.0, 1.0, 15…
$ Hours.Internet              <dbl> 24.0, 14.0, 20.0, 25.0…
$ Hours.SocialMedia           <dbl> 0.0, 0.0, 5.0, 5.0, 4.…
$ HoursCharity                <dbl> 0, 0, 0, 0, 2, 0, 0, 0…
$ Hours.CompGames             <dbl> 0, 0, 5, 0, 10, 5, 0, …
$ Hours.Family                <dbl> 10.0, 0.0, 0.0, 3.0, 5…
$ Hours.Friends               <dbl> 0.0, 0.0, 5.0, 3.0, 1.…
$ Hours.Community             <dbl> 0, 0, 0, 3, 0, 0, 0, 0…
$ Hours.Religious             <dbl> 0, 0, 0, 0, 0, 0, 0, 0…
$ CharityDonate               <dbl> 0, 300, 5, 50, 500, 0,…
$ Family.Money                <dbl> 0, 0, 0, 0, 0, 0, 0, 0…
$ Friends.Money               <dbl> 0, 0, 0, 0, 0, 0, 0, 0…
$ Community.Money             <dbl> 0, 0, 0, 0, 0, 0, 0, 0…
$ Family.Time                 <dbl> 0, 4, 0, 0, 0, 0, 0, 0…
$ Friends.Time                <dbl> 0, 10, 0, 0, 0, 0, 0, …
$ Community.Time              <dbl> 0, 10, 0, 0, 0, 0, 0, …
$ Household.INC               <dbl> 39000, 35000, 140000, …
$ Issue.IncomeRedistribution  <dbl> 3, 4, 7, 7, 7, 5, 5, 7…
$ Religion.Church             <dbl> 0, 0, 0, 0, 0, 0, 0, 0…
$ Religion.Believe.Cats       <dbl> 4, 1, 4, 1, 4, 3, 3, 3…
$ Relid                       <dbl> 0, 0, 0, 0, 0, 0, 0, 0…
$ HLTH.Fatigue                <dbl> 0, 1, 1, 1, 0, 0, 0, 0…
$ HLTH.SleepHours             <dbl> 8.0, 6.0, 7.5, 7.0, 8.…
$ HLTH.BMI                    <dbl> 26.23457, 35.06209, 22…
$ HLTH.Weight                 <dbl> 85, 120, 72, 77, 91, 6…
$ HLTH.Height                 <dbl> 1.80, 1.85, 1.80, 1.76…
$ HomeOwner                   <dbl> NA, NA, NA, NA, NA, NA…
$ Pol.Orient                  <dbl> 4, 5, 1, 2, 2, 4, 3, 4…
$ PATRIOT                     <dbl> 5.0, 6.5, 7.0, 6.0, 7.…
$ Env.SatNZEnvironment        <dbl> 9, 7, 5, 2, 6, 4, 6, 5…
$ Env.MotorwaySpend           <dbl> 4, 3, 3, 4, 4, 6, 6, 7…
$ Env.PubTransSubs            <dbl> 4, 5, 7, 6, 7, 5, 5, 7…
$ Env.ClimateChgConcern       <dbl> 4, 7, 7, 7, 6, 5, 7, 7…
$ LIFEMEANING                 <dbl> 4.0, 5.0, 6.5, 7.0, 7.…
$ Issue.GovtSurveillance      <dbl> 4, 3, 2, 2, 2, 7, 4, 7…
$ Issue.RegulateAI            <dbl> NA, NA, NA, NA, NA, NA…
$ CONSCIENTIOUSNESS           <dbl> 4.00, 5.50, 5.00, 5.00…
$ EXTRAVERSION                <dbl> 4.25, 4.75, 2.25, 5.00…
$ AGREEABLENESS               <dbl> 3.50, 5.00, 5.25, 6.50…
$ OPENNESS                    <dbl> 3.50, 4.25, 6.00, 6.50…
$ Religious                   <fct> Not_Religious, Not_Rel…
$ Spiritual.Identification    <dbl> NA, NA, NA, NA, NA, NA…
$ Believe.God                 <fct> Not Believe God, Belie…
$ Believe.Spirit              <fct> Not Believe Spirit, Be…
$ Your.Personal.Relationships <dbl> 10, 2, 10, 9, 7, 8, 8,…
$ Your.Future.Security        <dbl> 9, 8, 9, 8, 9, 8, 8, 8…
$ Standard.Living             <dbl> 10, 8, 9, 8, 10, 10, 8…
$ NZ.Economic.Situation       <dbl> 9, 2, 9, 2, 7, 5, 6, 5…
$ NZ.Social.Conditions        <dbl> 8, 2, 6, 2, 3, 4, 6, 5…
$ NZ.Business.Conditions      <dbl> 8, 2, 9, 2, 5, 8, 5, 4…
$ Emp.JobSecure               <dbl> NA, 6, 7, 4, NA, 6, 5,…
$ Emp.JobSat                  <dbl> NA, 6, 7, 6, NA, 7, 7,…
$ Emp.JobValued               <dbl> NA, 6, 7, 5, NA, 5, 6,…
$ Issue.Food.GMO              <dbl> 4, 5, 7, 7, 1, 4, 4, 7…
$ Env.SacMade                 <dbl> NA, NA, NA, NA, NA, NA…
$ KESSLER6sum                 <dbl> 0, 7, 0, 3, 4, 6, 0, 3…
$ POLICE.ENGAGE               <dbl> 4.0, 3.5, 6.0, 6.0, 7.…
$ POLICE.TRUST                <dbl> 4.333333, 4.333333, 6.…
$ FeelHopeless                <fct> None Of The Time, A Li…
$ FeelDepressed               <fct> None Of The Time, None…
$ FeelRestless                <fct> None Of The Time, Most…
$ EverythingIsEffort          <fct> None Of The Time, A Li…
$ FeelWorthless               <fct> None Of The Time, None…
$ FeelNervous                 <fct> None Of The Time, Some…
$ male_id                     <fct> Male, Male, Male, Not_…
$ date                        <date> 2019-10-04, 2020-04-0…

Assessment

Information

Link to the NZAVS data dictionary is here

Link to questions only here

Task

  1. Select up to five variables from Wave 11 (2019) NZAVS jittered dataset.

  2. Briefly describe your variables. Use graphs and tables as you deem helpful.

  3. Write a single co-variate regression model with a continuous outcome. Interpret your results, using graphs and tables as you deem helpful.

  4. Write a multiple co-variate regression model and interpret your results, using graphs and tables as you deem helpful.

Marking criteria

  1. Clarity and organisation in the descriptive component of your work.

  2. Clarity and organisation in description of your regression model.

  3. Accuracy and insight in the interpretation of your regression model.

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY-NC-SA 4.0. Source code is available at https://go-bayes.github.io/psych-447/, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Bulbulia (2021, April 27). Psych 447: Week 7 workbook and solutions. Retrieved from https://vuw-psych-447.netlify.app/workbooks/W_7_s/

BibTeX citation

@misc{bulbulia2021week,
  author = {Bulbulia, Joseph},
  title = {Psych 447: Week 7 workbook and solutions},
  url = {https://vuw-psych-447.netlify.app/workbooks/W_7_s/},
  year = {2021}
}