100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Oefensessie 7 $6.30   Add to cart

Other

Oefensessie 7

 3 views  0 purchase
  • Course
  • Institution

Oefeningen uit oefensessie 7 uitgewerkt

Preview 3 out of 27  pages

  • June 10, 2023
  • 27
  • 2022/2023
  • Other
  • Unknown
avatar-seller
Oefeningen Multiniveau-analyse


P0S37A Thema’s uit de kwantitatieve methodologie
Academiejaar 2022-2023


0. Als opwarmingsoefening gaan we eerst proberen om de analyse die in hoorcollege is getoond, te reproduceren.
Start hiervoor R en kopieer de gegevens en het R script voor de oefeningen vanuit Toledo naar de desktop. De
gegevens en het R script zijn terug te vinden op Toledo


Cursusdocumenten / Gegevensbestanden / Oefeningen multiniveau-analyse


Het R script heeft als naam Multilevel script.txt en kan in de R Console worden geopend via


File / Open script…


Standaard geeft R de extensie .R aan scripts, maar in dit geval is de extensie .txt, dus om de volledige lijst van
beschikbare bestanden op de desktop te zien moet er nog worden aangegeven:


Files of type: All files (*.*)


Ik geef er de voorkeur aan om met de extensie .txt te werken om duidelijk te maken dat het over een ongeformatteerd
tekstbestand gaat dat gemakkelijk met Notepad kan worden bewerkt.


Om het R script stap-voor-stap te doorlopen, selecteert u de lijn (of de lijnen) die u wilt uitvoeren, klik rechts op de
muis en selecteer


Run line or selection


De in te lezen gegevens moeten telkens via een afzonderlijk pop-up scherm worden geselecteerd. Het gaat
respectievelijk over de bestanden Samantha.txt, Thomas.txt en Combined data.txt. De resultaten die je
verkrijgt moet je telkens vergelijken met de tabellen, zoals getoond in het hoorcollege of met de tabellen in Onghena,
Michiels, Jamshidi, Moeyaert, en Van den Noortgate (2018).

, 2
# Stap 1: Inlezen van gegevens
# Inlezen van de Samantha gegevens uit Onghena et al. (2018) door een ruw gegevensbestand in te lezen dat
zich
# ergens op de computer bevindt, waarbij er kolomhoofden aanwezig zijn, waarbij de kolommen van elkaar
# worden gescheiden door een spatie, waarbij eventuele ontbrekende scores worden weergegeven met NA,
# waarbij eventuele decimalen worden weergegeven achter een punt, en waarbij eventuele blanco’s op het
einde
# van het bestand worden weggelaten. Geef dit R bestand een willekeurige nieuwe naam, bijvoorbeeld
# "Samantha".
> Samantha <- read.table(file.choose(new=F), header=TRUE, sep="", na.strings="NA", dec=".", strip.white=TRUE)

# Stap 2: Controleer of het bestand correct is ingelezen
> Samantha




#Stap 3: Enkelvoudige en meervoudige regressie-analyse kan in R worden uitgevoerd met de lm functie
(afkorting
# van "linear model"). De modelvergelijking kan je opschrijven als AFHANKELIJKE VARIABELE ~ ONAFHANKELIJKE
# VARIABELE(N) waarbij de onafhankelijke variabelen met een plusteken worden verbonden. Geef het resultaat
# van deze analyse een willekeurige naam, bijvoorbeeld "RegModel.1" en print dan een samenvatting van de
# analyse uit met de summary-functie.
> RegModel.1 = lm(Score~Treat, data=Samantha)
> summary(RegModel.1)

, 3




# Stap 4: Voeg de onafhankelijke variabele Week toe om de lineaire trend te toetsen
> RegModel.2 = lm(Score~Treat+Week, data=Samantha)
> summary(RegModel.2)




#Stap 5: Als we autocorrelaties in de residuen willen toelaten, dan kunnen we de lm functie niet meer gebruiken
# en moeten we de arima functie gebruiken (zie seminarie over tijdreeksanalyse)
> ArimaModel.1 <- arima(Samantha$Score, order=c(1,0,0), xreg=cbind(Samantha$Treat,Samantha$Week))
> ArimaModel.1

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller cathoschelkens. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $6.30. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

77973 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$6.30
  • (0)
  Add to cart