파일:Polyreg scheffe.svg

testwiki
둘러보기로 이동 검색으로 이동
    원본 파일 (SVG 파일, 실제 크기 540 × 360 픽셀, 파일 크기: 40 KB)

    이 파일은 위키미디어 공용에 있으며, 다른 프로젝트에서 사용하고 있을 가능성이 있습니다. 해당 파일에 대한 설명이 아래에 나와 있습니다.

    파일 설명

    설명
    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
     이 SVG 파일의 소스 코드 문법이 올바릅니다.
     이 벡터 그림은 Matplotlib(으)로 제작되었습니다.
     The file size of this SVG plot may be irrationally large because its text has been converted to paths inhibiting translations.
    소스 코드
    InfoField

    Python code

    import 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")
    

    라이선스

    나는 아래 작품의 저작권자로서, 이 저작물을 다음과 같은 라이선스로 배포합니다:
    w:ko:크리에이티브 커먼즈
    저작자표시
    이 파일은 크리에이티브 커먼즈 저작자표시 3.0 Unported 라이선스로 배포됩니다.
    이용자는 다음의 권리를 갖습니다:
    • 공유 및 이용 – 저작물의 복제, 배포, 전시, 공연 및 공중송신
    • 개작 – 저작물의 개작, 수정, 2차적저작물 창작
    다음과 같은 조건을 따라야 합니다:
    • 저작자표시 – 적절한 저작자 표시를 제공하고, 라이선스에 대한 링크를 제공하고, 변경사항이 있는지를 표시해야 합니다. 당신은 합리적인 방식으로 표시할 수 있지만, 어떤 방식으로든 사용권 허가자가 당신 또는 당신의 사용을 지지하는 방식으로 표시할 수 없습니다.

    설명

    이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다

    이 파일에 묘사된 항목

    다음을 묘사함

    image/svg+xml

    파일 역사

    날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

    날짜/시간섬네일크기사용자설명
    현재2021년 3월 8일 (월) 16:272021년 3월 8일 (월) 16:27 판의 섬네일540 × 360 (40 KB)wikimediacommons>Olexa RiznykFixed Confidence band ("CB") label

    이 파일을 사용하는 문서가 없습니다.