Multivariate Regression with 5 Variables in R











up vote
0
down vote

favorite












I am trying to analyse the correlation of different factors of packagings on the pack-time. This is what I got.



df <- read.csv2("file",
header = TRUE, strip.white = TRUE)
over.all.raw <- as.Date(Shipset.data.frame$Outgoing, origin = "1899-12-30") -
as.Date(Shipset.data.frame$Start, origin = "1899-12-30")

over.all.raw <- as.numeric(over.all.raw)

new.df <- data.frame(over.all.raw)

new.df <- cbind(over.all.raw, Shipset.data.frame$Weight1,
Shipset.data.frame$Weightbrutto,
Shipset.data.frame$Volume,
Shipset.data.frame$ComponentsLC,
Shipset.data.frame$ComponentsPl)

new.df1 <- as.data.frame(new.df)
colnames(new.df1) <- c("Transporttime", "Weight1", "WeightBrutto", "Volume", "ComponentsLC", "ComponentsPl")

clean.new.df1<- new.df1[complete.cases(new.df1), ]


In this example I want to test how the Weight (Brutto or Netto), Volume, and Components from different locations have an influence on the packing time. This is how I made my linear model.



lm <- lm(Transporttime ~ Weight1 + WeightBrutto + Volume + ComponentsLC + ComponentsPl, data = new.df1)

summary(lm)


Residuals:
Min 1Q Median 3Q Max
-25.955 -5.074 2.408 7.676 27.353

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 25.81903 0.49060 52.627 < 2e-16 ***
Weight1 -0.17205 0.09469 -1.817 0.069601 .
WeightBrutto 0.08748 0.07226 1.211 0.226390
Volume -6.59973 1.65135 -3.997 7.04e-05 ***
ComponentsLC 0.04362 0.29912 0.146 0.884107
ComponentsPl 0.52863 0.14467 3.654 0.000276 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 10.57 on 774 degrees of freedom
(94 observations deleted due to missingness)
Multiple R-squared: 0.09307, Adjusted R-squared: 0.08722
F-statistic: 15.89 on 5 and 774 DF, p-value: 6.453e-15


There is one problem I already noticed. There is a model violation in ComponentsPl. From there (PL), components are delivered faster to outgoing, but the more components, the longer the time to pack. So "The more components from the faster stockage, the more time"... but anyway.
The second fishy thing is the volume. I can imagine some ideas why high volume could cause shorter time but it would not match my first expectations.



Can somebody review this model and give me hints when I made mistakes?









share







New contributor




Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    I am trying to analyse the correlation of different factors of packagings on the pack-time. This is what I got.



    df <- read.csv2("file",
    header = TRUE, strip.white = TRUE)
    over.all.raw <- as.Date(Shipset.data.frame$Outgoing, origin = "1899-12-30") -
    as.Date(Shipset.data.frame$Start, origin = "1899-12-30")

    over.all.raw <- as.numeric(over.all.raw)

    new.df <- data.frame(over.all.raw)

    new.df <- cbind(over.all.raw, Shipset.data.frame$Weight1,
    Shipset.data.frame$Weightbrutto,
    Shipset.data.frame$Volume,
    Shipset.data.frame$ComponentsLC,
    Shipset.data.frame$ComponentsPl)

    new.df1 <- as.data.frame(new.df)
    colnames(new.df1) <- c("Transporttime", "Weight1", "WeightBrutto", "Volume", "ComponentsLC", "ComponentsPl")

    clean.new.df1<- new.df1[complete.cases(new.df1), ]


    In this example I want to test how the Weight (Brutto or Netto), Volume, and Components from different locations have an influence on the packing time. This is how I made my linear model.



    lm <- lm(Transporttime ~ Weight1 + WeightBrutto + Volume + ComponentsLC + ComponentsPl, data = new.df1)

    summary(lm)


    Residuals:
    Min 1Q Median 3Q Max
    -25.955 -5.074 2.408 7.676 27.353

    Coefficients:
    Estimate Std. Error t value Pr(>|t|)
    (Intercept) 25.81903 0.49060 52.627 < 2e-16 ***
    Weight1 -0.17205 0.09469 -1.817 0.069601 .
    WeightBrutto 0.08748 0.07226 1.211 0.226390
    Volume -6.59973 1.65135 -3.997 7.04e-05 ***
    ComponentsLC 0.04362 0.29912 0.146 0.884107
    ComponentsPl 0.52863 0.14467 3.654 0.000276 ***
    ---
    Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    Residual standard error: 10.57 on 774 degrees of freedom
    (94 observations deleted due to missingness)
    Multiple R-squared: 0.09307, Adjusted R-squared: 0.08722
    F-statistic: 15.89 on 5 and 774 DF, p-value: 6.453e-15


    There is one problem I already noticed. There is a model violation in ComponentsPl. From there (PL), components are delivered faster to outgoing, but the more components, the longer the time to pack. So "The more components from the faster stockage, the more time"... but anyway.
    The second fishy thing is the volume. I can imagine some ideas why high volume could cause shorter time but it would not match my first expectations.



    Can somebody review this model and give me hints when I made mistakes?









    share







    New contributor




    Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to analyse the correlation of different factors of packagings on the pack-time. This is what I got.



      df <- read.csv2("file",
      header = TRUE, strip.white = TRUE)
      over.all.raw <- as.Date(Shipset.data.frame$Outgoing, origin = "1899-12-30") -
      as.Date(Shipset.data.frame$Start, origin = "1899-12-30")

      over.all.raw <- as.numeric(over.all.raw)

      new.df <- data.frame(over.all.raw)

      new.df <- cbind(over.all.raw, Shipset.data.frame$Weight1,
      Shipset.data.frame$Weightbrutto,
      Shipset.data.frame$Volume,
      Shipset.data.frame$ComponentsLC,
      Shipset.data.frame$ComponentsPl)

      new.df1 <- as.data.frame(new.df)
      colnames(new.df1) <- c("Transporttime", "Weight1", "WeightBrutto", "Volume", "ComponentsLC", "ComponentsPl")

      clean.new.df1<- new.df1[complete.cases(new.df1), ]


      In this example I want to test how the Weight (Brutto or Netto), Volume, and Components from different locations have an influence on the packing time. This is how I made my linear model.



      lm <- lm(Transporttime ~ Weight1 + WeightBrutto + Volume + ComponentsLC + ComponentsPl, data = new.df1)

      summary(lm)


      Residuals:
      Min 1Q Median 3Q Max
      -25.955 -5.074 2.408 7.676 27.353

      Coefficients:
      Estimate Std. Error t value Pr(>|t|)
      (Intercept) 25.81903 0.49060 52.627 < 2e-16 ***
      Weight1 -0.17205 0.09469 -1.817 0.069601 .
      WeightBrutto 0.08748 0.07226 1.211 0.226390
      Volume -6.59973 1.65135 -3.997 7.04e-05 ***
      ComponentsLC 0.04362 0.29912 0.146 0.884107
      ComponentsPl 0.52863 0.14467 3.654 0.000276 ***
      ---
      Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

      Residual standard error: 10.57 on 774 degrees of freedom
      (94 observations deleted due to missingness)
      Multiple R-squared: 0.09307, Adjusted R-squared: 0.08722
      F-statistic: 15.89 on 5 and 774 DF, p-value: 6.453e-15


      There is one problem I already noticed. There is a model violation in ComponentsPl. From there (PL), components are delivered faster to outgoing, but the more components, the longer the time to pack. So "The more components from the faster stockage, the more time"... but anyway.
      The second fishy thing is the volume. I can imagine some ideas why high volume could cause shorter time but it would not match my first expectations.



      Can somebody review this model and give me hints when I made mistakes?









      share







      New contributor




      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am trying to analyse the correlation of different factors of packagings on the pack-time. This is what I got.



      df <- read.csv2("file",
      header = TRUE, strip.white = TRUE)
      over.all.raw <- as.Date(Shipset.data.frame$Outgoing, origin = "1899-12-30") -
      as.Date(Shipset.data.frame$Start, origin = "1899-12-30")

      over.all.raw <- as.numeric(over.all.raw)

      new.df <- data.frame(over.all.raw)

      new.df <- cbind(over.all.raw, Shipset.data.frame$Weight1,
      Shipset.data.frame$Weightbrutto,
      Shipset.data.frame$Volume,
      Shipset.data.frame$ComponentsLC,
      Shipset.data.frame$ComponentsPl)

      new.df1 <- as.data.frame(new.df)
      colnames(new.df1) <- c("Transporttime", "Weight1", "WeightBrutto", "Volume", "ComponentsLC", "ComponentsPl")

      clean.new.df1<- new.df1[complete.cases(new.df1), ]


      In this example I want to test how the Weight (Brutto or Netto), Volume, and Components from different locations have an influence on the packing time. This is how I made my linear model.



      lm <- lm(Transporttime ~ Weight1 + WeightBrutto + Volume + ComponentsLC + ComponentsPl, data = new.df1)

      summary(lm)


      Residuals:
      Min 1Q Median 3Q Max
      -25.955 -5.074 2.408 7.676 27.353

      Coefficients:
      Estimate Std. Error t value Pr(>|t|)
      (Intercept) 25.81903 0.49060 52.627 < 2e-16 ***
      Weight1 -0.17205 0.09469 -1.817 0.069601 .
      WeightBrutto 0.08748 0.07226 1.211 0.226390
      Volume -6.59973 1.65135 -3.997 7.04e-05 ***
      ComponentsLC 0.04362 0.29912 0.146 0.884107
      ComponentsPl 0.52863 0.14467 3.654 0.000276 ***
      ---
      Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

      Residual standard error: 10.57 on 774 degrees of freedom
      (94 observations deleted due to missingness)
      Multiple R-squared: 0.09307, Adjusted R-squared: 0.08722
      F-statistic: 15.89 on 5 and 774 DF, p-value: 6.453e-15


      There is one problem I already noticed. There is a model violation in ComponentsPl. From there (PL), components are delivered faster to outgoing, but the more components, the longer the time to pack. So "The more components from the faster stockage, the more time"... but anyway.
      The second fishy thing is the volume. I can imagine some ideas why high volume could cause shorter time but it would not match my first expectations.



      Can somebody review this model and give me hints when I made mistakes?







      statistics r





      share







      New contributor




      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 8 mins ago









      Ernsthaft

      1




      1




      New contributor




      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Ernsthaft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Ernsthaft is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f208914%2fmultivariate-regression-with-5-variables-in-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Ernsthaft is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Ernsthaft is a new contributor. Be nice, and check out our Code of Conduct.













          Ernsthaft is a new contributor. Be nice, and check out our Code of Conduct.












          Ernsthaft is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f208914%2fmultivariate-regression-with-5-variables-in-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Create new schema in PostgreSQL using DBeaver

          Deepest pit of an array with Javascript: test on Codility

          Costa Masnaga