100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Summary

Samenvatting Onderzoekstraining 2 - Formule overzicht in R

Rating
-
Sold
-
Pages
12
Uploaded on
22-09-2025
Written in
2025/2026

Dit document bevat een overzicht van de belangrijkste formules in de R-taal die gebruikt worden in Onderzoekstraining 2. Helpt bij het toepassen van statistische toetsen en analyses in R, met compacte en overzichtelijke notatie.

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
September 22, 2025
Number of pages
12
Written in
2025/2026
Type
Summary

Subjects

Content preview

#rm(list=ls())

Voorbeeld:

Ok <- c(15, 20, 20, 25, 20)

Ek <- c(10, 15, 20, 15, 40)

p <- c(0.10, 0.15, 0.20, 0.15, 0.40)

n <- 100



p bij uniform verdeeld <- 1 / aantal keuzemogelijkheden

Ek (verwachte frequenties)

Ek <- n * p

#of EK = (totaal Y rij * totaal X rij / (totaal n beide rijen)

Waargenomen toetsgrootheid Pearson voor steekproef (Y_obs)

sum((Ok - Ek)^2 / Ek)

Waargenomen toetsgrootheid Yates (Gebruiken wanner tabel 2 bij 2 waarnemingen is)

sum((abs(Ok-Ek)-0.5)^2 / Ek)



Ek met kruisttabel voor totalen gebruiken minimaal verwachte celfrequentie

tbl <- matrix(c(76, 70, 133, 74, 74, 127, 17, 15),

nrow = 4, byrow = TRUE)

#chisq.test(tbl) <- uitvoeren voor de chisq uit de tbl

row_total <- rowSums(tbl)

col_total <- colSums(tbl)

grand_total <- sum(tbl)

#Verwachte frequenties berekenen voor tbl:

expected <- outer(row_total, col_total) / grand_total

#afronden en laden

round(expected, 2) <- Yobs



phi <- sqrt(Yobs / n)

#Meet de mate van samenhang

#Is hetzelfde als Cramers V

, #Berekent Pearson's chi2 met als input O en E.

Pearson<-function(O,E,alpha,df){

#Input moet worden gegeven als vector, dus O<-c(1,4,3,...)

#df = aantal waarnemingen -1

if (length(O)!=length(E)){

print("Ongelijk aantal elementen voor O en E.")

}

else{

Chi<-0

for (i in 1:length(O)){

Chi<-Chi+(O[i]-E[i])^2/E[i]

}

}

krit<-qchisq(p=1-alpha,df=df)

if(Chi>=krit){print("Verwerp H0")}

else{print("Verwerp H0 niet")}

return(c(Chi,krit))

}
$6.75
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
maxvandenengel

Also available in package deal

Get to know the seller

Seller avatar
maxvandenengel Christelijke Hogeschool Ede
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions