Challenge

Project 1

1. Explain the data. Check it is supervised or unsupervised. Demonstrate

The data given is medical insurance charges, with each row representing patient details which include:

· Age

· Sex

· BMI

· No. of children

· Smoking Status

· Region

· Charges

This is supervised learning data, As the data includes both features i.e., Input and also output target features. The goal of a supervised learning model is to predict the insurance charges for new patients based on the details of data.

2. Estimate the minimum sample size n to get the 99% accurate predictions. (precision = 0.02)

The minimum sample size n requires for 99%accurate predictions can be calculated using the formula:

where z is z- score corresponding to the desired confidence level for 99% = 2.576

p is the estimated proportion of the population with a particular characteristic

e is the desired precision or margin of error

lets estimate p as 0.5

n =

= 165.67

3. Check the data is cleared or not. If not then clean it (Null values, roe/column Duplicates, Outliers, Change the string into numbers.

The data is perfect except to change “yes” or “no” into binary values “1” and “0” respectively.

4. Check the sex and smoking are statistically independent or not.

We need to perform Chi -squared independence test. the test compares the observed counts of data in a contingency table to the expected counts based on the assumption of independence. The null hypothesis is that sex and smoking are independent, and the alternative hypothesis is that they are not independent.

If the P- value of the test is less than a predetermined significance level(such as 0.05), then you can reject the null hypothesis and conclude that sex and smoking are not independent. If the P – value is greater that the significance level, then you cannot reject the null hypothesis and can conclude that sex and smoking are independent.

Its important to note that just because two variables are independent, it doesn’t mean they have no relationship. Independence simply means that the presence or absence of one variable doesn’t affect the probability of the other variable.

5. Check that all regressor variables (independent variable) are independent of each other or not.

In order to check whether the regression variables are independent of each other, you can perform a statistical test such as persons correlation coefficient or spearman’s rank correlation coefficient. These tests determine the degree of association between two variables, with a value close to 1 indicating qa strong positive correlation, a value close to -1 indicating a strong negative correlation, and a value close to 0 indicating no correlation. You can perform these tests for all pairs of variables to check for independence.

Its also important to consider the assumptions of the modelling method you plan to use. For example, Linear regression assumes that the variables are independently and identically distributed, and that there is no multicollinearity (high correlation) among the variables. If the assumptions are violated, it can lead to biased or unreliable results. In that case, you may need to remove some of the variables or use a different modelling method.

6. Check the dependency between response and regressors

To check the dependency between the response and the regressors, you can perform various statistical tests, such as a Pearson correlation coefficient test or a linear regression analysis. The Pearson correlation coefficient test measures the linear relationship between two variables and provides a value between -1 and 1, indicating the strength and direction of the relationship. A value close to 1 indicates a strong positive relationship, a value close to -1 indicates a negative relationship, And a value close to 0 indicates no relationship.

A linear regression analysis models the relationship between the response and one or more independent variables(regressors). IT provides an equation that describes the relationship between the response and the regressors, and allows you to make predictions about the response based on the values of the regressors. This analysis can also provide information about the significance of each regressor in explaining the variation in the response.

By performing these statistical tests, you can determine the dependency between the response and the regressors and determine which regressors are important in explaining the variation in the response.

7. Predict the regression Line to predict the charges for insurance using Independent variables

8. The accuracy of the regression model can be predicted by using

· The mean square error

· The root mean squared error

· the R-squared

MSE = ∑ (actual – predicted) ^2/n = 100^@+200^.../100 = 25000

RMSE = Suare root of MSE = 158.11

R -Squares = 1- 25000/10000 = 0.75

9. Predict insurance charge for Age = 29, Sex = F, bmi = 28, children = 1, Smoke = Yes, region = southeast.

Insurance charges = -1179.76 +(223.57* age) + (296.03* Sex) + (285.86*BMI) + (46.97*children) + (2387.29*Smoke) + (351.12* southeast)

sex: f =1 m=0

Smoke: 1= yes 0 = no

Southeast 1 other =0

Insurance charges = -1179.76 +(223.57* 29) + (296.03*1) + (285.86*28) + (46.97*1) + (2387.29*1) + (351.12*1) = 5750.51

10. Give percentage of error in regression model.

Sum of squares

Df

Mean of squares

F

Sig

Regression

640.816

1

640.816

560.782

<.001

Error

1368.977

1198

1.143

Total

1192009.7938

11. Give the 95% confidence interval for average charge insurance

The average charge insurance of the above data is 12279

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.