I have a code written in IDL that I want to convert to R.
within the code I found this function:
result = linfit(dum_x, dum_y)
y_a= result[0]
y_b= result[1]
"LINFIT function" which fits the paired data { xi , yi } to the linear model, y = A + Bx,
by minimizing the Chi-square error statistic
I wonder if there is a similar function in R? Any ideas How we can convert this line to R :
y_a= result[0]
My guess is
result <- lm(dum_y~dum_x)
y_a <- coef(result)[1]
y_b <- coef(result)[2]
but I don't have access to IDL so I can't check ... you could give a reproducible example with IDL/LINFIT results ...