File:Spearman fig3.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 360 × 341 pixels, file size: 56 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Scatterplot comparing Spearman and Pearson correlation.
    Date
    Source Own work
    Author Skbkekas
    Other versions

    [edit]

    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib.
    Source code
    InfoField

    Sperma code

    import matplotlib.pyplot as plt
    import numpy as np
    
    r = 0.8
    
    X = np.random.normal(size=100)
    Y = r*X + np.sqrt(1-r**2)*np.random.normal(size=100)
    
    ii = np.argsort(-X)
    X[ii[0:5]] *= 3
    
    cp = np.cov(X,Y)
    cp = cp[0,1]/np.sqrt(cp[0,0]*cp[1,1])
    
    XR = np.argsort(np.argsort(X))
    YR = np.argsort(np.argsort(Y))
    
    cr = np.cov(XR,YR)
    cr = cr[0,1]/np.sqrt(cr[0,0]*cr[1,1])
    
    plt.clf()
    plt.figure(figsize=(4,3.8))
    plt.axes([0.17,0.12,0.8,0.75])
    plt.hold(True)
    plt.plot(X, Y, 'o', color='orange')
    plt.grid(True)
    plt.title("Spearman correlation=%.2f\nPearson correlation=%.2f" % (cr,cp))
    plt.xlabel("X", size=16)
    plt.ylabel("Y", size=16)
    plt.savefig("spearman_fig3.pdf")
    plt.savefig("spearman_fig3.svg")
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    18 December 2009

    57,199 byte

    image/svg+xml

    79e7b3f0f7de01ef583356d803f4137c361fd133

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current16:20, 18 December 2009Thumbnail for version as of 16:20, 18 December 2009360 × 341 (56 KB)wikimediacommons>Skbkekas{{Information |Description={{en|1=Scatterplot comparing Spearman and Pearson correlation.}} |Source={{own}} |Author=Skbkekas |Date=2009-12-18 |Permission= |other_versions= }} Category:Statistical diagrams

    There are no pages that use this file.