Posts tagged with statistics coursework help

Mixed Effects R statistic Quiz

Qn17. Download the file vocab.csv from the course materials. This file describes a study in which 50 recent posts by men and women on social media were analyzed for how many unique words they used, i.e the size of their operational vocabulary on social media. The research question is how men’s and women’s vocabulary may differ on each of three social media websites. How many subjects took part in this study?

Qn18. Create an interaction plot with social on the X-axis and Sex as the traces. How many times, if any, do these lines cross?

Qn19. Perform three Kolmogorov-Smirnov goodness-of-fit tests on Vocab for each level of social using exponential distributions. To the nearest ten-thousandth (four digits), what is the lowest p-value of these three tests? Hint: use the MASS library and its fitdistr function on Vocab separately for each level of social. Use “exponential” as the distribution type. Save the estimate as a fit. The se ks.test with “pexp” passing fit [1] as the rate and requesting an exact test. Ignore any warnings produced about ties.

**

Test of order effects using Generalized Linear Mixed Model

**
Qn20. Use a generalized linear mixed model (GLMM) to conduct a test of order effects on Vocab to ensure counterbalancing worked. To the nearest ten-thousandth (four digits), what is the p-value for the order main effect? Hint: use the lme4 library and its glmer function with family=Gamma(link=”log”) and subject as a random effect. Then use the car library and its Anova function with type = 3. Prior to either, set sum-to-zero contrasts for Sex and Order.

Qn21, Use a generalized linear mixed model (GLMM) to conduct a test of Vocab by Sex and Social. To the nearest then-thousandth (four digits), what is the p-value for the interaction effect? Hint: use the lme4 library and its glmer function with family-Gamma(link=”log”) and subject as a random effect. Then use the car library and its Anova function with type = 3. Prior to either, set sum-to-zero contrasts for sex and social.

Qn22. The only significant effect on Vocab was social. Therefore, perform post hoc pairwise comparisons among levels of social adjusted with Holm’s sequential Bonferroni procedure. To the nearest ten-thousandth (four digits), what is the p-value of the only non-significant pairwise comparison? Hint: Use the multicomp library and its mcp function called from within its glht function, Ignore any warnings produced.

Qn23. In module *, we conducted a generalized linear model (GLM) for ordinal logistic regression using the polr function form the MASS library. We also conducted a GLM for nominal logistic regression using the multinom function from the nnet library. It is, therefore, reasonable to ponder whether variants of such functions exist for generalized linear mixed models (GLMMs), i.e variants that can handle random effects and therefore repeated measures. Unfortunately, although certain approaches exist, ther are arcane and difficult to use, and the R community has not converged upon any widely adopted approaches to mutinomial models with random effects. Our lectures did not venture into such territory, but as a final topic pointing toward the future, here is a brief treatment of ordinal logistic regression with random effects. Let’s being by revisiting our file websearch3.csv from the course materials. Effort is a Likert-type response. How many ordered categories does effort have? Recode Effort as an ordinal response.

Qn24. Use a generalized linear mixed model (GLMM) for ordinal logistic regression to examine Effort by Engine, Specifically, we will use what is called a “cumulative link mixed model” (CLMM). We find the clmm function in the ordinal library. To produce significant tests we use a special version of the ANova function form RVAideMemoire library. There are two quirks. One is that we must make our data frame before passing it to clmm. The second is that the type of parameter seems to be ignore by Anova, resulting in a type II ANOVA. (with a Type II ANOVA, if an interaction is present, then main effects are ignored; not an issue for our one-way analysis of effort by Engine here.) To the nearest ten-thousandth (four digits), what is the p-value of the Engine maineffect? Hint: Here is the code to use:

#assuming df contains websearch3.csv
#Assuming Subject has been recoded as nominal
#Assumng effort has been recoded as ordinal
library(ordinal)
library(RVAideMemoire)
df2 <- as.data.frame(df) # quirk
Contrasts (df2)$Engine) <- “contr.sum”
m  = clmm(Effort ~ Engine + (1|Subject), data = df2)
Anova(m, type = 3) # type ignored

Qn25. In light of the significant main effect of Engine on Effort, post hoc pairwise comparisons are justified among the levels of Engine. However, there is no glht equivalent for clmm, so the best we can do is to treat Effort as a numeric value. Plot the Effort ratings by Engine and perform pairwise comparisons with the following code, To the neares ten-thousandth (four digits), what is the p-value of the one non-significant pairwise comparisons?

#assuming code continuing from Q24
plot(as.numeric(Effort)~Engine, data = df2)
library(mle4)
library(multcomp)
m = lmer(as.numeric(Effort)~Engine + (1|subject), data=df2)
summary(glht(m, mcp(Engine = “Tukey”)), test = adjusted(type=”holm”))

Looking for someone to help you with this Coursera Quiz ? Do not hesitate because MyMathLabhomeworkhelp.com statistics experts are the best when it comes to providing accurate and timely solutions to all your statistics problems. You can place an order under our Coursework help tab, and we'll get back to you ASAP