Hi All,
I have never used Hansl or Gauss before and I am trying to work out how to get
a programme working to create a matrix of spearman correlations. Allin created
one last month, which I tried to run and kept getting 'No redo information
available'. Rather than coming running and asking for help I went to Chat GPT
asked it what it meant which has gone over my head. I also asked it to decrible
each line of the programme as I've done some programming decades ago. So I
asked Chat gpt to create me a programme which is very similar to Allin's but
with my filename in and variable names in. I get the same error. I'm wondering
if someone could direct me into what I should be doing. My data file is
Panel2.gdt and I have four variable ROE, ENV,SOC and GOV. It is a panel
datafile which is already set up as panel data. The programme from ChatGPT is
the following. Please can someone be helpful to a novice I'm sure there is
something very simple that I don't know what to do.
// Function to calculate Spearman correlations and p-values for a list of
variables
function matrix spearman_matrix(list variables)
matrix SC = {};
strings rnames = array(0);
n = nelem(variables);
loop i = 1..n
loop j = 1..i-1
// Calculate Spearman correlation and p-value
SC |= npcorr(variables[j], variables[i], spearman);
// Construct row names
rnames += sprintf("%s_%s", varname(variables[j]),
varname(variables[i]));
endloop
endloop
// Set column names
cnameset(SC, defarray("Spearman", "t-stat", "p-value"));
// Set row names
rnameset(SC, rnames);
return SC;
end function;
// Open your dataset
open panel2.gdt;
// Specify the variables of interest
list variables = deflist("ROE", "ENV", "SOC", "GOV");
// Calculate Spearman correlations and p-values
matrix SC_matrix = spearman_matrix(variables);
// Print the resulting matrix
print SC_matrix;
Thank you for any help
Alison
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.
_______________________________________________
Gretl-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Website:
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/