Assignment 7-Inference-for-Numerical-Data
Assignment 7-Inference-for-Numerical-Data
Inference-for-Numerical-Data
## Single mean
## Summary statistics:
We can state that, given a roughly normal distribution, the point estimate is 7.101 and given a
95% confidence interval, the mean length of pregnancy is between 7.0075 and 7.1945 months.
#2.Calculate a new confidence interval for the same parameter at the 90%
confidence level. You can change the confidence level by adding a new
argument to the function: conflevel = 0.90.
inference(y = nc$weight, est = "mean", type = "ci", null = 0, alternative =
"twosided", method = "theoretical", conflevel = 0.90)
## Single mean
## Summary statistics:
## mean = 7.101 ; sd = 1.5089 ; n = 1000
## Standard error = 0.0477
## 90 % Confidence interval = ( 7.0225 , 7.1795 )
We can state that, given a roughly normal distribution, the point estimate is 7.101 and given a
90% confidence interval, the mean length of pregnancy is between 7.0225 and 7.1795 months.
#3.Conduct a hypothesis test evaluating whether the average weight gained by
younger mothers is different than the average weight gained by mature
mothers.
inference (y= nc$weight, x= nc$mature, est = "mean", type = "ht", null = 0,
alternative = "twosided", method = "theoretical")
library(dplyr)
nc %>% group_by(mature) %>% na.omit() %>%
summarise(min_age = min(mage),
max_age = max(mage))
## # A tibble: 2 × 3
## mature min_age max_age
## <fct> <int> <int>
## 1 mature mom 35 50
## 2 younger mom 15 34
Based on the summary table above, I would say the cut off age would be 35 and above for
mature and young otherwise.
#5.Pick a pair of numerical and categorical variables and come up with a
research question evaluating the relationship between these variables.
Formulate the question in a way that it can be answered using a hypothesis
test and/or a confidence interval. Answer your question using the inference
function, report the statistical results, and also provide an explanation in
plain language.
Research Question: Is there a significant difference in the length of pregnancy between smokers
and non-smokers?.