100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary Solution take-home asignment advanced data analysis $7.03   Add to cart

Summary

Summary Solution take-home asignment advanced data analysis

 22 views  0 purchase
  • Course
  • Institution

Take-home assignment solutions (with R codes) given after practical 2 in the advanced data analysis course

Preview 3 out of 28  pages

  • July 6, 2023
  • 28
  • 2022/2023
  • Summary
avatar-seller
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

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 lauraheyndrickx. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

60904 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
$7.03
  • (0)
  Add to cart