I would like to compare the job satisfaction of part-time workers in the health industry and the financial industry. Should I do a t-test? How can I do this with R. Can I use stargazer to get a table for a word document?
Since the job satisfaction is categorical (scale 1 - 5), you should use a Chi-Square test instead of a t-test. There are a lot of tutorials out there about this, here is one.
If you like to output the results to a Word document, I suggest you write the code in an R Markdown file and knit it to word.That should be easiest.
Categorical data suggests the data may not be used in arithmetic as in means or SD. If 1=likes very much, and 2=likes somewhat, what does its average represent?
The chi-square test allows us to compare an actual distribution with an expected distribution. I think ibn your case it would be OK to call one of your actual distributions an expected distribution, although perhaps someone with more stats knowledge may need to correct me. I think both distributions should be proportions, as in 25% of the data is in category one, etc.
I'd like to follow-up even more. A chi-square test tests whether the distribution is different. Since these are ordinal data, I'd suggest a Kruskal Wallis test.
Thanks for all your answers. This is very kind.
I am still a beginner. My professor told me to do a t-test to keep things simple.
I am well aware that a different method would be more appropriate.
How do I have to code a two sample t-test with R with the variable in my question and my csv file?
How do I have to code this with my variables IND, EMP and pv1?
I wand to compare the job satisfaction (pv1) of part-time workers (EMP=2) of the two industries (IND=12 and IND=17).
My x's are your pv1's for IND=12. My y's are your pv1's for IND=17.
If you are only interested in EMP=2, but you have other values of EMP, then you want to remove these other values from the data that you are t testing. If the EMPs are in a separate column, you could use the subset command to delete them
I would like to compare the job satisfaction of part-time workers in the health industry and the financial industry.
Should I do a t-test?
How can I do this with R. Can I use stargazer to get a table for a word document?
Variables
IND
12 = Financial industry (161 observations)
17 = Health industry (151 observations)
pv1 (Job satisfaction)
scale from 1 to 5 (I treat this as a continuous numerical variable. I know that this is controversial)
Thanks for your answer. But I don't understand this code at all
Moreover I have to change the description into german. Is it possible to change it in a word document?
Maybe with stargazer?
---
title: "wordstarg"
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
## Including Plots
You can also embed plots, for example:
```{r, results='asis'}
t.test(1:10, y = c(7:20)) %>%
broom::tidy() %>% flextable::flextable() %>% flextable::colformat_num(digits=2)
```