predict.nls
位於 stats
包(package)。 說明
predict.nls
生成通過評估框架 newdata
中的回歸函數獲得的預測值。如果邏輯 se.fit
是 TRUE
,則計算預測的標準誤差。如果設置了數字參數 scale
(帶有可選的 df
),則將其用作標準誤差計算中的殘餘標準差,否則從模型擬合中提取。設置 intervals
指定在指定的 level
處計算置信度或預測(容差)區間。
目前se.fit
和interval
被忽略。
用法
## S3 method for class 'nls'
predict(object, newdata , se.fit = FALSE, scale = NULL, df = Inf,
interval = c("none", "confidence", "prediction"),
level = 0.95, ...)
參數
object |
繼承自類 |
newdata |
一個命名列表或 DataFrame ,用於查找用於預測的變量。如果 |
se.fit |
指示是否應計算預測的標準誤差的邏輯值。默認為 |
scale |
數字標量。如果已設置(使用可選的 |
df |
一個正數值標量,給出 |
interval |
指示是否要計算平均響應的預測區間或置信區間的字符串。目前這一論點被忽略。 |
level |
0 到 1 之間的數字標量,給出要計算的間隔(如果有)的置信水平。目前這一論點被忽略。 |
... |
附加可選參數。目前沒有使用可選參數。 |
值
predict.nls
生成預測向量。實現後, interval
將生成一個預測和邊界矩陣,列名稱為 fit
、 lwr
和 upr
。實現後,如果 se.fit
是 TRUE
,將返回包含以下組件的列表:
fit |
向量或矩陣如上 |
se.fit |
預測的標準誤差 |
residual.scale |
殘餘標準差 |
df |
殘差自由度 |
注意
首先在 newdata
中查找變量,然後以通常的方式搜索(其中包括擬合中使用的公式的環境)。如果找到的變量長度與 newdata
中提供的變量長度不同,則會發出警告。
例子
require(graphics)
fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
predict(fm) # fitted values at observed times
## Form data plot and smooth line for the predictions
opar <- par(las = 1)
plot(demand ~ Time, data = BOD, col = 4,
main = "BOD data and fitted first-order curve",
xlim = c(0,7), ylim = c(0, 20) )
tt <- seq(0, 8, length.out = 101)
lines(tt, predict(fm, list(Time = tt)))
par(opar)
也可以看看
相關用法
- R predict.smooth.spline 通過平滑樣條擬合進行預測
- R predict.HoltWinters 擬合 Holt-Winters 模型的預測函數
- R predict.loess 預測黃土曲線或表麵
- R predict.Arima ARIMA 的預測適合
- R predict.lm 線性模型擬合的預測方法
- R predict.glm GLM 擬合的預測方法
- R predict 模型預測
- R preplot 繪圖對象的預計算
- R profile.nls 分析 nls 對象的方法
- R proj 模型預測
- R prcomp 主成分分析
- R printCoefmat 打印係數矩陣
- R profile 分析模型的通用函數
- R prop.test 等比例或給定比例檢驗
- R profile.glm 分析 glm 對象的方法
- R print.ts 時間序列對象的打印和格式化
- R prop.trend.test 檢驗比例趨勢
- R princomp 主成分分析
- R print.power.htest 假設檢驗和功效計算對象的打印方法
- R plot.stepfun 繪製階躍函數
- R pairwise.t.test 成對 t 檢驗
- R plot.profile.nls 繪製 profile.nls 對象
- R plot.isoreg isoreg 對象的繪圖方法
- R plot.HoltWinters HoltWinters 對象的繪圖函數
- R ppoints 概率圖的坐標
注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Predicting from Nonlinear Least Squares Fits。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。