Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to do a partial least squares (PLS) regression using LeastSquares on my data.

The input parameters are temperature, humidity and pressure for a given date. The problem is that some parameters are missing, for example on 6. 9. 2013 the temperature and pressure were recorded, but humidity was not.

m = {

Is it possible to use the available data for days like that, or do I have to leave those days out?

share|improve this question
show how you do it with a complete data set. – george2079 Oct 10 '13 at 18:28
@george2079 The LeastSquares function takes a m×n matrix of input parameters and a list of n output parameters and after doing a regression returns a list of m coefficients. In my case the input parameters are the temperature, humidity and pressure, and the output parameters are the temperatures for the next day. If I use only days with all data recorded it works. – shrx Oct 10 '13 at 18:52
Perhaps the simplest solution is to replace the missing values. A reasonable candidate would be the mean of the missing parameter(s) (so that your data insertion doesn't change the mean of the data). – bill s Oct 10 '13 at 22:54
There is a complete tutorial on "missing data" that may be of help.… – bill s Oct 11 '13 at 0:22
i know what it does, put up some code so people wanting to help don't need to reinvent the wheel. – george2079 Oct 11 '13 at 12:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.