Posts

Showing posts from October, 2025

Exploring Data Frames and Tables in R

Image
  In this assignment, I made a simple data frame in R with details like country, age, salary, and whether someone made a purchase. Then I used the built-in mtcars dataset to create a table showing how car gears and cylinders relate to each other. I added totals using addmargins() and found both overall and row proportions with prop.table() . Doing this helped me see how R makes it easy to organize, compare, and understand data.

Exploring Stress Levels, Drug Effects, and Reaction Time with ANOVA in R

Image
For this study, I wanted to see whether stress level affects how a drug influences reaction time. I used three groups: high stress, moderate stress, and low stress. Each group’s reaction times were recorded, and I ran a one-way ANOVA in R to check for differences between them. The results from the ANOVA showed something pretty interesting. There was a clear difference between the stress levels, the F-value was about 18.92 and the p-value was less than 0.05. That means we can reject the null hypothesis and say that stress levels have a significant effect on reaction time after taking the drug. In simpler terms, the drug didn’t affect everyone the same way, how stressed a person was made a noticeable difference. Next, I explored the zelazo dataset from the ISwR package, which includes four groups labeled active , passive , none , and ctr.8w . I converted the data into a format R could read easily and ran another one-way ANOVA to compare the groups. This time, the F-value came out ar...

Understanding Regression Models: Predicting, Analyzing, and Interpreting Data in R

Image
 In this assignment, I explored simple and multiple linear regression using different datasets in R. Regression basically helps us understand how one variable affects another, and it can also be used to make predictions. For the first example, I looked at a dataset with x as the predictor and y as the response. Using the linear model Y = α + β X + ϵ Y = \alpha + \beta X + \epsilon Y = α + βX + ϵ , I used R’s lm() function to find the intercept and slope. The slope told me how much y changes for each one-unit change in x , while the intercept gave the value of y when x = 0 . This simple model makes it easy to see the trend in the data and predict y for any given x . Next, I worked with the faithful dataset to predict eruption durations based on the waiting time since the last eruption. Again, the regression model helped me quantify the relationship. Using lm(eruptions ~ waiting, data=faithful) and the predict() function, I estimated the discharge duration for a waiting ti...

Understanding Variance, Standard Deviation, and Sampling Distributions in R

Image
 A. B.   Sample = {14, 10} C.                  Squared deviations : D.  Deviations and squared deviations: X           x - μ                   (x - μ)² 8           -3.8                   14.44 14           2.2               ...