Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Samenvatting R-code - Statistiek en data analyse (J000497A)

Rating
-
Sold
-
Pages
5
Uploaded on
08-04-2026
Written in
2023/2024

Dit document geeft een overzicht van alle R-codes die gebruikt werden in de werkcolleges en als voorbeeld dienden in het boek. Zeer handig voor het open-boek examen!

Institution
Course

Content preview

STATISTIEK: R-CODES
1. INLEIDING: Wat is medische statistiek?
2. STUDIEDESIGN: Wat maakt een empirische studie kwalitatief?
3. DATA-VISUALISATIE: Hoe gegevens visualiseren?
- Staafdiagram maken:
Ggplot(vanhouw5, aes(x=sexe)) + geom_bar() + labs(x=”geslacht”, y=”aantal”)
 Bindwith instellen (geom_bar(bindwith = 20))

- Histogram maken:
Ggplot(vanhouw5, aes(x=OPP) + geom_histogram(aes(y=..density..)) +
geom_density(aes(y=..density..)) + labs(x=”oppervlakte lever”, y=”dichtheid”)

- Twee figuren samen in 1 grafisch venster plaatsen (bv 2 kolommen en 1 rij)
Grid.arrange(p1,p2,ncol=2,nrow=1)

- Spreidingsdiagram:
Index <- seq(1,154)
Datnmm <- mutate(datnmm, index)
Datnmm1 <- datnmm[trt==1,]
Ggplot(datnmm1, aes(x=index,y=dbp3,ymin=80,ymax=120)) + geom_point() +
labs(x=”index”,y=”Diast bloeddruk 3 (begin)”)

- Dotplot:
Ggplot(vanhouw5, aes(x=sexe,y=OPP)) + geom_histogram(bindwidth=30) + facet_grid(sexe ~ .)
+ labs(x=”oppervlakte lever”, y=”aantal”)

- Boxplot/box-en-whisker plot:
ggplot(vanhouw5,aes(x=sexe,y=OPP)) + geom_boxplot() + labs(x=”geslacht”,y=”oppervlakte
lever”)

OF voor outliers:
Ggplot(vanhouw5,aes(x=sexe,y=OPP)) + geom_boxplot(outlier.shape=NA) +
geom_point(position=”jitter”) + labs(x=”geslacht”,y=”oppervlakte lever”)

- Profielplot: (nog eens op pag. 150)
Crossover0 <- subset(crossover, crossover$FIRSTTTRT==0)
Crossover0$individu <- 1:3
Crossover.wide <- data.frame(crossover0[c(“ TIME1”,”TIME2”,”individu”)])
Head(crossover.wide)
Crossover.long <- melt(crossover.wide, id.vars=c(“individu”))
Head(crossover.long)
Ggplot(crossover.long,aes(x=variable,y=value,group=individu

, - Puntenwolk + niet-parametrische regressielijn:
Ggplot(subset(datnmm,trt==1),aes(y=dbpdif,x=compjb,xmin=0,xmax=1.25,ymin=-
45,ymax=25)) + geom_point()
+ geom_smooth(aes(x=compjb,y=dbpdif),method=’loess’,formula=y~x)
+ labs(x=”% ingenomen pillen”,y=”wijziging diast bloeddruk”) + ggtitle(“arm 1)



4. DATA-ANALYSE: Hoe een behandelingseffect kwantificeren?
- Kans berekenen P:
Pnorm(x,mu,sd)

- QQ-plot:
X <- rnorm(1000)
Ggplot(data.frame(x),aes(sample=x)) + geom_qq() + geom_qq_line()

- Puntenwolk + lineaire regressive:
Ggplot(prothrombin, aes(x=DOSIS,y=TIJD)) + geom_point()
+ geom_smooth(aes(x=DOSIS,y=TIJD), method=’lm’,formula=y~x)
+ labs(x=”dosis”,y=”prohtrombine tijd”)

- Kruistabel opstellen:
Data <- matrix(c(3,14,17,12,,15),ncol=3,byrow=TRUE)
Rownames(data) <- c(“Controle”, “Test”)
Colnames(data) <- c(“Succes”,”Failing”,”Totaal”)
Tabel <- as.table(data)
Tabel

5. DATA-ANALYSE: Hoe nauwkeurig is een data-analyse?
- Betrouwbaarheidsintervallen: stel voor 95% en 25 observaties
Y <- rnorm(25,7,2)
Mean(y)
Sd(y)
Mean(y) – qt(0.975,df=24)*sd(y)/5
Mean(y) + qt(0.975,df=24)*sd(y)/5

- 100 keer het betrouwbaarheidsinterval herhalen: zie pagina 127

6. DATA-ANALYSE: Hoe beslissen of een behandeling effectief is?
- Boxplot maken met op de x-as een variabele:
Library(speff2$trial)
ACTG175$treat <- as.factor(ACTG175$treat)
Ggplot(ACTG175,aes(x=treat,y=cd420)) + geom_boxplot() + labs(x=”Behandelingsarm”,y=”CD4
T cel telling na 20 weken”)

Written for

Institution
Study
Course

Document information

Uploaded on
April 8, 2026
Number of pages
5
Written in
2023/2024
Type
SUMMARY

Subjects

$5.13
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
jasmienghelein

Get to know the seller

Seller avatar
jasmienghelein Universiteit Gent
Follow You need to be logged in order to follow users or courses
Sold
3
Member since
2 year
Number of followers
3
Documents
5
Last sold
2 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions