100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Samenvatting

Samenvatting Statistics for Psychologists, part 3 + R cheatsheet

Beoordeling
-
Verkocht
-
Pagina's
15
Geüpload op
22-05-2025
Geschreven in
2024/2025

Samenvatting van alle hoofdstukken en simulations. Gemaakt voor het schakelprogramma van de master Psychologie voor het vak Statistics for Psychologists, part 3 voor de examenperiode van juni 2025. Zie de tags voor de verschillende onderwerpen. Het document heeft 14 bladzijdes en is gemaakt in mijn gebruikelijke sjabloon (gebruik van kleur en meestal volzinnen, maar een duidelijke structuur). Hierin staat de absolute theoretische basis van het vak, maar met de samenvatting te kopen krijg je ook toegang tot mijn cheatsheet voor R, een zeer uitgebreid en gedetailleerde opsomming en uitleg van alle nodige codes. Vergeet dus zeker geen oefeningen te maken. Let op! Deze samenvatting is in het Engels (net als het vak).

Meer zien Lees minder









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Documentinformatie

Geüpload op
22 mei 2025
Aantal pagina's
15
Geschreven in
2024/2025
Type
Samenvatting

Voorbeeld van de inhoud

STAT3 – juni 2025 1




INTRODUCTION TO R

SIMPLE CALCULATIONS

ORDER OF OPERATION
R uses the BEDMAS order of operation:
1) Brackets ()
2) Exponents ^
3) Division / and Multiplication *
4) Addition + and Subtraction -
 If we want to force R to calculate, for example, the addition in a command first, we have to enclose it in
brackets

For operations on the same level (e.g. division and multiplication), R will go from left to right

VARIABLES
= a label for a certain piece of information, or even several different pieces of information
- To assign a value to a variable, we use the assignment operator <-, e.g. sales <- 350
• We can also use -> or = (e.g. 350 -> sales), but these are used less
▪ Be mindful of directionality! -> or <- point towards the variable, not the value, and only variable =
value works (not value = variable)
• This does not provide any output, but R will process this internally
• We can, however, check by typing the name of the variable and running this code
- R lets us overwrite, meaning that assigning a new, different value to the previously set variable name will
erase the memory of the first value
- We can do calculations with variables, e.g. sales * royalty will result in the same output as multiplying their
values alone
- Disclaimer: you cannot use spaces in variable names

VECTORS
= a variable that can store multiple values
- To assign multiple values to a variable, we use the combine function c(), e.g. sales.by.month <- c(0, 100,
200, 50, 0, 0, 0, 0, 0, 0, 0, 0)
• This creates a single variable that is a vector containing a number of elements
• The combine function can also be used with vectors, e.g. sales.by.month.extended <- c(sales.by.month,
99)
- To extract information from a vector (e.g. the number of sales in the month of February), we use square
brackets [], e.g. sales.by.month[2] will result in an output of 100
• We can also use the square brackets to alter elements of a vector, e.g. sales.by.month[5] <- 25
• We can add negative indices to remove certain elements, e.g. sales.by.month[-(2:3)] OR
sales.by.month[-c(2,3)] removes elements 2 to 3 in a vector
• We can use the logical operator !=, e.g. salesbymonth[sales.by.month != 0] removes all 0 sales
- We can shorthand a continuous vector by using : , e.g. 2:8 is the same as c(2, 3, 4, 5, 7, 8)
• This can be used both for assigning elements to a vector, altering or extracting information from it
• When replacing information, be aware of the amount of numbers you want replaced and the amount
of numbers in your input, e.g. sales.by.month[1:3] <- c(9, 19) tells R to replace the first three numbers
but only provides two, resulting in an error
• But beware that R does have a recycling rule! E.g. sales.by.month[1:4] <- c(9, 19) WILL work as it uses
“9” as a replacement for both the 1st and 3rd value

, STAT3 – juni 2025 2


- When we multiply/add/subtract/divide/take powers of a vector by a single number, all elements in the
vector get multiplied/added/subtracted/divided/taken powers of
- To quickly find out how many elements a vector has, use the length() function

The recycling rule means that R “recycles” the value of the shorter vector several
times, e.g. when y has a length of 2, as compared to x with a length of 6, then the
third element of x is added to the first element of y again and so on
- This rule also applies for subtraction, multiplication and division
- If the length of the longer vector is not an exact multiple of the length of the
shorter one (e.g. 5 and 2), R will still do it but give us a warning

WARNINGS AND ERRORS
Both errors and warning signal something is off
- When R throws an error, R couldn’t do what we asked it to do, so it stopped, producing no output
- With a warning, it powered through and produced output, but it thinks something could be off, so we
should look at the code and the output with extra care

LOGICAL DATA
A logical value is an assertion about whether something is true or false
- We can test this using the equality operator ==, e.g. 2 + 2 == 4 → TRUE
• This is different from the assignment operator = !
- R will output either TRUE or FALSE
- We can also assign the value directly, e.g. is.it.correct <- TRUE
• We can even shortcut using T and F (but only in capitals)
- We can also both assign logical values in a vector as use the equality operator to extract logical values from
a vector
- It is possible to use logical values in numerical operations, where true will change to a value of 1 and false
to a value of 0

OTHER LOGICAL OPERATORS




In the or operator, at least one of the statements needs to be true for R to return a TRUE-value

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Mellowerillish Katholieke Universiteit Leuven
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
151
Lid sinds
7 jaar
Aantal volgers
55
Documenten
37
Laatst verkocht
4 uur geleden

Ik ben een studente van 25 jaar oud en ik verdien heel graag een centje meer. Al sinds de middelbare school deel ik vaak mijn samenvattingen met medeleerlingen in mijn klas, die ze altijd voor testen en examens gebruiken. Ik bied samenvattingen aan van mijn vorige opleidingen (Kleuteronderwijs aan de UCLL in Heverlee, en verkort traject Toegepaste Psychologie aan de Thomas More in Antwerpen) en van mijn huidige opleiding (schakel/master Psychologie aan de KU Leuven). Hou er rekening mee dat leerstof kan variëren met de jaren en lectoren; mogelijks komen oudere samenvattingen niet helemaal meer overeen met jouw leerstof. Kijk goed de tags na als het gaat om een ouder bestand. Aarzel niet om me een berichtje te sturen met vragen, feedback of opmerkingen! Als een freebie: hier de link naar mijn quizlet pagina met een flashcard set per vak van het schakelprogramma psychologie. Wachtwoord: quizlet

Lees meer Lees minder
4,4

12 beoordelingen

5
6
4
5
3
1
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen