動作環境
RStudio 0.99.903 on Windows 7 pro
R version 3.3.1
R機能マップ http://qiita.com/7of9/items/0f911bcb95d3a8bbd703
サンプルデータを作っているとノイズを足したくなる。
jitter()というのがあるようだ。
参考 https://stat.ethz.ch/R-manual/R-devel/library/base/html/jitter.html
やってみた。
> x<-1:10
> y<-jitter(x, factor=10)
> plot(y)
直線データにノイズが足された。
ノイズ付加したデータをlsfit()で見てみた。
> z<-lsfit(1:10,y)
> z
$coefficients
Intercept X
0.006796537 1.038853321
$residuals
[1] -1.49509932 0.48895678 -0.42771788 0.04735133
[5] 1.10582436 1.39600966 0.75062550 -0.98962267
[9] 0.86836521 -1.74469297
$intercept
[1] TRUE
$qr
$qt
[1] -18.0897771 9.4358539 -0.1731444 0.3756662
[5] 1.5078805 1.8718072 1.3001643 -0.3663425
[9] 1.5653867 -0.9739301
$qr
Intercept X
[1,] -3.1622777 -17.39252713
[2,] 0.3162278 9.08295106
[3,] 0.3162278 0.15621147
[4,] 0.3162278 0.04611510
[5,] 0.3162278 -0.06398128
[6,] 0.3162278 -0.17407766
[7,] 0.3162278 -0.28417403
[8,] 0.3162278 -0.39427041
[9,] 0.3162278 -0.50436679
[10,] 0.3162278 -0.61446316
$qraux
[1] 1.316228 1.266308
$rank
[1] 2
$pivot
[1] 1 2
$tol
[1] 1e-07
attr(,"class")
[1] "qr"
