Questions: 1. Make sure your Student Engagement in Statistics.csv file is in the folder where you are saving your R files, which should be your working directory. Check your working directory by using: a. getwd()

getwd()
## [1] "/cloud/project/Stats"
  1. Import the Student Engagement in Statistics.csv data file into R using the point-and-click method. (Important: there should be 82 rows and 52 columns).
  1. Give the data frame the name hw9
install.packages("readr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(readr)
hw9 <- read_csv("Student Engagement in Statistics (2).csv")
## Rows: 82 Columns: 52
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): Q11_10_TEXT
## dbl (51): ID, ExamAnxiety, AskHelpAnxiety, InterpretAnxiety, TotalStatAnxiet...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
hw9

Question: I am interested in seeing if my student’s ability to ask for help is impacted by their self-efficacy (e.g, a person’s belief in their ability to complete a task or achieve a goal). To test this, I decide to run a correlation to test the association, strength and direction between the two variables. Once I know this, I want to be able to predict their “ask for help” anxiety based on their self-efficacy. To do this, we create a regression line that best fits the data we observed. 3. Inside a chunk: (1 point for 3 and 3a) install.packages(“car”) install.packages(“psych”) a. Inside the chunk, call the libraries (you can copy and paste the following lines): library(psych) library(car)

install.packages("car")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
install.packages("psych")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(psych)
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
  1. Create scatter plot for the variables AskHelpAnxiety and SelfEfficacy using the plot() using the plot function (use plot() function)
plot(hw9$AskHelpAnxiety, hw9$SelfEfficacy)

5.What trend or observed pattern do you see in your plot: (no correlation, curvilinear, positive or negative linear correlation) Negative linear correlation 6. Check your work using the scatterplot() function

scatterplot(hw9$AskHelpAnxiety,hw9$SelfEfficacy)

7.State the null and research hypothesis for the correlation Null: There is no linear relationship between AskHelpAnxiety and SelfEfficacy in the population. Research: There is a linear relationship between AskHelpAnxiety and SelfEfficacy in the population. 8. Run the correlation between the AskHelpAnxiety and SelfEfficacy using the cor() function Your R code: cor(x= hw9\(SelfEfficacy, y= hw9\)AskHelpAnxiety)

cor(x= hw9$SelfEfficacy, y= hw9$AskHelpAnxiety)
## [1] -0.2308105
  1. What is the correlation coefficient? What is the direction and strength of the correlation? Correlation coefficient: r = −0.231 Direction: Negative (as AskHelpAnxiety increases, SelfEfficacy tends to decrease) Strength: Weak (the absolute value is between 0.20 and 0.39, so the relationship is weak)
  2. Run the correlation between the AskHelpAnxiety and SelfEfficacy, this time using the corr.test() function (2 points for 10 and 10a)
  1. Outside a chunk: Do we reject or fail to reject the null? How do you know?
corr.test(x = hw9$AskHelpAnxiety, y = hw9$SelfEfficacy)
## Call:corr.test(x = hw9$AskHelpAnxiety, y = hw9$SelfEfficacy)
## Correlation matrix 
## [1] -0.23
## Sample Size 
## [1] 82
## These are the unadjusted probability values.
##   The probability values  adjusted for multiple tests are in the p.adj object. 
## [1] 0.04
## 
##  To see confidence intervals of the correlations, print with the short=FALSE option

We reject the null hypothesis because the p-value (0.04) is less than the significance level of 0.05, indicating that the negative correlation between AskHelpAnxiety and SelfEfficacy is statistically significant. 11. Write a sentence interpreting the correlation The correlation of r = −0.23 indicates a weak negative relationship, meaning that as AskHelpAnxiety increases, SelfEfficacy tends to slightly decrease. 12. Now I want you to predict their “ask for help” anxiety based on their self-efficacy. Run a linear regression.

reg<-lm(formula= AskHelpAnxiety ~ SelfEfficacy, data= hw9)
reg
## 
## Call:
## lm(formula = AskHelpAnxiety ~ SelfEfficacy, data = hw9)
## 
## Coefficients:
##  (Intercept)  SelfEfficacy  
##      17.2269       -0.1035
  1. Ask R for a summary of the variable
summary(reg)
## 
## Call:
## lm(formula = AskHelpAnxiety ~ SelfEfficacy, data = hw9)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.6035 -1.2246 -0.1553  1.2318  5.2577 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  17.22691    1.48916  11.568   <2e-16 ***
## SelfEfficacy -0.10353    0.04879  -2.122    0.037 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.203 on 80 degrees of freedom
## Multiple R-squared:  0.05327,    Adjusted R-squared:  0.04144 
## F-statistic: 4.502 on 1 and 80 DF,  p-value: 0.03696
  1. Interpret the Slope and Intercept. The regression results indicate that when SelfEfficacy is zero, the predicted AskHelpAnxiety score is 17.23, and for each one-point increase in SelfEfficacy, AskHelpAnxiety decreases by approximately 0.10 points, showing that higher SelfEfficacy is associated with slightly lower anxiety about asking for help.
  2. Does self-efficacy significantly predict students’ “ask for help” anxiety? How do you know? Yes, SelfEfficacy significantly predicts students’ AskHelpAnxiety.We know this because the p-value for the slope in the regression output is 0.037, which is less than the significance level of 0.05. This indicates that the relationship between SelfEfficacy and AskHelpAnxiety is statistically significant and unlikely to have occurred by chance.