title: Prediction of 'mlm' linear model object from `lm()`
body: <p>I have three datasets:</p>
  
  <p>response - matrix of 5(samples) x 10(dependent variables)</p>
  
  <p>predictors - matrix of 5(samples) x 2(independent variables)</p>
  
  <p>test_set - matrix of 10(samples) x 10(dependent variables defined in response)</p>
  
  <pre><code>response &lt;- matrix(sample.int(15, size = 5*10, replace = TRUE), nrow = 5, ncol = 10)
  colnames(response) &lt;- c("1_DV","2_DV","3_DV","4_DV","5_DV","6_DV","7_DV","8_DV","9_DV","10_DV") 
  predictors &lt;- matrix(sample.int(15, size = 7*2, replace = TRUE), nrow = 5, ncol = 2)
  colnames(predictors) &lt;- c("1_IV","2_IV")
  test_set &lt;- matrix(sample.int(15, size = 10*2, replace = TRUE), nrow = 10, ncol = 2)
  colnames(test_set) &lt;- c("1_IV","2_IV")
  </code></pre>
  
  <p>I'm doing a multivariate linear model using a training set defined as the combination of response and predictor sets, and I would like to use this model to make predictions for the test set:</p>
  
  <pre><code>training_dataframe &lt;- data.frame(predictors, response)
  fit &lt;- lm(response ~ predictors, data = training_dataframe)
  predictions &lt;- predict(fit, data.frame(test_set))
  </code></pre>
  
  <p>However, the results for predictions are really odd:</p>
  
  <pre><code>predictions
  </code></pre>
  
  <p>First off the matrix dimensions are 5 x 10, which is the number of samples in the response variable by the number of DVs. </p>
  
  <p>I'm not very skilled with this type of analysis in R, but shouldn't I be getting a 10 x 10 matrix, so that I have predictions for each row in my test_set?</p>
  
  <p>Any help with this issue would be greatly appreciated,
  Martin</p>