[R] glm.fit and pearson's correlation coefficient
dzuc
dannytsuker at gmail.com
Wed Feb 8 16:42:37 CET 2012
I did a linear correlation of data using glm.fit and stored the output in the
object "f":
f <- glm.fit(x, y, w)
I am intereseted in estimating the quality of the correlation. I am used to
do it using pearson correlation coefficient "r" or "r^2". Can I extract this
coefficient from the output of glm.fit?
Is there another number in the output of glm.fit that represents the quality
of the correlation?
Here is a printout of the object f:
$coefficients
[1] 95772.92
$residuals
[1] -5146.208 -17221.948 -12743.726 -14536.236 -36311.931 -33651.931
[7] -75054.063 -73207.873 -136695.506 -142442.126 -268970.512 -260546.762
[13] -281117.024 -247116.524 9115.715 64791.715
$fitted.values
[1] 74702.88 74702.88 149405.76 149405.76 299769.24 299769.24
[7] 598580.75 598580.75 1197161.51 1197161.51 2394323.01 2394323.01
[13] 4788646.02 4788646.02 57463752.29 57463752.29
$effects
-81641362.05 -17217.24 -12734.32 -14526.83 -36293.05
-33633.05
-75016.37 -73170.18 -136620.11 -142366.73 -268819.73
-260395.98
<NA>
-280815.45 -246814.95 12734.59 68410.59
$R
[,1]
[1,] -852.4472
$rank
[1] 1
$qr
$qr
[,1]
[1,] -8.524472e+02
[2,] 9.150126e-04
[3,] 1.830025e-03
[4,] 1.830025e-03
[5,] 3.671781e-03
[6,] 3.671781e-03
[7,] 7.331832e-03
[8,] 7.331832e-03
[9,] 1.466366e-02
[10,] 1.466366e-02
[11,] 2.932733e-02
[12,] 2.932733e-02
[13,] 5.865466e-02
[14,] 5.865466e-02
[15,] 7.038559e-01
[16,] 7.038559e-01
$rank
[1] 1
$qraux
[1] 1.000915
$pivot
[1] 1
$tol
[1] 1e-11
attr(,"class")
[1] "qr"
$family
Family: gaussian
Link function: identity
$linear.predictors
[1] 74702.88 74702.88 149405.76 149405.76 299769.24 299769.24
[7] 598580.75 598580.75 1197161.51 1197161.51 2394323.01 2394323.01
[13] 4788646.02 4788646.02 57463752.29 57463752.29
$deviance
[1] 337719889404
$aic
[1] 429.7723
$null.deviance
[1] 5.570009e+15
$iter
[1] 2
$weights
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
$prior.weights
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
$df.residual
[1] 15
$df.null
[1] 15
$y
[1] 69556.67 57480.93 136662.03 134869.52 263457.31 266117.31
[7] 523526.69 525372.88 1060466.00 1054719.38 2125352.50 2133776.25
[13] 4507529.00 4541529.50 57472868.00 57528544.00
$converged
[1] TRUE
$boundary
[1] FALSE
> coefficients(f1)
[1] 95772.92
--
View this message in context: http://r.789695.n4.nabble.com/glm-fit-and-pearson-s-correlation-coefficient-tp4369811p4369811.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list