Open pcarbo opened 3 days ago
Hi @pcarbo ,
It is less straightforward in this context. The main problem about fitted values/prediction is that to run fsusie, the Y matrix is expected to have 2^J columns, and when it is not the case, we actually remap the data using an interpolation scheme so that there are 2^J columns (see intro vignette section #### Handling function of any length and unevenly space data) . So the actual output of fsusie is a list of the fitted functions of length 2^J
So, the "real" predictions are actually made on this grid. How should we proceed? Should we make different "predict" functions, one that uses the estimate and the other one that outputs an "interpolated version" of the prediction on the original grid?
@william-denault It is important to output the intercept for several reasons, but one is that it is often helpful to be able to use the model to predict Y (e.g., to compare the observed Y with the predicted Y). This also provides a simple "sanity check" to make sure that the model fitting is working. You will notice that susieR has two related features: (i) it returns the "fitted" values (in
fit$fitted
) and (ii) it has a "predict" method. Here's an example of what I mean:(In this case,
fit$fitted
andypred
give the same result.)I suggest implementing (i) and (ii) for fsusieR, which should be straightforward once you have the intercept.
Note that the intercept is not simply the the mean of Y, but the mean after removing the effects of the SNPs. See line 460 of susie.R for how this is implemented in susieR. The general formula looks something like this:
$$ (Z^TZ)^{-1} Z\bar{r}, \quad \bar{r} = y - X\bar{b} $$
For an intercept, Z is simply a column of ones.