Posts

Showing posts from March, 2024

Module 11 Assignment

Image
Daniel Tafmizi Lis 4273 Dr. Ajani  March 24, 2024 Module 11 Assignment 1. ashina$subject <- factor(1:16)  attach(ashina)  act <- data.frame(vas=vas.active, subject, grp = 2)  plac <-data.frame(vas=vas.plac, subject, grp = 1)    model <- glm(unlist(act)~unlist(plac)) Coefficients: (Intercept) unlist(plac) -13.609 1.236 Degrees of Freedom: 47 Total (i.e. Null); 46 Residual Null Deviance: 95890 Residual Deviance: 61180 AIC: 485.4  plot(model) The model shows us that the active treatment patients responded better than the placebo treatment patients. I wish I could say more, but to be completely honest; I am very confused.  2. a <- gl(2, 2, 8) b <- gl(2, 4, 8) x <-- 1:8 y <- c(1:4, 8:5) z <- rnorm (8) model.matrix(z~a:b) (Intercept) a1:b1 a2:b1 a1:b2 a2:b2 1 1 1 0 0 0 2 1 1 0 0 0 3 1 0 1 0 0 4 1 0 1 0 0 5 1 0 0

Module 10 Assignment

Daniel Tafmizi Lis 4273 Dr. Ajani  March 24, 2024 Module 10 Assignment 9.1.  library(ISwR) data <- (cystfibr) x <- lm(formula = cystfibr$pemax ~ age + weight + bmp + fev1, data=cystfibr) anova(x)          Analysis of Variance Table Response: cystfibr$pemax            Df  Sum Sq Mean Sq F value    Pr(>F)     age        1 10098.5 10098.5 18.4385 0.0003538 *** weight     1   945.2   945.2  1.7258 0.2038195     bmp        1  2379.7  2379.7  4.3450 0.0501483 .   fev1       1  2455.6  2455.6  4.4836 0.0469468 *   Residuals 20 10953.7   547.7    With the given model, we are testing the statistical significance between pemax to the other groups. Given the low P-values, we can say that age and fev1 are significantly related to pemax. However, given the high p-values, we can say weight and bmp do not have a significant relation to pemax Coefficients:   (Intercept)          age       weight          bmp         fev1         179.296       -3.418        2.688       -2.066        1.088     

Module 9 Assignment

Daniel Tafmizi Lis 4273 Dr. Ajani  March 10, 2024 Module 9 Assignment # 1. #Your data.frame is assignment_data <- data.frame( Country = c("France","Spain","Germany","Spain","Germany", "France","Spain","France","Germany","France"), age = c(44,27,30,38,40,35,52,48,45,37), salary = c(6000,5000,7000,4000,8000), Purchased=c("No","Yes","No","No","Yes", "Yes","No","Yes","No","Yes")) #Generate simple table in R that consists of four rows: Country, age, salary and purchased. install.packages("data.table")        library(data.table) table <- setDT(assignment_data) #turns data frame into table table Country   age salary Purchased     <char> <num>  <num>    <char> 1:  France    44   6000        No 2:   Spain    27   5000       Yes 3: Germany    30   7000       

Module 8 Assignment

 Daniel Tafmizi Lis 4273 Dr. Ajani  March 3, 2024 Module 8 Assignment Question 1) We are comparing three groups by stress level, I need a qualitative(group name)and quantitative(level data) set Null Hypothesis: The means of each group are the same Alternative Hypothesis: at least one mean is different from the rest groups <- rep(c("High", "Mod", "Low"), each = 6) #Creates vector where each variable holds 6 data meansStress <- c(c(10,9,8,9,10,8),c(8,10,6,7,8,8),c(4,6,6,4,2,2)) #combines stress data datafr <- data.frame(groups, meansStress)  ggplot(datafr) + aes(x=groups, y=meansStress) + geom_jitter() #cool visual, checks that R is processing data correctly fit <- aov(meansStress ~ groups, data = datafr) #runs anova analysis summary(fit)               Df Sum Sq Mean Sq F value   Pr(>F)     groups       2  82.11   41.06   21.36 4.08e-05 *** Residuals   15  28.83    1.92    Interpretation of results Df: is 2, groups-1. DF is the number of value