Posts

Module 8. Assignment

> stress_reaction <-c(10, 9, 8, 9, 10, 8, 8, 10, 6, 7, 8, 8, 4, 6, 6, 4, 2, 2) > stress_level <- factor(rep(c("High", "Moderate", "Low"), each = 6)) > data <- data.frame(StressReaction = stress_reaction, StressLevel = stress_level) > anova_result <-aov(StressReaction ~ StressLevel, data = data) > summary(anova_result) Df Sum Sq Mean Sq F value Pr(>F) StressLevel 2 82.11 41.06 21.36 4.08e-05 *** Residuals 15 28.83 1.92 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Question 1: The degree of freedom for the StressLevel are 2, and the Residuals are 15. The sum of squares for StressLevel are 82.11, and for the residuals, it is 28.83. The mean square for StressLevel is 41.06, and for Residuals it is 1.92. The F value is 21.36, and the p-value is 4.08e-05 (0.0000408). Since the p-value (0.0000408) is less than 0.05 we cannot conclude that stress levels affect the...

Module 7. Assignment

Image
> x <- c(16, 17, 13, 18, 12, 14, 19, 11, 11, 10) > y <- c(63, 81, 56, 91, 47, 57, 76, 72, 62, 48) > model <- lm(y ~ x) > summary(model) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -11.435 -7.406 -4.608 6.681 16.834 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 19.206 15.691 1.224 0.2558 x 3.269 1.088 3.006 0.0169 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 10.48 on 8 degrees of freedom Multiple R-squared: 0.5303, Adjusted R-squared: 0.4716 F-statistic: 9.033 on 1 and 8 DF, p-value: 0.01693 Question 1 1.1 : This is a linear relationship model. X is the predictor and Y is the response. The model shows how the predictor will affect the response in a straight line. 1.2 : Given the regression formula,   Y = a + bX +e     Looking at the model, the row labeled Intercept the Estimate is 1...

Module 6. Assignment

Question A. > data1 <- c(8, 14, 16, 10, 11) > mean(data1) [1] 11.8 > sd(data1) [1] 3.193744 > sample(data1, size = 2) [1] 10 16 > sample_data <-c(10, 16) > sample_mean <- (10 +16) / 2 > sample_mean [1] 13 > sd(sample_data) [1] 4.242641      A . The mean of the population is 11.8 B . 10 and 16 C . Mean = 13, SD = 4.242641 D . The sample mean is larger than the population mean. The sample standard deviation is also larger than the population standard deviation meaning (10, 16) are more spread out than the population. Question B. Given: n = 100 p = 0.95 q = 1-p = 0.05 1. np = 100 x 0.95 = 95     nq = 100 x 0.05 =5 Since nq = 5, and 5 is less than 10, the distribution is not normal because np and nq need to be greater than or equal to 10. 2. 200 is the smallest value of n.     200 x 0.05 = 10 Question 3. Coin tossing is better done using a rbinom() function than sample because rbinom() gives the probability of g...