# Is it possible to make a regression with known standard error on y

I want to compare estimate with standard error in function of a continuous variable and a categorial variable . Here an example of what my data look like.

y   stdy   ConVar  CatVar
1.3    0.1    1    Bob
2.4   0.4     1    Bob
1.5    0.3    2    Bob
3.6    0.2    3    Henri
...


I would like to perform a regression of my y estimate in function of the ConVar in first place. Then I would like to compare the estimate in function of the categorial variable.

I want to rectify my slope and average comparaison with the known standard error (stdy).

Is it possible .

I know orthogonal regression to compare two variables with known error but I don't known of a regression in which I can input standard error only on the y value.

Is that would do it if I do a mean of the standard error. mean of the standard error is sqrt(sum(std^2)/numberofobs^2)

library(MethComp)
Deming(ConVar,y,stdy, boot=FALSE, keep.boot=FALSE, alpha=0.05)


Thanks

• I would use weighted regression. E..g, the varFixed or varIdent structures from package nlme (which can be passed to the gls function) might be useful. Dec 2, 2015 at 15:29

Thanks to Roland,

I have solve this problem.

If someone is looking to adjust the slope of a regression in function of a known error on the dependent variable, the function varIdent is very useful.

Here is the reference for the package nlme in which you find this function !

Pinheiro J, Bates D, DebRoy S, Sarkar D and R Core Team (2015). nlme: Linear and Nonlinear Mixed Effects Models. R package version 3.1-122, http://CRAN.R-project.org/package=nlme>.

I also provide an example of my solution :

data\$Var<-stdy^2
mod<-gls(y~x, weight=varIdent(Var), data = data)
summary(mod)


The varIdent is allow us the input a known variance value.

If someone has a better solution or think I have a problem with this code , please contact me but I think it's all good !

Thanks again to Roland