R - 将线性模型扩展到 scatterplot3d 之外 [英] R - Extending Linear Model beyond scatterplot3d
本文介绍了R - 将线性模型扩展到 scatterplot3d 之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经创建了一个应用了线性模型的 scatterplot3d.
I have created a scatterplot3d with a linear model applied.
不幸的是,LM 的结果是微妙的,需要强调,我的问题是如何将 LM 网格扩展到立方体"之外.
Unfortunately the results of the LM are subtle and need to be emphasised, my question is how can I extend the LM grid outside of the 'cube'.
剧情:
代码:
Plot1 <-scatterplot3d(
d$MEI,
d$YYYYMM,
d$AOELog10,
pch=20,
grid = FALSE,
color = "black",
xlab="MEI",
ylab="Date",
zlab="AOE Log(10)"
)
fit <- lm(d$AOELog10 ~ d$MEI+d$Rank)
Plot1$plane3d(fit)
现在我猜它可能是 lm() 中的一个变量,但我找不到任何东西....
Now I guess it might be a variable within lm(), but I cant find anything....
推荐答案
要查看更大的区域或感兴趣的区域,请在散点图命令中指定 x、y 和 z 限制.
To see a larger region, or region of interest, specify the x, y, and z limits in the scatterplot command.
library(scatterplot3d)
d<-data.frame(MEI=runif(200,-3,3),
YYYYMM=runif(200,1,300),
AOELog10=runif(200,1,20),
Rank=runif(200,1,5))
fit <- lm(d$AOELog10 ~ d$MEI+d$Rank)
Plot1 <-scatterplot3d(
d$MEI, d$YYYYMM, d$AOELog10,
pch=20, grid = FALSE, color = "black",
xlab="MEI", ylab="Date", zlab="AOE Log(10)",
main="baseline"
)
Plot1$plane3d(fit)
Plot2 <-scatterplot3d(
x=d$MEI, y=d$YYYYMM, z=d$AOELog10,
pch=20, grid = FALSE, color = "black",
xlab="MEI", ylab="Date", zlab="AOE Log(10)",
xlim = c(-5,5), ylim = c(-50,400), zlim = c(-10,50), # Specify the plot range
main="larger region"
)
Plot2$plane3d(fit)
这篇关于R - 将线性模型扩展到 scatterplot3d 之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文