-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapping lm() function #10
Comments
About the errors you see, these functions were a quick proof of concept tailored to... what you see in that post, basically, and weren't tested with other arguments or other ways to specify the formula. There is a lot to experiment to make those wrappers reliable enough, and that's why they are not part of the package already. Also, wrapping
Not sure if I understand correctly. The
As discussed in that link, the loss function for a linear regression doesn't take into account the uncertainty of individual y values. There is a prediction interval and a mean prediction interval. Both of them involve the variance in the x-axis, but not in the y-axis. If you want to consider the latter, then you are looking for another kind of model. |
I just modified the qlm function by adding an extra parameter for weights. In this way, it is possible to carry out a weighted regression. |
It's because
Ok, you mean the confidence interval. I don't think that the CI should be used as the uncertainty in the result. It has a different meaning than the standard error, and depends on the significance level you choose. The standard error does not depend on that. However, there are two confidence intervals: the mean response interval and the prediction interval. And now that you mention it, I believe that the
I have this tutorial that may be of interest. |
Hi everybody,
I open this issue in order to review any problems that I observed with lm function and the package quantiles.
I have reviewed the documentation. Specifically at the following link (https://www.r-spatial.org/r/2018/08/31/quantities-final.html#fitting-linear-models-with-quantities), it is very well specified how to include specific methods to use lm with the package quantities.
First of all, note that this is the first time I have tried to include experimental error in linear regression models. The first question that arises is whether to consider a regression weighing with the uncertainty of the response variable. It is a correct approach?
I have tried to include the weight parameter to the qlm function and it is not able to get the model. The error obtained is the following:
I have reviewed the function definition and this supports additional parameters.
The other problem that I have noticed is the presence of a warning in the coef.qlm function. When the formula to be applied in the function is defined with interaction variables of type x1: x2 (the special nomenclature of th lm function), the following warning is obtained:
On the other hand, If I applied the following definition for the formula parameter the warning disappears:
The results seem corrects but a warning is present in the first method.
An other question is about the summary obtained for this qlm objects. If I print the summary the Std. Error of the coefficients is not the same as te previous one (coef(Model_Wc)).
Other problem is how to define the uncertainty for the variables involved in the regression model? Is necessary to define as standard uncertainty or is it possible to define as an expanded uncertainty and to obtaint the correct error for the coefficients when I apply coef function?
Finally, the last question is about the predict function for qlm objects. In the linked reported, it defines specific methods for qlm objects too. I have reviewed the function and it only applies the set_quantities function and it activates the native parameter se.fit. Is the obtained error correct? The se.fit parameter only activates the native confidenze intervals for the lm function. Are not necessary to take into account the experimental uncertainties for the calculation of the response variable error?
This problem is discussed in https://stats.stackexchange.com/questions/235693/linear-model-where-the-data-has-uncertainty-using-r but the final solution involves using the root python packe.
Sorry for the many doubts and thanks in advance
The text was updated successfully, but these errors were encountered: