Hi,

 

Thank you all.  I’ve got it working.  I have learnt a lot today.  I had to learn that the open command needed “ “ around my file location path as it wasn’t in the Gretl folder and when using # I need to leave a space.  But it works.  I’ve just got to decide whether I can teach it to my students!

 

My initial error was because I was using the green arrow to run the programme, which is what SPSS has and not the two cogs! I feel quite silly.

 

Thank you very much

 

Alison

 

From: Riccardo (Jack) Lucchetti <p002264@staff.univpm.it>
Sent: Tuesday, January 30, 2024 2:03 PM
To: gretl-users@gretlml.univpm.it
Subject: [EXTERNAL] [Gretl-users] Re: First time user of Hansl and creating a matrix of Spearmans correlation

 

*** CAUTION - EXTERNAL EMAIL. Think before replying, opening attachments, or clicking any links. If in doubt, please forward to phishing@northampton.ac.uk or click ‘Report Phishing’ button. ***

On 30/01/2024 14:19, Artur T. wrote:
> Hi Alison,
>
> there are some errors with the syntax:

[...]

Here's a slight variation on Artur's script, that doesn't give you
tstats and pvalues, but what you get is more similar to a "traditional"
correlation matrix:

<hansl>
function matrix spearman_matrix(list variables)
n = nelem(variables)
strings names = varnames(variables)
matrix SC = I(n)

loop i = 1..n
loop j = 1..i-1
# Calculate Spearman correlation and p-value
scalar rij = npcorr(variables[j], variables[i], spearman)[1]
SC[i,j] = rij
SC[j,i] = rij
endloop
endloop

# Set row and column names
rnameset(SC, names)
cnameset(SC, names)

return SC
end function
</hansl>


-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)

Università Politecnica delle Marche
(formerly known as Università di Ancona)

r.lucchetti@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it
Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/


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.