Hi,
Thank you
Alison
Sent from Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Cottrell, Allin <cottrell(a)wfu.edu>
Sent: Monday, December 18, 2023 12:07:20 PM
To: Gretl list <gretl-users(a)gretlml.univpm.it>; Alison Loddick
<Alison.Loddick(a)northampton.ac.uk>
Subject: [EXTERNAL] Spearman's correlations
*** CAUTION - EXTERNAL EMAIL. Think before replying, opening attachments, or clicking any
links. If in doubt, please forward to
phishing@northampton.ac.uk<mailto:phishing@northampton.ac.uk> or click ‘Report
Phishing’ button. ***
I've been asked about how to get a bunch of Spearman correlations in
matrix form. This can be done using the npcorr() function. Here's an
example.
<hansl>
function matrix spearman_mat (list L)
matrix SC = {}
strings rnames = array(0)
n = nelem(L)
loop i=1..n
loop j=1..i-1
SC |= npcorr(L[j], L[i], spearman)
rnames += sprintf("%s_%s", varname(L[j]), varname(L[i]))
endloop
endloop
cnameset(SC, defarray("spearman", "t-stat", "p-value"))
rnameset(SC, rnames)
return SC
end function
open data4-10
list L = dataset
matrix SC = spearman_mat(L)
print SC
</hansl>
Allin Cottrell
University of Northampton: Transforming Lives and Inspiring Change
www.northampton.ac.uk
This e-mail is private and may be confidential and is for the intended recipient only. If
you are not the intended recipient you are strictly prohibited from using, printing,
copying, distributing or disseminating this e-mail or any information contained in it. We
virus scan all E-mails leaving The University of Northampton but no warranty is given that
this E-mail and any attachments are virus free. You should undertake your own virus
checking. The right to monitor E-mail communications through our networks is reserved by
us.
Disclaimer
The information contained in this communication from the sender is confidential. It is
intended solely for use by the recipient and others authorized to receive it. If you are
not the recipient, you are hereby notified that any disclosure, copying, distribution or
taking action in relation of the contents of this information is strictly prohibited and
may be unlawful.
This email has been scanned for viruses and malware, and may have been automatically
archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates
email defenses with brand protection, security awareness training, web security,
compliance and other essential capabilities. Mimecast helps protect large and small
organizations from malicious activity, human error and technology failure; and to lead the
movement toward building a more resilient world. To find out more, visit our website.