I have done local linear regression and kernel regression in R with this code:
llr = loess(y~ x1+x2, span=0.1, degree=1) #local linear regression
lcr = loess(y~ x1+x2,span=0.1, degree=0) #kernel regression
Is there a way to get the same results in Matlab?
With the function fit and the fittype lowess I come close to the results in R for local linear regression (degree=1
). However, they are not equal.
The best command I found for kernel regression (degree = 0
) with two independent variables is ksrmv
but when putting in x1
and x2
I cannot set the bandwidth/span manually.
Thanks for your help!