Você está na página 1de 2

> x=1:6

> x
[1] 1 2 3 4 5 6
> y=c(41,42,50,53,54,60)
> y
[1] 41 42 50 53 54 60
> massa=lm(y~x)#modelo de regresso
> massa
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept)
36.600

x
3.829

> b=36.6+3.829*8
> b
[1] 67.232
> cor(x,y)
[1] 0.9747066
> plot(x,y)
> abline(massa,col=3)
> summary (massa)
Call:
lm(formula = y ~ x)
Residuals:
1
2
3
4
5
6
0.5714 -2.2571 1.9143 1.0857 -1.7429 0.4286
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 36.6000
1.7094 21.412 2.81e-05 ***
x
3.8286
0.4389 8.723 0.000952 ***
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

Residual standard error: 1.836 on 4 degrees of freedom


Multiple R-squared: 0.9501,
Adjusted R-squared: 0.9376
F-statistic: 76.08 on 1 and 4 DF, p-value: 0.0009515

> lsfit(x,y)
$coefficients
Intercept
X
36.600000 3.828571
$residuals
[1] 0.5714286 -2.2571429 1.9142857 1.0857143 -1.7428571 0.4285714

$intercept
[1] TRUE
$qr
$qt
[1] -122.4744871
[6] -1.3127266

16.0160634

$qr
Intercept
-2.4494897
0.4082483
0.4082483
0.4082483
0.4082483
0.4082483

[1,]
[2,]
[3,]
[4,]
[5,]
[6,]

X
-8.5732141
4.1833001
-0.0537243
-0.2927700
-0.5318157
-0.7708615

$qraux
[1] 1.408248 1.185321
$rank
[1] 2
$pivot
[1] 1 2
$tol
[1] 1e-07
attr(,"class")
[1] "qr"
>

1.6388172

0.3216359

-2.9955453

Você também pode gostar