> x <- 1:11
> y <- sin(x)
> fit3 <- lm(y ~ x + x^2 + x^3)
> summary(fit3)
Call: lm(formula = y ~ x + x^2 + x^3)
Residuals:
Min 1Q Median 3Q Max
-0.6674 -0.3767 0.03571 0.4061 0.6786
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) 3.0812 0.9753 3.1594 0.0159
x -2.1496 0.6731 -3.1937 0.0152
I(x^2) 0.4070 0.1275 3.1918 0.0152
I(x^3) -0.0224 0.0070 -3.1958 0.0152
Residual standard error: 0.5507 on 7 degrees of freedom
Multiple R-Squared: 0.6454
F-statistic: 4.246 on 3 and 7 degrees of freedom, the p-value is 0.05257
Correlation of Coefficients:
(Intercept) x I(x^2)
x -0.9298
I(x^2) 0.8498 -0.9781
I(x^3) -0.7845 0.9389 -0.9891
> coef(fit3)
(Intercept) x I(x^2) I(x^3)
3.081168 -2.149645 0.4069789 -0.02239129
Is this what you want?
spencer graves
zahra ghenima wrote:
Hello
I have a function that I must codify with S-plus. In the function I
have to
determine the coefficients of the polynomial : (1+x+x^2+...+x^m)^n,
with x is
any variable and m, n take any natural value. How, we can define a
polynomial, develop the polynomial
and extract the coefficients of the polynomial developped with Splus.
I wait from you an answer as soon as possible
thank you
Yours faithfully
------------------------------------------------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail
<http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/mail/mail_taglines/default/*http://fr.benefits.yahoo.com/>
Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
<http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com/>
|