0

I have timeline data for inflation (x1) and output (x2) as well as the interest rate (e). I want to check how well the data for x1 and x2 fit to e when e is always supposed to be e = 2 + 1.5x1 + 0.5x2. Thus, I do not want to run a linear regression as the linear function you usually obtain from a lm() is given already (already not the least squared one).

How can I construct a model object from my known equation?

Using the model specified by my equation, I would check the fit (p-value, adjR²) via summary(). I could probably calculate the p-value and adjR² manually, but a simple command would make life much easier.

Rohit Gupta
  • 4,022
  • 20
  • 31
  • 41
nivet3426
  • 11
  • 2
  • Hi Nivet! Welcome to SO. I feel like I'm not exactly sure what you data look like and what you're trying to do, but if you want some functions to get you started, check this out: https://stackoverflow.com/a/40142643/8400969 – Michael Roswell Apr 10 '23 at 15:43
  • Thank you Michael! As in your recommended link, I could certainly calculate the p-value and adjR² manually. But as this is a multi-variable function, this becomes quite complicated for me. Therefore, I would prefer a simple command similar to summary() that hands out the results in one piece. – nivet3426 Apr 12 '23 at 08:37
  • Can you fix the model coefficients using `offset` and create the model object using `lm`? https://stackoverflow.com/a/30626896/8400969; https://stackoverflow.com/a/27030807/8400969 – Michael Roswell Apr 12 '23 at 12:39
  • I have tried, but using `offset` makes that `lm` does not treat them as variables anymore. Therefore, I don't get any information on their fit (especially p-value). Beside that, if I fix all the variables, it cannot calculate any adjR² either (which is obvious without any variables). To me the `lm` command does not seem right here, as I do not want to create a least-square regression line – nivet3426 Apr 13 '23 at 08:35
  • Seems like an interesting problem. Have you looked around at `qr`? – Michael Roswell Apr 13 '23 at 14:48
  • Ah, ok, I totally misread your post before. Do you have an error term in your "known" regression model? Or is the error something you'd have to estimate from your data? – Michael Roswell Apr 13 '23 at 15:39

0 Answers0