トップ 差分 一覧 ソース 検索 ヘルプ RSS ログイン

BugTrack-R備忘録/33

R備忘録 /状態空間モデリング/donlp2/その他のメモ

R備忘録 - 記事一覧

loess(手っ取り早く、滑らかな平面を描くならこれ)

  • 投稿者: みゅ
  • カテゴリ: なし
  • 優先度: 普通
  • 状態: 完了
  • 日時: 2009年06月09日 08時57分25秒

内容

  • loess
    • Fit a polynomial surface determined by one or more numerical predictors, using local fitting
    • まあ、手っ取り早く、滑らかな平面を描くならこれ

library(scatterplot3d)
library(lattice)
x_smpl <- sample(1:87,20)
y_smpl <- sample(1:61,20)
xy <- expand.grid(x=x_smpl, y=y_smpl)
hight <- double(length(x_smpl)*length(y_smpl))
for( ii in 1:length(hight)){
    hight[ii] <- volcano[xy[ii,1], xy[ii,2]]
} 
volSmpl <- cbind(hight=hight, xy)
scatterplot3d(x=volSmpl$x, y=volSmpl$y, z=volSmpl$hight, highlight.3d=TRUE, pch=20)
vol <-loess(hight~x+y, data=volSmpl, span=0.05)
volPred <- predict(vol, expand.grid(x=1:87, y=1:61))
levelplot(volPred)
levelplot(volPred, col.regions=heat.colors(100), cuts=100)
wireframe(volPred, shade = TRUE)

コメント