Midterm (1)

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

158

Subject

Statistics

Date

Feb 20, 2024

Type

pdf

Pages

13

Uploaded by GeneralSteel1537

Report
Stat 158 MIDTERM 2023-10-13 Kyle Abilar Student ID: 3037901752 Task 1. #Loading in the data df = read.csv ( "motivation.csv" , header = TRUE ) The units of this experiment are going to be the 96 workers in the call center. The conditions of this experiment have two main factors: conscious goal setting and non-conscious priming. Each has at least two levels: for the conscious goal setting: having half of the subjects assigned a monetary goal of $1200 while the other half is told is simply to do their best. For the non conscious priming: 1/3 of them receive packets with a color photo of a woman winning a race, 1/3 receive packets with a collage of achievements-realted photos, and the final 1/3 receive packets with no images. The response of this experiment is the amount of dollars raised by each employee during the 3 hour shift. There are two potential outcomes for conscious goal setting and three potential outcomes for non conscious priming which results in 6 potential outcomes. Since there are 96(N) employees in the study, the total potential outcomes is 96 x 6 = 576N. As long as the process of recording the amount of dollars is standardized and consistent, the response should be considered reliable. In this experiment, the amount of dollars raised is the direct measure of the subjects performance to reflect their efforts. There are factors such as experience in talking to people to get them to donate and even willingness of donors that can affect the results. However based on this experiment since we are just examining their efforts, this can be considered valid. 1
Task 2. If I was conducting this experiment I would assign every single person an id number from 1-96 in order, from who signed up first to the last. I assume that wouldn’t create any sort of bias due to signing up having no specific order. From there I would a random number generator in R to give which conscious goal groups the subjects will be put in such as using sample(1:96). I will run the random number generator three times and on the third time is when I’ll divide the subjects, the first 48 numbers will be group “Raise_1200” and the remaining will be assigned to “Do_Your_Best”. To get the priming groups I would use the same random generator three times and on the third time divide the subjects, first 32 numbers = “Photo_Backdrop”, the next 32 numbers = “Collage_Top, and finally the remaining will =”No_Image”. 2
Task 3. interaction.plot ( x.factor = df $ Conscious_Goal, trace.factor = df $ Priming, response = df $ Funds_Raised, main = "Interaction Plot" , xlab = "Priming" , ylab = "Amount Raised" , trace.label = "Conscious Goal" ) 400 800 1200 1600 Interaction Plot Priming Amount Raised Do_Your_Best Raise_1200 Conscious Goal Photo_Backdrop Collage_Top No_Image Based on this interaction plot we can see here that lines are mainly parallel to one another, indicating that there’s no interaction between the factors. However, there seems to be a slight indication that a photo back drop and collage top may have some interaction because the lines aren’t exactly parallel to eachother and slightlty touch. ggplot (df, aes ( x = Priming, y = Funds_Raised, fill = Conscious_Goal)) + geom_col () + coord_flip () 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Collage_Top No_Image Photo_Backdrop 0 10000 20000 30000 40000 Funds_Raised Priming Conscious_Goal Do_Your_Best Raise_1200 Based on this column graph we can see that using pictures in comparison to no pictures raised more overall money. We can also see that majority of that money was made up from subjects being told to raise $1200 in comparison to being told to do their best. ggplot (df, aes ( x = Priming, y = Funds_Raised)) + geom_point ( position = "dodge" ) + facet_wrap ( ~ Conscious_Goal) ## Warning: Width not defined ## i Set with ` position_dodge(width = ...) ` 4
Do_Your_Best Raise_1200 Collage_Top No_Image Photo_Backdrop Collage_Top No_Image Photo_Backdrop 0 1000 2000 3000 4000 Priming Funds_Raised From this dotplot we can see that again subjects that were given pictures raised more money in comparison to subjects that didn’t have any picutres. We can also see the distribution is the symmetrical for the conscious goal setting, however, subjects told to raise $1200(right side) earned more money. 5
Task 4. #Reporting the ANOVA table anova ( lm (Funds_Raised ~ Conscious_Goal * Priming, data = df)) ## Analysis of Variance Table ## ## Response: Funds_Raised ## Df Sum Sq Mean Sq F value Pr(>F) ## Conscious_Goal 1 11725026 11725026 51.631 1.878e-10 *** ## Priming 2 7204740 3602370 15.863 1.255e-06 *** ## Conscious_Goal:Priming 2 461927 230964 1.017 0.3658 ## Residuals 90 20438281 227092 ## --- ## Signif. codes: 0 ' *** ' 0.001 ' ** ' 0.01 ' * ' 0.05 ' . ' 0.1 ' ' 1 #Random inference df $ Conscious_Goal.Priming <- paste (df $ Conscious_Goal, df $ Priming, sep = ' . ' ) my_design <- declare_ra ( N = nrow (df), m_each = table (df $ Conscious_Goal.Priming), conditions = names ( table (df $ Conscious_Goal.Priming))) test_statistic <- function (dat){ split.Conscious_Goal.Priming <- apply ( matrix (df $ Conscious_Goal.Priming), 1 , function (x) strsplit (x, split = ' . ' , fixed = TRUE )[[ 1 ]]) dat $ Conscious_Goal <- as.factor (split.Conscious_Goal.Priming[ 1 ,]) dat $ Priming <- as.factor (split.Conscious_Goal.Priming[ 2 ,]) anova.tab <- anova ( lm (Funds_Raised ~ Conscious_Goal * Priming, data = dat)) return (anova.tab[ "Conscious_Goal:Priming" , "F value" ]) } ri_out <- conduct_ri ( test_function = test_statistic, declaration = my_design, assignment = ' Conscious_Goal.Priming ' , sharp_hypothesis = 0 , data = df, sims = 1000 ) summary (ri_out) ## term estimate two_tailed_p_value ## 1 Custom Test Statistic 1.017048 1 Since there were two facotrs I decided to use an ANOVA table to compare the differences between conscious goal and priming. The p-value for conscious goals and priming = 0.3658 > 0.05 indicating that there isn’t significant differences between the two. After performing random inference, I came up with a p-value of 1 which again indicates no significant difference between the two groups. Contrasts Contrasts 1: The effects of Conscious goal setting Going to be testing if employees with specific monetary goals, raise more money on average compared to those who are encouraged to do their best. 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Reasoning: This contrast provides insight into the overall impact of conscious goal-setting on performance, irrespective of non-conscious priming conditions. # Calculating the observed difference df_Conscious_Goal <- df %>% filter (Conscious_Goal == "Raise_1200" ) df_Do_Your_Best <- df %>% filter (Conscious_Goal == "Do_Your_Best" ) obs_diff <- mean (df_Conscious_Goal $ Funds_Raised) - mean (df_Do_Your_Best $ Funds_Raised) # Permutations for randomization inference n_permutations <- 1000 permuted_diffs <- numeric (n_permutations) for (i in 1 : n_permutations) { combined <- c (df_Conscious_Goal $ Funds_Raised, df_Do_Your_Best $ Funds_Raised) shuffled <- sample (combined) permuted_diffs[i] <- mean (shuffled[ 1 : 5 ]) - mean (shuffled[ 6 : 10 ]) } # P-value p_value <- sum ( abs (permuted_diffs) >= abs (obs_diff)) / n_permutations p_value ## [1] 0.092 contrast1 <- lm (Funds_Raised ~ Conscious_Goal, data = df) summary (contrast1) ## ## Call: ## lm(formula = Funds_Raised ~ Conscious_Goal, data = df) ## ## Residuals: ## Min 1Q Median 3Q Max ## -1075.00 -338.28 -76.04 224.22 2975.00 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 726.04 78.92 9.199 9.27e-15 *** ## Conscious_GoalRaise_1200 698.96 111.61 6.262 1.13e-08 *** ## --- ## Signif. codes: 0 ' *** ' 0.001 ' ** ' 0.01 ' * ' 0.05 ' . ' 0.1 ' ' 1 ## ## Residual standard error: 546.8 on 94 degrees of freedom ## Multiple R-squared: 0.2944, Adjusted R-squared: 0.2869 ## F-statistic: 39.22 on 1 and 94 DF, p-value: 1.128e-08 Contrasts 2: The effect of priming Testing if there’s a difference between the employees seeing photos vs no photos. Reasoning: This contrast explores the influence of a specific non-conscious priming condition on performance. # Calculating the observed difference photos <- df %>% filter (Priming == c ( "Collage_Top" , "Photo_Backdrop" )) nothing <- df %>% filter (Priming == "No_Image" ) obs_diff <- mean (photos $ Funds_Raised) - mean ((nothing $ Funds_Raised)) 7
# Permutations for randomization inference n_permutations <- 1000 permuted_diffs <- numeric (n_permutations) for (i in 1 : n_permutations) { combined <- c (photos $ Funds_Raised, nothing $ Funds_Raised) shuffled <- sample (combined) permuted_diffs[i] <- mean (shuffled[ 1 : 5 ]) - mean (shuffled[ 6 : 10 ]) } # P-value p_value <- sum ( abs (permuted_diffs) >= abs (obs_diff)) / n_permutations p_value ## [1] 0.158 contrast2 <- lm (Funds_Raised ~ Priming, data = df) summary (contrast2) ## ## Call: ## lm(formula = Funds_Raised ~ Priming, data = df) ## ## Residuals: ## Min 1Q Median 3Q Max ## -1006.3 -382.4 -73.4 271.9 3170.3 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 1229.69 104.70 11.744 < 2e-16 *** ## PrimingNo_Image -539.06 148.07 -3.641 0.000447 *** ## PrimingPhoto_Backdrop 76.56 148.07 0.517 0.606342 ## --- ## Signif. codes: 0 ' *** ' 0.001 ' ** ' 0.01 ' * ' 0.05 ' . ' 0.1 ' ' 1 ## ## Residual standard error: 592.3 on 93 degrees of freedom ## Multiple R-squared: 0.1809, Adjusted R-squared: 0.1633 ## F-statistic: 10.27 on 2 and 93 DF, p-value: 9.343e-05 Constrast 3: (Raise 1200 + Priming) vs (Do your best + No image) Testing if there’s a difference between people who seen the photo backdrop vs the collage Reasoning: This contrast helps determine whether the combination of setting specific goals and using the achievement-related collage has a unique impact on performance. # Calculating the observed difference rm <- df %>% filter (Priming == c ( "Photo_Backdrop" , "Collage_Top" ) & Conscious_Goal == "Raise_1200" ) dn <- df %>% filter (Priming == "No_Image" & Conscious_Goal == "Do_Your_Best" ) obs_diff <- mean (rm $ Funds_Raised) - mean (dn $ Funds_Raised) # Permutations for randomization inference n_permutations <- 1000 permuted_diffs <- numeric (n_permutations) for (i in 1 : n_permutations) { 8
combined <- c (rm $ Funds_Raised, dn $ Funds_Raised) shuffled <- sample (combined) permuted_diffs[i] <- mean (shuffled[ 1 : 5 ]) - mean (shuffled[ 6 : 10 ]) } # P-value p_value <- sum ( abs (permuted_diffs) >= abs (obs_diff)) / n_permutations p_value ## [1] 0.003 contrast3 <- lm (Funds_Raised ~ Conscious_Goal * Priming, data = df) summary (contrast3) ## ## Call: ## lm(formula = Funds_Raised ~ Conscious_Goal * Priming, data = df) ## ## Residuals: ## Min 1Q Median 3Q Max ## -740.62 -242.97 -35.94 153.91 2809.38 ## ## Coefficients: ## Estimate Std. Error t value ## (Intercept) 868.750 119.135 7.292 ## Conscious_GoalRaise_1200 721.875 168.483 4.285 ## PrimingNo_Image -437.500 168.483 -2.597 ## PrimingPhoto_Backdrop 9.375 168.483 0.056 ## Conscious_GoalRaise_1200:PrimingNo_Image -203.125 238.271 -0.852 ## Conscious_GoalRaise_1200:PrimingPhoto_Backdrop 134.375 238.271 0.564 ## Pr(>|t|) ## (Intercept) 1.14e-10 *** ## Conscious_GoalRaise_1200 4.58e-05 *** ## PrimingNo_Image 0.011 * ## PrimingPhoto_Backdrop 0.956 ## Conscious_GoalRaise_1200:PrimingNo_Image 0.396 ## Conscious_GoalRaise_1200:PrimingPhoto_Backdrop 0.574 ## --- ## Signif. codes: 0 ' *** ' 0.001 ' ** ' 0.01 ' * ' 0.05 ' . ' 0.1 ' ' 1 ## ## Residual standard error: 476.5 on 90 degrees of freedom ## Multiple R-squared: 0.4869, Adjusted R-squared: 0.4584 ## F-statistic: 17.08 on 5 and 90 DF, p-value: 7.595e-12 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Task 5. What I found is that the betweem conscious goal setting and non conscious goal setting, there wasn’t stastically strong enough evidence to prove that there was a difference between them. The data visualizations showed that overall, people that did receive photos or a specific goal raised more money, however, after performing inferences and contrasts we can see that the data suggests there they weren’t significantly different from eachother. This experiment design has it’s strengths and weaknesses. Some of it’s strengths were the use of randomization, which minizes bias and helps the validaty of the experiment. Manipulating both conscious and non-conscious goal setting allows you to observe the difference in perfromance between groups, which can strengthen the results of the inference. Having a balanced factorial design also makes it easier to examine the potenial interactions and relationship between the factors. Some weakness because there was no differination of experience, the results may be unable to generalize to all real world work environments to examine the affect of motiavtion. 96 people is a lot but still a small sample size to generalize the findings to a bigger population. The study was also examining the effects after a 3 hour shift, which can be completely different than the effects of motivation long term. Experimental designs allow you to make better causation and inferences, whereas an observation study can only show associations. The controlled environment and random assignment in experimental designs help minimize internal problems to validity. Observational studies often struggle to control for confounding factors, which can introduce bias and reduce the reliability of the results.Experimental designs can be replicated more easily, and the conditions can be more controlled. In observational studies, it can be challenging to replicate the exact conditions, leading to inconsistencies in results. Task 6. 1 potential blocking factor I thought would be beneficial would be blocking based on experience level. Employees with more experience in call centers can significantly affect their performance, therefore blocking by their experience level could’ve helped the results of this experiment. I would first divide the subjects into three groups: Block 1(beginner): less than 6 months of experience, Block 2(Intermediate): 6 months to a year of experience, Block 3(Experienced): Over a year of experience. Then I would assign everyone randomly into the groups as mentioned in question 2 using a random number generator. By including a block in this experiments allows you to better assess the impact of conscious goal-setting and non-conscious priming on employee performance. By examining treatment effects within different experience groups, the study’s findings may be more generalization to call centers with diverse levels of employee experience. Blocking will improve the precision of this study by reducing variability, which in turn increases the reliability of the results. 10
R code # #Loading in the data # df = read.csv("motivation.csv", header = TRUE ) # # Question 3: # # interaction.plot(x.factor = df$Conscious_Goal, # trace.factor = df$Priming, # response = df$Funds_Raised, # main = "Interaction Plot", # xlab = "Priming", # ylab = "Amount Raised", # trace.label = "Conscious Goal") # # # ggplot(df, aes(x = Priming, y = Funds_Raised, fill = Conscious_Goal)) + # geom_col() + # coord_flip() # # # ggplot(df, aes(x = Priming, y = Funds_Raised)) + # geom_point(position = "dodge") + # facet_wrap(~Conscious_Goal) # # # Question 4: # # #Report the ANOVA table # anova(lm(Funds_Raised ~ Conscious_Goal * Priming, data = df)) # # #Random inference # df$Conscious_Goal.Priming <- paste(df$Conscious_Goal, # df$Priming, sep = ' . ' ) # # my_design <- declare_ra(N = nrow(df), # m_each = table(df$Conscious_Goal.Priming), # conditions = names(table(df$Conscious_Goal.Priming))) # # test_statistic <- function(dat){ # split.Conscious_Goal.Priming <- apply(matrix(df$Conscious_Goal.Priming), 1, # function(x) strsplit(x, split = ' . ' , fixed = TRUE)[[1]]) # dat$Conscious_Goal <- as.factor(split.Conscious_Goal.Priming[1,]) # dat$Priming <- as.factor(split.Conscious_Goal.Priming[2,]) # anova.tab <- anova(lm(Funds_Raised ~ Conscious_Goal * Priming, data = dat)) # return(anova.tab["Conscious_Goal:Priming", "F value"]) # } # # # ri_out <- conduct_ri(test_function = test_statistic, # declaration = my_design, # assignment = ' Conscious_Goal.Priming ' , # sharp_hypothesis = 0, # data = df, 11
# sims = 1000) # # summary(ri_out) # # # # Calculating the observed difference # df_Conscious_Goal <- df %>% filter(Conscious_Goal == "Raise_1200") # df_Do_Your_Best <- df %>% filter(Conscious_Goal == "Do_Your_Best") # # obs_diff <- mean(df_Conscious_Goal$Funds_Raised) - mean(df_Do_Your_Best$Funds_Raised) # # # Permutations for randomization inference # n_permutations <- 1000 # permuted_diffs <- numeric(n_permutations) # for (i in 1:n_permutations) { # combined <- c(df_Conscious_Goal$Funds_Raised, df_Do_Your_Best$Funds_Raised) # shuffled <- sample(combined) # permuted_diffs[i] <- mean(shuffled[1:5]) - mean(shuffled[6:10]) # } # # # P-value # p_value <- sum(abs(permuted_diffs) >= abs(obs_diff)) / n_permutations # p_value # # contrast1 <- lm(Funds_Raised ~ Conscious_Goal, data = df) # summary(contrast1) # # # # Calculating the observed difference # photos <- df %>% filter(Priming == c("Collage_Top", "Photo_Backdrop")) # nothing <- df %>% filter(Priming == "No_Image") # # obs_diff <- mean(photos$Funds_Raised) - mean((nothing$Funds_Raised)) # # # Permutations for randomization inference # n_permutations <- 1000 # permuted_diffs <- numeric(n_permutations) # for (i in 1:n_permutations) { # combined <- c(photos$Funds_Raised, nothing$Funds_Raised) # shuffled <- sample(combined) # permuted_diffs[i] <- mean(shuffled[1:5]) - mean(shuffled[6:10]) # } # # # P-value # p_value <- sum(abs(permuted_diffs) >= abs(obs_diff)) / n_permutations # p_value # # contrast2 <- lm(Funds_Raised ~ Priming, data = df) # summary(contrast2) # # # # # Calculating the observed difference 12
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
# rm <- df %>% filter(Priming == c("Photo_Backdrop", "Collage_Top") & Conscious_Goal == "Raise_1200") # # dn <- df %>% filter(Priming == "No_Image" & Conscious_Goal == "Do_Your_Best") # # obs_diff <- mean(rm$Funds_Raised) - mean(dn$Funds_Raised) # # # Permutations for randomization inference # n_permutations <- 1000 # permuted_diffs <- numeric(n_permutations) # for (i in 1:n_permutations) { # combined <- c(rm$Funds_Raised, dn$Funds_Raised) # shuffled <- sample(combined) # permuted_diffs[i] <- mean(shuffled[1:5]) - mean(shuffled[6:10]) # } # # # P-value # p_value <- sum(abs(permuted_diffs) >= abs(obs_diff)) / n_permutations # p_value # # contrast3 <- lm(Funds_Raised ~ Conscious_Goal * Priming, data = df) # summary(contrast3) 13