100% tevredenheidsgarantie Direct beschikbaar na betaling Zowel online als in PDF Je zit nergens aan vast
logo-home
Summary Oplossing van take-home asignment advanced data analysis €6,49   In winkelwagen

Samenvatting

Summary Oplossing van take-home asignment advanced data analysis

 22 keer bekeken  0 keer verkocht

Oplossingen (met R-codes) van de take-home asignment gegeven na practicum 2 in de cursus advanced data analysis

Voorbeeld 3 van de 28  pagina's

  • 6 juli 2023
  • 28
  • 2022/2023
  • Samenvatting
Alle documenten voor dit vak (19)
avatar-seller
lauraheyndrickx
Take-home exercise : Statistics refresher
The following take-home exercise guides you through the statistical tests you saw in previous
courses. Run these analyses and study the output. Try to answer the questions that were asked.

After completing this assignment (and the second practicum), you should be able to perform
elementary statistical tests in R.

For the test on March 16

-You will get multiple choice and fill-in questions, based upon the take-home exercise. Most
questions on the test will literally come out of this exercise. Some questions will require you to re-run
some of the analyses. The exercises on ANOVA and regression from the second practical are part of
the test.

- The test is open-book. You are allowed to take your solutions with you (or any other
documentation). Blackboard and the internet will be accessible. You can bring your own laptop or
tablet, but the test itself must be done on the desktop PC.

- You do not have to hand in the solutions or the R-code, but I would definitely recommend to take
the Rscript of the exercise with you. You are allowed to bring it on a memorystick and from that
memorystick copy the files onto the local PC. Mind that, if you copy your script from memorystick to
the local PC, you need to adjust the path of the working directory!

p-value higher than 0,05 is not significant
P-value of 0,05 or lower is significant
 if the p-value is smaller than chosen significance level of 0,05 we can reject our H0

,1. Independent sample t-test
The independent samples t-test is used to compare the mean of a continuous variable between two
groups. That is to say, we test the null hypothesis that the mean of the continuous variable is equal in
the two groups. The observations in group 1 are independent from the observations in group 2 – no
individual has been measured twice.

Check out the t.test function using ?t.test. Like the lm() function, the t.test() function can take a
formula of the form y~x as argument:

t.test(y~x)

The help on the formula argument tells you which variable is x and which variable is y in an
independent sample t-test.

Dataset energy, which contains records of energy expenditure in lean and obese women. These data
are supplied via BB for regular read-in via read.table().

The variable stature is a factor, indicating group and the numeric variable expend shows the energy
expenditure in mega-Joules. With the t-test, you can test the null hypothesis that the energy
expenditure is the same in the lean and the obese group:

t.test(expendstature, data=energy)




The tilde operator is used like in regression and ANOVA : the expenditure is the dependent
(outcome) variable, describes (or predicted) by the stature.

The default output shows a significant p-value, indicating that the difference in mean energy
expenditure between the lean and obese women is significant.

To extract the p-value from the results of the t.test, we first store the results of our t.test into the
object we call (for example) : ttestResult (you can give the object any name you want…the name
‘tomatosoup’ also works.)

ttestResult <- t.test(expendstature, data=energy)

With the names function, we check what objects can be extracted from the ttestResult object.

names(ttestResult)
ttestResult$p.value

If the p-value of a t.test is smaller than 0,05, the result is statistically significant

, Questions :

1) extract the boundaries of the 95% confidence interval from the ttestResults object
2) Make a boxplot to check if the results of the t-test are in line with the raw data
3) From your previous statistics course, you remember that there are two types of t-tests: the t-test
for equal variances and the t-test for unequal variances. Look up in the help file which t.test is
performed by default in R: the test for equal variances or the test for unequal variances.
4) To know if the variance in our two groups is the same, SPSS automatically provided you a statistical
test (“Levene’s test”), testing the null hypothesis that the variance was equal in both groups. Look up
a similar test for the equality of variances in R (Use Google…several solutions possible). Test whether
you have equal variances in the current dataset.
5) Based upon the result of the previous test, perform the appropriate t-test (equal variance or not)
to analyse whether the mean energy expenditure of the lean group is different from the obese group



1




3 If var.equal is TRUE then the pooled estimate of the variance is used. By default,
if var.equal is FALSE then the variance is estimated separately for both groups and the
Welch modification to the degrees of freedom is used.
The standard test used in R = FALSE → Welch Two Sample t-test, choosing for TRUE will give
you the Two Sample t-test
4 H0 states that all groups variances are equal
Levene’s test is an inferential statistic used to evaluate the equality of variances for a variable
determined for two or more groups.
Possible similar test = F-test: are variances of two populations (A and B) equal
→ var . test ¿
In this case, the p-value in the F-test is larger than 0,05 → not-significant → no rejection H0 →
the variance between groups is not different

Voordelen van het kopen van samenvattingen bij Stuvia op een rij:

√  	Verzekerd van kwaliteit door reviews

√ Verzekerd van kwaliteit door reviews

Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!

Snel en makkelijk kopen

Snel en makkelijk kopen

Je betaalt supersnel en eenmalig met iDeal, Bancontact of creditcard voor de samenvatting. Zonder lidmaatschap.

Focus op de essentie

Focus op de essentie

Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!

Veelgestelde vragen

Wat krijg ik als ik dit document koop?

Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.

Tevredenheidsgarantie: hoe werkt dat?

Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.

Van wie koop ik deze samenvatting?

Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper lauraheyndrickx. Stuvia faciliteert de betaling aan de verkoper.

Zit ik meteen vast aan een abonnement?

Nee, je koopt alleen deze samenvatting voor €6,49. Je zit daarna nergens aan vast.

Is Stuvia te vertrouwen?

4,6 sterren op Google & Trustpilot (+1000 reviews)

Afgelopen 30 dagen zijn er 60904 samenvattingen verkocht

Opgericht in 2010, al 14 jaar dé plek om samenvattingen te kopen

Start met verkopen
€6,49
  • (0)
  Kopen