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

Samenvatting R-Codes voor Statistiek II

Rating
5.0
(1)
Sold
3
Pages
15
Uploaded on
16-05-2021
Written in
2020/2021

Dit is een overzicht van alle R-codes die nodig zijn om de oefeningen te maken van Statistiek II

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
May 16, 2021
Number of pages
15
Written in
2020/2021
Type
Summary

Subjects

Content preview

HOOFDSTUK 1: DATA MANIPULATIE
vector aanmaken leeftijd < - c (18, 22, 17, 19, 19 )

Basis code's > mean(leeftijd)
[1] 19
> length(leeftijd)
[1] 5
> min(leeftijd)
[1] 17
> max(leeftijd)
[1] 22
> median(leeftijd)
[1] 19
> leeftijd[1]
[1] 18
> leeftijd[2]
[1] 22

Ordinaal en Nominaal postcode <- c("9000", "2500", "8400")
niveau ( = Nodig zodat R weet dat dit gaat over nominale/ ordinale variabelen


tramnummer <- factor( c(1, 21, 22, 4, 22, 21, 1, 4) )
( = Hier is het niet nodig om "" te gebruiken. Door het commando FACTOR weet R dat dit gaat over nomin
ordinale variabelen


> uitslag <- factor( c("brons", "goud", "goud", "brons",
Ordinaal niveau "zilver","brons", "brons"),
levels = c( "brons", "zilver", "goud" ),
ordered = TRUE)

Ordered = TRUE nodig in R zodat R de volgorde weet van de waarden


> myData <- data.frame(score, iq, motivatie, geslacht, roken,
Data Frame opleiding, gewicht, lengte)

> myData$geslacht
[1] V V V M M V V V M M M V V V V M V M M M M M V V V
Levels: M V


Data frame opslaan

> write.csv(myData, file = 'myData.csv', row.names = FALSE)

Data frame openen
> read.csv(file = "myData.csv")
Om de gegevens later te kunnen gebruiken moet je ze een naam toekennen.
> myData <- read.csv(file = "myData.csv")

Missing Data, NA = Not Available
> gewicht <- c(69, 64, NA, 76, 78, 75, 74, 51)

, Hoofdstuk 2 Beschrijvende Statistiek




Frequentieverdeling
Om een frequentieverdeling in R te krijgen typ je bijvoorbeeld

> table(myData$opleiding)
ped psy soc 10 18 2




Relatieve frequentieverdeling Voor de relatieve frequentieverdeling moet je nog door de steekproefgrootte n delen:
> table( myData$opleiding ) / dim( myData )[1]
ped psy soc 0.33333333 0.60000000 0.06666667

Om de relatieve frequentieverdeling te bekomen, mag je ook de functie prop.table gebruiken:
> prop.table( table( myData$opleiding ) )
ped psy soc 0.33333333 0.60000000 0.06666667

Voor een bivariate frequentieverdeling gebruik je opnieuw de functie table, met als
Bivariate frequentieverdeling argumenten de namen van de twee variabelen. Voorbeeld:


> table( myData$geslacht , myData$opleiding )
ped psy soc M 7 7 0 V 3 11 2
$6.59
Get access to the full document:

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


Also available in package deal

Reviews from verified buyers

Showing all reviews
4 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
sitta Universiteit Gent
Follow You need to be logged in order to follow users or courses
Sold
110
Member since
7 year
Number of followers
73
Documents
2
Last sold
3 months ago

4.3

30 reviews

5
15
4
9
3
5
2
1
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