Question
d$satisfaction %in% c(5,6,7) mean(d$satisfaction %in% c(5,6,7)) d$satisfaction[d$assigned_sex==male] mean(d$satisfaction[d$assigned_sex==male] %in% c(5,6,7)) I am trying to create a function here to compare the difference in means, but
d$satisfaction %in% c(5,6,7) mean(d$satisfaction %in% c(5,6,7)) d$satisfaction[d$assigned_sex=="male"] mean(d$satisfaction[d$assigned_sex=="male"] %in% c(5,6,7))
I am trying to create a function here to compare the difference in means, but when I run the results567 line, I only get the first row value and the next 9999 values are NA, but they are supposed to be randomized values. Any help would be appreciated as to why this permutation test is not running correctly.
Function:
get.assigned.sex.diff567 <- function(x){ male.score567 <- mean(d$satisfaction[d$assigned_sex=="male"] %in% c(5,6,7)) female.score567 <- mean(d$satisfaction[d$assigned_sex=="female"] %in% c(5,6,7)) return(male.score567 - female.score567)}
actual.value567 <- get.assigned.sex.diff567(d)
n.sim <- 9999
results567 <- tibble(statistic = c(actual.value567, rep(NA,n.sim)))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started