In R, I have data in a dataframe (y,x1,x2,x3) and a model (lm(y ~ x1+x2+x3)). What package(s) or function(s) will help me (easily) translate this data (or model) into an Error in Variables model that will calculate prediction intervals for predicted y?
I have used lm(), glm(), gam(), predict(), ... functions which assume no measurement error in the independent x-variables. However, I am hoping to make predictions on y that account for assumed measurement error in the x-variables. I don't know where to start with EiV models and thought stackoverflow could help.
To start, I am looking for R package() or function() name.
Currently:
- model= lm(y ~ x1+x2+x3, data= df)
- predicted y = predict.lm(object= model, newdata= df, interval= "prediction", type= "response")
- y1 = 100, CI= 80,120
What I want to do is replicate this procedure with a "standard" Error-in-Variables model to get:
- y1 = 102, CI= 78,125
Secondly, will I be able to separate the width of the interval due to errors in measurement of x1, x2, and x3 from the width of the interval due to variance of residuals? I am interested in the former.
- E.g., y1 = 102, CI= 78,125 (CI-due-only-to-measurement-error-in-x-variables= 100,103)