[R-SIG-Finance] help on coef()
Hodgess, Erin
HodgessE at uhd.edu
Mon Aug 31 22:15:19 CEST 2009
Hi Gaspar:
I'm probably oversimplifying, but you could try:
> x <- 1:10
> y <- 3 + 2*x + runif(10)
> x.lm <- lm(y~x)
> summary(x.lm)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-0.43425 -0.19559 0.03431 0.20469 0.40409
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.79881 0.20145 18.86 6.46e-08 ***
x 1.97021 0.03247 60.69 6.04e-12 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2949 on 8 degrees of freedom
Multiple R-squared: 0.9978, Adjusted R-squared: 0.9976
F-statistic: 3683 on 1 and 8 DF, p-value: 6.042e-12
> x.lm$coef[1]
(Intercept)
3.798807
>
-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch [mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Gaspar Núñez
Sent: Monday, August 31, 2009 1:48 PM
To: r-sig-finance at stat.math.ethz.ch
Subject: [R-SIG-Finance] help on coef()
Hi
i´m starting to work with R to do some regressions
now, i need to extract a single estimated coeficient
so that i can use it for further calculations
i´ve been trying the coef() command (unsuccesfully)
the 3000 pages reference manual does not give enough info,
is there a way that one can solve these kind of problems
without wasting so much time to find about an apparently
simple command?
regards
--
Gaspar
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list