Do you need this or any other assignment done for you from scratch?
We assure you a quality paper that is 100% free from plagiarism and AI.
You can choose either format of your choice ( Apa, Mla, Havard, Chicago, or any other)
NB: We do not resell your papers. Upon ordering, we do an original paper exclusively for you.
NB: All your data is kept safe from the public.
Instructions
Provide the code that parallelizes the following:
library(MKinfer) # Load package used for permutation t-test
# Create a function for running the simulation:
simulate_type_I <- function(n1, n2, distr, level = 0.05, B = 999,alternative = "two.sided", ...)
{
# Create a data frame to store the results in:
p_values <- data.frame(p_t_test = rep(NA, B),p_perm_t_test = rep(NA, B),p_wilcoxon = rep(NA, B))
for(i in 1:B)
{
# Generate data:
x <- distr(n1, ...)
y <- distr(n2, ...)
# Compute p-values:
p_values[i, 1] <- t.test(x, y,
alternative = alternative)$p.value
p_values[i, 2] <- perm.t.test(x, y,alternative = alternative,R = 999)$perm.p.value
p_values[i, 3] <- wilcox.test(x, y,alternative = alternative)$p.value
}
# Return the type I error rates:
return(colMeans(p_values < level))
}
2. Provide the code that runs the following code in parallel with 4 workers (with mclapply):
lapply(airquality, function(x) { (x-mean(x))/sd(x) })
Do you need this or any other assignment done for you from scratch?
We assure you a quality paper that is 100% free from plagiarism and AI.
You can choose either format of your choice ( Apa, Mla, Havard, Chicago, or any other)
NB: We do not resell your papers. Upon ordering, we do an original paper exclusively for you.
NB: All your data is kept safe from the public.