locked
Weighted Least Squares RRS feed

  • Question

  • Hello,

         Is it possible to use Infer.net to perform a weighted least squares regression or its equivalent? The situation I am envisioning has a dependent continuous variable W that may be dependent on three other independent continuous variables X, Y and Z. The variable X is a legitimate predictor variable. However, in addition to acting as predictors on W, the variables Y and Z also serve to introduce proportional random noise when they are present. Thus, the larger Y and Z become, the smaller the precision of the the regression fit for W. For the problem I am looking at, it is reasonable to assume that the variance in W is directly proportional to both Y and Z. I have tried this in Infer.net by developing a precision function that is dependent of Y and Z and have not been successful, because the solution typically fails in the compile phase. I am considering using the Y and Z variables to scale and transform the other variables, but was wondering if you had any suggestions.

    Thanks, and regards,

    Philip

    Wednesday, June 20, 2012 1:38 AM

All replies

  • You should use Y and Z as scale factors not precision variables.  Something like this:
    var mW = X*wX + Y*Variable.GaussianFromMeanAndPrecision(wY, precY);
    var W = Variable.GaussianFromMeanAndPrecision(mW, precW);
    Wednesday, June 20, 2012 4:52 PM
    Owner
  • Thank you, it looks like that did the trick.

    Philip

    Tuesday, June 26, 2012 9:34 PM