Displaying 2 results from an estimated 2 matches for "linear_regression".
2009 Mar 05
1
hatvalues?
...lm(weight ~ repwt)
hr <- hatvalues(fit)
hr[21]
21
0.1041207
So this matches which is reasusing. My question is this, given the QR transformation and the residuals derived from that transformation what is a simple matrix formula for the hatvalues?
>From http://en.wikipedia.org/wiki/Linear_regression I get
residuals = y - Hy = y(I - H)
or
H = -(residuals/y - I)
> fit <- lm(weight ~ repwt)
> h <- -(residuals(fit)/weight[as.numeric(names(residuals(fit)))] - diag(1,length(residuals(fit)), length(residuals(fit))))
This generates a matrix but I cannot see any coerrelation between this...
2012 Mar 25
0
sm.density kernel estimation for points
...use it with my dataset which has around 46000
points the contours are too much rounded- it makes a circle, but data
has more ellipse shape aproximation. I have tried to work with h
parametr, but without success.
My best result looks:
https://github.com/matejuh/doschecker_wiki_images/raw/master/linear_regression/density/sm_density.png
Btw. if you have some advice how to write example upper better or you
have some suggestion that I can use another library I will appriciate it.
Thanks in advance
Matej Plch