File:Polyreg scheffe.svg
维基共享资源,媒体文件资料库
跳转到导航
跳转到搜索
此SVG文件的PNG预览的大小:540 × 360像素。 其他分辨率:320 × 213像素 | 640 × 427像素 | 1,024 × 683像素 | 1,280 × 853像素 | 2,560 × 1,707像素。
原始文件 (SVG文件,尺寸为540 × 360像素,文件大小:40 KB)
文件信息
结构化数据
说明
摘要
[编辑]描述Polyreg scheffe.svg |
English: Plot of a cubic polynomial fit using multiple least squares to a simulated data set. Along with the point estimate, a 95% simultaneous confidence band (CB) constructed using Scheffe's method is shown. |
日期 | |
来源 | 自己的作品 |
作者 | Skbkekas |
其他版本 |
[编辑]
|
SVG开发 InfoField | |
源代码 InfoField | Python codeimport numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp
## Sample size.
n = 100
## Predictor values.
XV = np.random.uniform(low=-4, high=4, size=n)
XV.sort()
## Design matrix.
X = np.ones((n,4))
X[:,1] = XV
X[:,2] = XV**2
X[:,3] = XV**3
## True coefficients.
beta = np.array([0, 0.1, -0.25, -0.25], dtype=np.float64)
## True response values.
EY = np.dot(X, beta)
## Observed response values.
Y = EY + np.random.normal(size=n)*np.sqrt(20)
## Get the coefficient estimates.
u,s,vt = np.linalg.svd(X,0)
v = np.transpose(vt)
bhat = np.dot(v, np.dot(np.transpose(u), Y)/s)
## The fitted values.
Yhat = np.dot(X, bhat)
## The MSE and RMSE.
MSE = ((Y-EY)**2).sum()/(n-X.shape[1])
s = np.sqrt(MSE)
## These multipliers are used in constructing the Scheffe interval.
XtX = np.dot(np.transpose(X), X)
V = [np.dot(X[i,:], np.linalg.solve(XtX, X[i,:])) for i in range(n)]
V = np.array(V)
## The F quantile used in constructing the Scheffe interval.
QF = sp.fdtri(X.shape[1], n-X.shape[1], 0.95)
## The lower and upper bounds of the confidence band.
D = s*np.sqrt(X.shape[1]*QF*V)
LB,UB = Yhat-D,Yhat+D
## Make the plot.
plt.clf()
plt.plot(XV, Y, 'o', ms=3, color='grey')
plt.plot(XV, EY, '-', color='blue', label = "Truth")
plt.plot(XV, Yhat, '-', color='green', label = "Estimate")
plt.plot(XV, LB, '-', color='red', label = "CB")
plt.plot(XV, UB, '-', color='red')
plt.legend(frameon=False)
plt.ylim([-25,20])
plt.gca().set_yticks([-20,-10,0,10,20])
plt.xlim([-4,4])
plt.gca().set_xticks([-4,-2,0,2,4])
plt.xlabel("X")
plt.ylabel("Y")
plt.savefig("polyreg_scheffe.pdf")
plt.savefig("polyreg_scheffe.svg")
|
许可协议
[编辑]我,本作品著作权人,特此采用以下许可协议发表本作品:
本文件采用知识共享署名 3.0 未本地化版本许可协议授权。
- 您可以自由地:
- 共享 – 复制、发行并传播本作品
- 修改 – 改编作品
- 惟须遵守下列条件:
- 署名 – 您必须对作品进行署名,提供授权条款的链接,并说明是否对原始内容进行了更改。您可以用任何合理的方式来署名,但不得以任何方式表明许可人认可您或您的使用。
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2021年3月8日 (一) 15:27 | 540 × 360(40 KB) | Olexa Riznyk(留言 | 贡献) | Fixed Confidence band ("CB") label | |
2009年4月9日 (四) 21:00 | 341 × 288(51 KB) | Skbkekas(留言 | 贡献) | Added axis labels. | ||
2009年4月9日 (四) 20:54 | 341 × 288(51 KB) | Skbkekas(留言 | 贡献) | {{Information |Description={{en|1=Plot of a cubic polynomial fit using multiple least squares to a simulated data set.}} |Source=Own work by uploader |Author=Skbkekas |Date=April 9, 2009 |Permission= |other_versions= }} <!--{{ImageUploa |
您不可以覆盖此文件。
文件用途
以下3个页面使用本文件:
全域文件用途
以下其他wiki使用此文件:
- ar.wikipedia.org上的用途
- ca.wikipedia.org上的用途
- de.wikipedia.org上的用途
- el.wikipedia.org上的用途
- en.wikipedia.org上的用途
- es.wikipedia.org上的用途
- fa.wikipedia.org上的用途
- fr.wikipedia.org上的用途
- hy.wikipedia.org上的用途
- ja.wikipedia.org上的用途
- ko.wikipedia.org上的用途
- ro.wikipedia.org上的用途
- zh.wikipedia.org上的用途
元数据
此文件含有额外信息,这些信息可能是创建或数字化该文件时使用的数码相机或扫描仪所添加的。如果文件已从其原始状态修改,某些详细信息可能无法完全反映修改后的文件。
宽度 | 432pt |
---|---|
高度 | 288pt |