🍐 我们总结r语言代中——Biostatistics代写的经典案例,如果你有任何代写r语言的需要,可以随时联络我们。CoursePear™ From @2009。

7.1

In a study comparing the chemical composition of the urine of chimpanzees and gorillas (Gartler, Firschein, and Dobzhansky, 1956), the following results were obtained. For 37 chimpanzees the variance for the amount of glutamic acid in milligrams per milligram of creatinine was 0.01069. A similar study based on six gorillas yielded a variance of 0.12442. Is there a significant difference between the variability in chimpanzees and that in gorillas? Give the F-statistic, the critical value (expected F) (α = 0.05) with the correct degrees of freedom, and your statement (yes/no).

7.2

The following data are from an experiment by Sewall Wright. He crossed Polish and Flemish giant rabbits and obtained 27 F1 rabbits. These were inbred and 112 F2 rabbits were obtained. We have extracted the following data on femur lengths of these rabbits (page 158):

 n s
F12783.391.65
F211280.53.81

Is there a significantly greater amount of variability in femur lengths among the F2 than among the F1 rabbits? (no need to state the “well-known genetic phenomenon”). NOTE that F1 and F2 refer to filial generations, and not to statistical F-values. Think of them as “group 1” and “group 2”. 

7.5

A geneticist recorded the following measurements taken on two-week-old mice of a particular strain. Is there evidence that the variance among mice in different litters is larger than one would expect on the basis of the variability found within each litter? What are the differences in means between the groups, and are they significant? Display with a box and whisker plot. 

(See “Data_Exercise 7.5.txt”)

Note that you may need to alter “Data_Exercise 7.5.txt” to be appropriate for analysis of variance (as we did in lab 7 for “Data_Table 7.1.wrong.txt”). This can take place in R with code, or by making a separate .txt file. If you do this by making a separate text file, please name it the same, and indicate that you did this in your script file so that I know. 

Some important functions and what they do:

qf(quantile, df_among, df_within)   ->   obtain the critical / expected value for F.

summary(aov(data$Y~data$X))  ->   Perform an Analysis of Variance

TukeyHSD(aov(data$Y~data$X))  ->  Perform a post-hoc test

boxplot(data$Y~data$X)  ->  Make a box and whisker plot

# QUESTION 7.1

# chimpanzees variance and count

var_chim <- 0.01069

n_chim <- 37

# gorillas variance and count

var_gor <- 0.12442

n_gor <- 6

# this is significant difference between case, performing 2-tailed F test

# calculating f-ratio, degrees of freedom and critical f values

f_ratio_1 <- var_gor/var_chim

df_num <- n_gor – 1

df_denom <- n_chim – 1

alpha <- 0.05

f_crit_l <- qf(alpha/2, df_num, df_denom)

f_crit_u <- qf(1-alpha/2, df_num, df_denom)

# checking if f-ratio falls in critical region

ifelse(f_ratio_1 < f_crit_l | f_ratio_1 > f_crit_u, “Reject Null Hypothesis”, “Accept Null Hypothesis”)

# YES, there is a significant difference between the variability in chimpanzees and that in gorillas. The F-statistic is 11.63891.

# We have upper and lower critical value as it is 2-tailed F test case.

# The critical F values are  0.1614882 and 2.944031 (with 5 numerator and 36 denominator degrees of freedom). 

# QUESTION 7.2

# F1 rabbits stats

F1_std <- 1.65

F1_n <- 27

# F2 rabbits stats

F2_std <- 3.81

F2_n <- 112

# This is significantly greater than case, performing 1-tailed F test

# calculating f-ratio, degrees of freedom and critical f value

f_ratio_2 <- F2_std^2/F1_std^2

df_F1 <- F1_n – 1

df_F2 <- F2_n – 1

alpha <- 0.05

f_critical <- qf(1-alpha, df_F2, df_F1)

# checking if f-ratio falls in critical region

ifelse(f_ratio_2 > f_critical, “Reject Null Hypothesis”, “Accept Null Hypothesis”)

# YES, there a significantly greater amount of variability in femur lengths among the F2 than among the F1 rabbits.

# This is right-tailed F test case.

# The F-statistic is 5.331901 and critical F value is 1.753312 (with 111 numerator and 26 denominator degrees of freedom). 

# QUESTION 7.5

# Assumed alpha value as 0.05 as not mentioned in the question

data <- read.table(“Data_Exercise 7.5.txt”, header = TRUE, sep = “\t”, dec = “.”)

# transforming data for anova analysis

mice_data <- stack(data)

colnames(mice_data) <- c(“values”, “litter_group”)

# ANOVA Test to check within group variation and between group variation

aov_test <- aov(mice_data$values~mice_data$litter_group)

summary(aov_test)

# From the anova results the p-value is not significant as it is greater than 0.05.

# There is no evidence that the variance among mice in different litters is larger than one would expect on the basis of the variability found within each litter

# performing post-hoc test – for pairwise comparisons

TukeyHSD(aov(mice_data$values~mice_data$litter_group))

# In the Tukey post-hoc test, there is no significant p-value as the adjusted p-value for all pairwise litter groups is greater than 0.05

# The difference in means between the groups are not significant

# Making a box and whisker plot

boxplot(mice_data$values~mice_data$litter_group, xlab = “Group”, ylab = “Measurements”,

        main = “Measurements on two-week-old mice”)

CoursePear™是一家服务全球留学生的专业代写

—-我们专注提供高质靠谱的美国、加拿大、英国、澳洲、新西兰代写服务。

—-我们专注提供Essay、统计、金融、CS、经济、数学等覆盖100+专业的作业代写服务。

r语言代写
r语言代写

CoursePear™提供各类学术服务,Essay代写Assignment代写Exam / Quiz助攻Dissertation / Thesis代写Problem Set代做等。