联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Web作业Web作业

日期:2025-02-10 11:16

Data Analysis Assignment

PS931 - Bayesian Approaches to Behavioural Science

Spring Term 2025 (updated: 2024-11-27)

This assessment counts for 42% of your overall grade.

Submission Instructions: Submit your solution as one html or pdf document containing both R code, R output, figures, and written text (i.e., full sentences) to Tabula as “Data Analysis Assignment”, by midday (12 noon), Monday, 17th February 2025 .

•  Please use RMarkdown to create the document.

Important: Your document should be called YOUR-STUDENT-ID_daa  (followed by the correct file extension). Please also add your student ID to the top of the document.  To enable anonymous marking, please refrain from using your name in either the document script or the file name.

•  Your text does not need to contain references (i.e., references to scientific papers).

General Guidelines

There are two tasks. Your answers should have two separate sections for each task, one immediately after the other.

In the first section, write out your answers using complete sentences, as you would for the results section of a paper. Include descriptive statistics in the text, tables or figures, as appropriate.  Tables and figures should be of publication quality (i.e., fully labelled, etc.). Integrate inferential statistics into your description of the results. Your answers might be quite short. Given the validity of the statistical analysis, the first section will play the main role for your mark.

The second section should include the complete R code that you used and its output. Add comments (using  a #) to explain what the code does.  The code should show all of the commands that you used; enough to  replicate exactly what you did (I will be copying and pasting code to run checks, so make sure that works). You can include additional figures in the second section that you used to explore the data, which you do not  wish to include in the first section. I will use the second section to help identify the source of any mistakes. For practical reports and papers you would only submit the first section; thus the first section should stand  alone without requiring the reader to refer to the second section.

To help ensure that the instructions about the answer format are clear, before turning to your assignment tasks, we first provide an example question and an answer that covers the key aspects.  Note that the example answer shows both parts, as is required from you.

Example Question

Does mere exposure to a stimulus improve its attractiveness? In an initial stage, participants were exposed to  a series of pseudowords. Words were exposed for very short durations with a mask.  (Pilot work established that participants were unable to report whether or not a word was presented before the mask in these conditions.)  In a second phase, a mixture of the old, exposed, pseudowords and new, previously unseen, pseudowords were presented.  Participants could view each word for as long as they liked before rating their liking for the word on a 1-10 scale.  Using the data set mere_exposure .csv, test the hypothesis that mere exposure increases the attractiveness of pseudowords.

Example Answer

Section 1 (example)

To investigate whether exposure to a word improves its attractiveness,  32 participants took part in an experiment in which their main task was to rate the attractiveness of pseudowords on a 1-10 scale.  Before the main task, participants were shown half of the pseudowords for a very short duration so that they could not perceive them consciously.  Figure  1 shows the distribution and means of the attractiveness ratings and suggests that pre-exposed pseudowords (i.e., those shown briefly before the main task) were rated as more attractive than new, previously unseen, pseudowords.  We analysed the attractiveness ratings using an ANOVA with a single repeated-measures factor exposure  (old versus new).  The difference in ratings (difference = 1.82, SE = 0.12) was significant, F (1, 31) = 228.33, p < .001, BF10 > 4.9x1012 .

Figure 1 . Attractiveness ratings of pseudowords as a function of prior exposure.  Points in the background show the raw data (overlapping points are offset on the x-axis), black points in the foreground show the mean, error bars show 95% within-subjects confidence intervals.

Section 2 (example)

library ("tidyverse")

library ( "afex")

library ( "emmeans")

mere_exposure  <- read_csv ( "mere_exposure.csv")

glimpse(mere_exposure)

#>  Rows: 32

#> Columns: 3

#> $ id <dbl>  1, 2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, ~

#> $ old_ liking <dbl>  7.4,  6 .5,  6 .8,  7.8,  6 .9,  9.2,  6.2,  7.9,  6 .5,  9 . 1,  7. 6,  8 . 6,~

#> $ new_ liking <dbl> 5.6,  5.4, 3.4, 5.2,  6.1, 8.0, 4.4,  6.1, 3.1,  6.4,  6 . 1,  7.8,~

me_tidy  <- mere_exposure %>%

pivot_longer(cols  = -id,  names_to  =  "Exposure" ,  values_to  =  "Attractiveness") %>%

mutate (Exposure  = factor(Exposure),  id  = factor (id))

str (me_tidy)

#>  tibble  [64  x 3] (S3:  tbl_df/tbl/data.frame)

#>   $ id : Factor w/ 32 levels "1","2","3","4", . . :  1  1  2  2  3  3 4 4  5 5  . . .

#>   $ Exposure : Factor w/ 2 levels "new_ liking","old_ liking":  2  1  2  1  2  1  2  1  2  1  . . .

#>   $ Attractiveness: num [1:64] 7.4  5.6  6.5  5.4  6.8  3.4  7.8  5.2 6 .9  6 . 1  . . .

me_tidy %>%

group_by(Exposure) %>%

summarise (mean  = mean (Attractiveness),

sd  = sd(Attractiveness))

#>  # A tibb le:  2  x  3

#>      Exposure mean s d

#> <fct> <dbl>  <dbl>

#>  1 new_ liking 5.74    1.34

#> 2 old_ liking 7.56 1 . 01

ggplot(me_tidy, aes (Attractiveness)) +

geom_histogram() +

facet_wrap (~Exposure)

(a1  <- aov_ez (id  =  "id" ,  dv  =  "Attractiveness" , me_tidy,  within  =  "Exposure"))

#> Anova Table (Type 3 tests)

#>

#> Response: Attractiveness

#> Effect df MSE F g es  p .value

#>  1 Exposure 1,  31 0.23  228 .33  ***   .377 < . 001

#> - - -

#> Signif. codes:    0 ' *** '  0.001   ' ** '  0.01 ' * '  0.05 ' + '  0.1   '   '  1

(a2  <- anovaBF(Attractiveness ~ Exposure + id,  data  = data.frame (me_tidy),  whichRandom  =  "id"))

#> Bayes factor analysis

#> - - - - - - - - - - - - - -

#> [1] Exposure + id :  4 .822112e+12 ±0.85%

#>

#> Against  denominator:

#>     Attractiveness ~ id

#> - - -

#> Bayes factor  type: BFlinearModel,  JZS

pairs (emmeans (a1,  "Exposure"))

#> contrast estimate     SE  df  t .ratio p .value

#> new_ liking - old_ liking -1 .82 0 . 12  31 -15 . 110    < . 0001

afex_plot(a1,  "Exposure" ,  error  =  "within" ,

factor_levels  = list (Exposure  = c("Old" ,  "New")),

data_arg  = list (cex  =  3.5 ,  color  =  "darkgrey"))

Task 1

Decision making is fundamentally noisy, and experimental participants will often make different choices between the same two risky alternative even during the same experimental session. An interesting question is why choices are inconsistent:  is it because participants’ decisions are just inherently noisy?  Or perhaps is it because participants’ deterministic preferences are dynamically changing throughout the experiment, and so they only appear to be stochastic?

To test whether participants’ preferences are dynamically changing it is possible to manipulate the amount of time (i.e., number of intervening trials) between repeated choices. If participants’ preferences are dynamically changing, we would expect that for shorter intervals between repeated choices that participants would make more consistent decisions compared to the consistency for longer intervals.

The file consistency .csv contains simulated data about choice consistency, where participants were split at random to repeat choices at different intervals (variable Interval), where the interval is the number of intervening trials.  Participants (variable id) completed a long series of choices between two alternatives with the repetitions of various alternative pairs hidden within this series.  The variable Consistency gives the proportion of repeated choices for which a participant made the same choice across the two repetitions.

Please analyse the data using both frequentist and Bayesian linear regression models.  The main research question is whether choice consistency decreases with longer intervals. For this task only, please implement your Bayesian linear regression using a variety of R-based implementations and priors, including AIC and BIC, and compare your results for robustness across these implementations and priors.

Present the results as you would in a paper, using APA format.  In other words, describe your statistical model and results and describe the conclusions with regards to the research questions. In the first section of your answer for this task, include only one figure (which may contain multiple panels), with an appropriate figure caption.

Task 2

How does the nature of decision making depend change with repeated experience?  Certainly feedback will influence people’s later decisions, but do decisions change even without feedback?  One possibility is that people become more normative with repeated experience: that their choices correspond more to expected utililty theory.  That is, for Alternative A with a pA1  probability of outcome xA1  and a pA2  probability of outcome xA2, people will (at least implicitly) convert this into an expected utility. If we assume a power law utility function with exponent 0.5, then E(uA ) = pA1(xA1)0.5 + pA2(xA2)0.5 .  Then E(uA ) is compared with the similarly calculated E(uB ), and the alternative with the higher expected utility is chosen.

Another possibility is that choices become more heuristic with practice: that they alight on simple rules for making choices that allow for effective performance with little effort.  For example, people may begin to rely more on simple features of the options that allow them to decide between them.  One simple heuristic would be to avoid the option that has the lowest possible reward.  So for Alternative A, this heuristic value would be hA  = min(xA1, xA2), for Alternative B the heuristic value would be hB  = min(xB1, xB2), and people would choose Alternative A if hA  > hB .  This heuristic will often correspond to expected utility, but will not always do so.

The file repeated_choice .csv contains experimental data from a repeated measures factorial experiment  that investigated how choices changed with repeated experience with the choices.  Participants ( id) were  presented with pairs of alternatives, each with different probabilities of two possible rewards, as above.  There  were 75 alternative pairs in the experiment, and participants were presented with all 75 pairs in each block. Over the course of several days, participants completed 6 blocks (Block) of the experiment.  For each block we calculated as a dependent variable the proportion of trials that matched the predictions of expected  utility (ExpectedUtilityMatch) and the proportion of trials that matched the predictions of the lowest value  heuristic (LowestValueMatch).

Please analyse the data using both a frequentist and Bayesian ANOVA (e.g., using afex and BayesFactor), using post-hoc tests where appropriate, and present the results as you would for a paper, using APA format. In other words, describe your statistical model and results and describe the conclusions with regard to the  research question.  Be careful not to draw unwarranted causal conclusions. In the first section for this task, include only one figure (which may contain multiple panels), with an appropriate figure caption.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp