Question

The cost of manufacturing one unit of a product (€Y) appears to vary randomly with the...

The cost of manufacturing one unit of a product (€Y) appears to vary randomly with the size of the batch manufactured (X units). On 8 separate days, 8 different batch sizes were manufactured and the cost per unit calculated. The batch sizes and cost per unit are contained in the Production.txt file.

Production.txt file contents:

"X" "Y"
"1" 100 835.91
"2" 200 978.44
"3" 300 634.45
"4" 400 687.01
"5" 500 771.14
"6" 600 459.71
"7" 700 392.78
"8" 800 296.46

a) Create a files called Production.txt and import it into R. Report the code you used below.

R Code:

b) Fit a simple linear regression model to the Production.txt data, where the cost per unit is the response variable and the batch size is the predictor variable. Report the code you used to fit this model and print the output to the screen. Also, report the least squares estimates of the intercept and the slope of the fitted regression line.

R Code:

Intercept:

Slope:

c) What is the relationship between X and Y.
Positive or Negative?

d) Predict the production cost per unit for a batch of 340 units.

Answer:

R Code:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

We will use read.table function of R to read the file.

Production=read.table("Production.txt")

model<-lm(data = Production,formula = Y~X) #This is the function for creating a linear regression model . The formula part # says that we need to predict the variaable Y in terms of variable X

summary(model)

library(ggplot2)
ggplot(Production,aes(x=X,y=Y)) + geom_point() + geom_smooth(method = lm,formula = y~x,se = F)

#This is to just depict the least squares line on a graph ( This is just for Your understanding)

predicted=predict(model,newdata = data.frame(X=340)) #We use the R's predict function which takes in the model as the #first argument and the second argument as the new data point(s) (as a data frame) we want to predict the value for the #response variable.

predicted

As it is clear from the output that the estimate for intercept is 1014.7307 and for slope is -0.8505

To get the relation, we substitute these values in the general equation-

Y=(slope_estimate)X + (intercept_estimate)

You can substitute these values.

To get a visual idea here is a plot made using the ggplot (You need to install the ggplot2 library for using this command) command above-

For the prediction part -

Add a comment
Know the answer?
Add Answer to:
The cost of manufacturing one unit of a product (€Y) appears to vary randomly with the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In the simple linear regression model, the slope represents the: A. change in y per unit...

    In the simple linear regression model, the slope represents the: A. change in y per unit change in x B. value of y when x = 0 c. change in x per unit change in y D. value of x when y = 0 In the first-order linear regression model, the population parameters of the y-intercept and the slope are estimated by CA. bo and A CB. bo and b CC. A and Po CD. b and Bo

  • please help! Following is a simple linear regression model: y = a + A + &...

    please help! Following is a simple linear regression model: y = a + A + & The following results were obtained from some statistical software. R2 = 0.523 Syx (regression standard error) = 3.028 n (total observations) = 41 Significance level = 0.05 = 5% Variable Interecpt Slope of X Parameter Estimate 0.519 -0.707 Std. Err. of Parameter Est 0.132 0.239 Note: For all the calculated numbers, keep three decimals. Write the fitted model (5 points) 2. Make a prediction...

  • Supermarkets can use the scanning data collected at the checkout counters to evaluate the effect of...

    Supermarkets can use the scanning data collected at the checkout counters to evaluate the effect of price on the sales of any product. Weekly data was collected on a particular beverage brand, including sales (in number of units) and price (in dollars). Based on a simple linear regression analysis, the fitted regression equation was: Y = 2259 - 1418 X. The ANOVA F-statistic was 60.52 with the p-value of <0.0001, and R2 = 0.597.  According to this model, is the explanatory...

  • Rstudio programming (R programming) The weight and systolic blood pressure of 26 randomly selected males in...

    Rstudio programming (R programming) The weight and systolic blood pressure of 26 randomly selected males in the age group 25-30 are found in the attached CSV file. Fit a simple linear regression model relating systolic blood pressure (y) to weight (2). (30 points) (a) Provide the R code which fits the model and outputs the summary of the fitting. (b) Report the model fitting summary (c) Write down the fitted linear model and its interpretation. (d) Write down the null...

  • Problem Definition: A wholesale supplier wants to predict the average cost associated with shipping orders of...

    Problem Definition: A wholesale supplier wants to predict the average cost associated with shipping orders of various sizes. The order sizes and shipping costs for the past twelve months are provided in the table below. Set alpha at .01. Order sizes and shipping costs for last twelve months Size of Orders =X Shipping Costs =Y 1068 4489 1026 5611 767 3290 885 4113 1156 4883 1146 5425 892 4414 938 5506 769 3346 677 3673 1174 6542 1009 5088 Review...

  • USING R: x variable = income, y variable = sales; data set = Carseats how would...

    USING R: x variable = income, y variable = sales; data set = Carseats how would you code this? In this part of the problem, we will find a polynomial function of Income that best fits the Carseats data. For each polynomial function between p 0,1,2,..10: i. Fit a linear regression to predict Sales as a function of Income, Income2. IncomeP (you should include an intercept as wel. Note that p 0 model is an "intercept-only" model.

  • Create the printout necessary for conducting a SLR analysis of your project data. Use y=price as...

    Create the printout necessary for conducting a SLR analysis of your project data. Use y=price as your dependent variable and x=mileage/size as your independent variable. Copy and paste the printout here: Least Squares Linear Regression of Asking Predictor Variables               Coefficient            Std Error                    T              P Constant                 22790.9               1314.55                17.34     0.0000 Mileage              -0.09109               0.03153                -2.89       0.0051 R²                              0.1026               Mean Square Error (MSE) 1.102E+07 Adjusted R²              0.0903               Standard Deviation             3319.84 AICc                        1220.5 PRESS                   8.47E+08...

  • (a) The production manager of ABC Co. Ltd. has found that the relationship between production cost...

    (a) The production manager of ABC Co. Ltd. has found that the relationship between production cost (y in $) and lot size (x in units) of a certain product is linear. A random sample of eight lots is taken and the results are summarized as below: Xx=941, Xx? = 325751, y=9570, y =32849700 and X xy = 3271030 (i) Find the least squares linear regression equation for predicting production cost on lot size. (4 marks) (ii) Calculate the coefficient of...

  • Q2. Consider all observations as one sample of X (1st column) and Y (2nd column) values....

    Q2. Consider all observations as one sample of X (1st column) and Y (2nd column) values. Answer the following questions: (20 points) 78 4.4 74 3.9 68 4 76 4 80 3.5 84 4.1 50 2.3 93 4.7 55 1.7 76 4.9 58 1.7 74 4.6 75 3.4 80 4.3 56 1.7 80 3.9 69 3.7 57 3.1 90 4 42 1.8 91 4.1 51 1.8 a) Calculate the correlation coefficient r (5 points) b) Fit the regression model (predicting...

  • Need help with stats true or false questions Decide (with short explanations) whether the following statements are true or false a) We consider the model y-Ao +A(z) +E. Let (-0.01, 1.5) be a 95% con...

    Need help with stats true or false questions Decide (with short explanations) whether the following statements are true or false a) We consider the model y-Ao +A(z) +E. Let (-0.01, 1.5) be a 95% confidence interval for A In this case, a t-test with significance level 1% rejects the null hypothesis Ho : A-0 against a two sided alternative. b) Complicated models with a lot of parameters are better for prediction then simple models with just a few parameters c)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT