Calculating Coefficients and More!
Welcome Back! Today we will be calculating coefficients and more!
1.
DATA SET:
- x<-c(16, 17, 13, 18, 12, 14, 19, 11, 11, 10)
- y<-c(63, 81, 56, 91, 47, 57, 76, 72, 62, 48)
1.1 Define the relationship model between the predictor and the response variable.
- To define the relationship model between the predictor variable X and the response variable Y using the linear regression equation :Y=a+bX+e ,
We will create a linear regression model using the
lm()
function with the provided data
1.2 Calculate the coefficients
INPUT:
OUTPUT:
Intercept (a):
- Estimate:
- This means that when X = 0, the expected value of Y is approximately19.206. However, note that X = 0 might not be a realistic value in your dataset, so the intercept may not have practical significance.
Slope (b):
- Estimate:
- This indicates that for each one-unit increase in X, Y is expected to increase by approximately . This suggests a positive relationship between the predictor and the response variable.
2.
DATA SET:
2.1 Define the relationship model between the Predictor and the response variable
- create a linear regression model with
discharge
as the response variable andwaiting
as the predictor variable.
2.2 Extract the parameters of the estimated regression equation with the coefficients function
- You will use the
coefficients()
function to extract the parameters (intercept and slope) of the regression equation.
2.3 Determine the fit of the eruption duration using the estimated regression equation
INPUT:
OUTPUT:
3. Examine the Multi Regression Model as stares above and its Coefficients using 4 different variables from mtcars (mpg, disp, hp, and wt), Report on the result and explanation what does the multi-regression model and coefficients tells about the data.
INPUT:
OUTPUT:
- (Intercept): The intercept is approximately 37.2851. This value represents the estimated miles per gallon (mpg) when disp, hp, and wt are all equal to zero. However, this may not be a practical scenario since a car cannot have zero displacement, horsepower, or weight.
- disp: The coefficient for disp is approximately −0.0075. This indicates that for each one cubic inch increase in displacement, the mpg decreases by about holding all other variables constant. This suggests that cars with larger engines tend to have lower fuel efficiency.
- hp: The coefficient for hp is approximately
− 0.0318 . This means that for each additional horsepower, the mpg decreases by about , again holding other variables constant. Higher horsepower is associated with lower fuel efficiency. - wt: The coefficient for wt is approximately
− 3.8009 . This indicates that for each additional 1000 lbs in weight, the mpg decreases by about 3.8009. Heavier cars tend to be less fuel-efficient. - The multiple regression model indicates that displacement, horsepower, and weight are significant predictors of fuel efficiency (mpg). The negative coefficients suggest that as any of these variables increase, the fuel efficiency decreases. The high R-squared value shows that the model provides a good fit to the data, indicating that these variables account for a large proportion of the variance in mpg among the cars in the dataset.
4. With the rmr data set, plot metabolic rate versus body weight. Fit a linear regression to the relation. According to the fitted model, what is the predicted metabolic rate for a body weight of 70 kg?
The data set rmr is R, make sure to install the book R package: ISwR. After installing the ISwR package, here is a simple illustration to the set of the problem.
INPUT:
OUTPUT:
Comments
Post a Comment