E-mail: s-news@wubios.wustl.edu
Hi!
I tried to draw the bases of B-splines.
The main part of the program is:
xx <- seq(from = 1, by = 0.1, to = 3)
knots <- c(1, 2, 3)
bs1 <- bs(x = xx, knots = knots)
print(bs1)
The result is:
1 2 3 4 5 6
[1,] 1.000 0.00000 0.000 0.00000 0.000 0
[2,] 0.729 0.25675 0.014 0.00025 0.000 0
[3,] 0.512 0.43400 0.052 0.00200 0.000 0
[4,] 0.343 0.54225 0.108 0.00675 0.000 0
[5,] 0.216 0.59200 0.176 0.01600 0.000 0
[6,] 0.125 0.59375 0.250 0.03125 0.000 0
[7,] 0.064 0.55800 0.324 0.05400 0.000 0
[8,] 0.027 0.49525 0.392 0.08575 0.000 0
[9,] 0.008 0.41600 0.448 0.12800 0.000 0
[10,] 0.001 0.33075 0.486 0.18225 0.000 0
[11,] 0.000 0.25000 0.500 0.25000 0.000 0
[12,] 0.000 0.18225 0.486 0.33075 0.001 0
[13,] 0.000 0.12800 0.448 0.41600 0.008 0
[14,] 0.000 0.08575 0.392 0.49525 0.027 0
[15,] 0.000 0.05400 0.324 0.55800 0.064 0
[16,] 0.000 0.03125 0.250 0.59375 0.125 0
[17,] 0.000 0.01600 0.176 0.59200 0.216 0
[18,] 0.000 0.00675 0.108 0.54225 0.343 0
[19,] 0.000 0.00200 0.052 0.43400 0.512 0
[20,] 0.000 0.00025 0.014 0.25675 0.729 0
[21,] 0.000 0.00000 NA NA NA NA
attr(, "knots"):
[1] 1 1 1 1 1 2 3 3 3 3 3
I do not understand why the number of the bases is six instead
of five, and why "NA"s appear on the last row.
***** Kunio Takezawa, Ph.D. (takezawa@affrc.go.jp) *****
***** Research Information Section *****
**** Hokuriku National Agricultural Experiment Station, JAPAN ****
***** <http://www.inada.affrc.go.jp/~takezawa/patent-e.html> *****
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|