R语言predict函数用法

R语言predict函数用法

predict(object, newdata, se.fit = FALSE, scale = NULL, df = Inf,
interval = c(“none”, “confidence”, “prediction”),
level = 0.95, type = c(“response”, “terms”),
terms = NULL, na.action = na.pass,
pred.var = res.var/weights, weights = 1, …)

参数:object

Object of class inheriting from “lm”.
继承类的对象从“lm”。

参数:newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.
一个可选的数据框寻找与预测的变数。如果省略,用来拟合值。

参数:se.fit

A switch indicating if standard errors are required.
一个开关,如果需要标准误差。

参数:scale

Scale parameter for std.err. calculation.
尺度参数std.err的计算。

参数:df

Degrees of freedom for scale
度规模的自由。

参数:interval

Type of interval calculation.
区间计算的类型。其中,若interval=“prediction”,则返回在默认置信水平为95%下的置信区间(lwr为区间左端,upr为区间右端);若interval=“confidence”,则返回预测值的预测范围区间。

参数:level

Tolerance/confidence level.
宽容/置信水平。

参数:type

Type of prediction (response or model term).
预测型(反应或模型长期)。

参数:terms

If type=”terms”, which terms (default is all terms).
如果type=”terms”,则默认是所有条款。

参数:na.action

function determining what should be done with missing values in newdata. The default is to predict NA.
功能确定应做与newdata缺失值,默认预测NA。

参数:pred.var

the variance(s) for future observations to be assumed for prediction intervals.
要承担未来的观测方差(S)的预测区间。

参数:weights

variance weights for prediction. This can be a numeric vector or a one-sided model formula. In the latter case, it is interpreted as an expression evaluated in newdata.
预测方差权。这可以是一个数值向量或片面的模型公式。在后一种情况下,它被解释为表达newdata的评价。

例如:

> yy<-predict(fm,newdata = data.frame(X1=220,X2=2500),interval="confidence")
> yy
    fit   lwr   upr
1 135.6 134.1 137.1
> yy<-predict(fm,newdata = data.frame(X1=220,X2=2500),interval="prediction")
> yy
    fit   lwr   upr
1 135.6 130.6 140.5
  • 13
    点赞
  • 104
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

上官峰晨

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值