Skip to content

Instantly share code, notes, and snippets.

View benwhalley's full-sized avatar

Ben Whalley benwhalley

  • Plymouth University
View GitHub Profile
@benwhalley
benwhalley / sleep.csv
Created October 11, 2023 12:35
sleep.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 10 columns, instead of 5. in line 5.
uniqueid,Start time,Completion time,My sleep is affected by my study commitments,I achieve good quality sleep,My electronic device usage negatively affects my sleep,Tiredness interferes with my concentration,"My sleep is disturbed by external factors e.g. loud cars, housemates, lights, children...",I often achieve eight hours of sleep,I regularly stay up past 11pm
60120734ec,2020-11-27T14:21:20Z,2020-11-27T14:22:47Z,Agree,Agree,Disagree,Strongly agree,Strongly agree,Disagree,Disagree
d0a92dec4b,2020-11-26T11:15:36Z,2020-11-26T11:16:37Z,Somewhat agree,Agree,Strongly agree,Somewhat agree,Disagree,Somewhat agree,Disagree
10eb3ee84d,2020-11-27T09:14:42Z,2020-11-27T09:18:33Z,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree
382eb4881a,2020-11-27T14:20:08Z,2020-11-27T14:22:10Z,Agree,Somewhat agree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Somewhat agree
371af06767,2020-11-27T14:24:28Z,2020-11-27T14:27:05Z,Somewhat agree,Somewhat di
@benwhalley
benwhalley / sweets.csv
Created October 11, 2023 12:29
example survey data
ID Start time Completion time Email Name How much do you like sweets? How much do you like chocolate Gender
6 2019-05-24T09:12:31Z 2019-05-24T09:12:35Z anonymous NA I don't like them I don't like them M
7 2019-05-24T09:12:31Z 2019-05-24T09:12:35Z anonymous NA I'm neutral I don't like them F
8 2019-05-24T09:12:31Z 2019-05-24T09:12:35Z anonymous NA I like them I'm neutral M
9 2019-05-24T09:12:31Z 2019-05-24T09:12:35Z anonymous NA I'm neutral I'm neutral F
Condition stimuli p RT
Low Stimulus 1 1 -10.728290804908085
Med Stimulus 1 1 313.6829804494978
High Stimulus 1 1 556.6156324888166
Low Stimulus 2 1 -80.6265931524629
Med Stimulus 2 1 560.3667345910135
High Stimulus 2 1 586.0361000228185
Low Stimulus 3 1 264.4697487435261
Med Stimulus 3 1 271.76747315203426
High Stimulus 3 1 267.13421840610965
category x y
D 55.384600000000006 97.1795
D 51.5385 96.02560000000001
D 46.153800000000004 94.4872
D 42.8205 91.4103
D 40.769200000000005 88.33330000000001
D 38.7179 84.87180000000001
D 35.641 79.87180000000001
D 33.0769 77.56410000000001
D 28.974400000000003 74.4872
Condition stimuli p RT
A S1 1 151.84776423196666
B S1 1 313.6829804494978
C S1 1 556.6156324888166
A S2 1 53.63154468977615
B S2 1 560.3667345910135
C S2 1 586.0361000228185
A S3 1 504.9853511354472
B S3 1 271.76747315203426
C S3 1 267.13421840610965
import random
import pandas as pd
def randomisesims():
stimA = list(range(1,91))
stimB = list(range(91,131))
random.shuffle(stimA)
random.shuffle(stimB)
return stimA[:40]+stimB[:20]
@article{henderson_stepwise_1989,
title = {Stepwise {Regression} in {Social} and {Psychological} {Research}},
volume = {64},
issn = {0033-2941},
url = {https://doi.org/10.2466/pr0.1989.64.1.251},
doi = {10.2466/pr0.1989.64.1.251},
abstract = {Researchers often invoke stepwise ordinary least squares regression to explain, predict or classify practical problems or theoretical constructs in psychological and social research. Unfortunately, this statistical technique is used without proper consideration for its inherent theoretical and practical limitations, a problem expected to grow even more serious with the proliferation of statistical packages for use on personal computers. Use of stepwise regression in social and psychological research is reconsidered here. Explanations of forward selection, backward elimination and combination stepwise procedures are provided; limitations of the technique, statistical and practical, are then addressed. Analysis shows that most of the current applic
[1] "3. Age"
[2] "4. Gender"
[3] "5. Height (cm eg, 168)"
[4] "6. Current Weight (kg eg, 66)"
[5] "7. The lowest adult weight that you have ever been from age of 18 onwards (kg eg, 50)"
[6] "8. Highest adult weight that you have ever been since the age of 18, excluding pregnancy (kg eg, 62)"
```{r}
expand.grid(person=1:5, trial=1:10) %>%
group_by(person) %>%
mutate(trialnumcreate = row_number()) %>%
ungroup() %>%
arrange(person,trial)
mtcars %>%