Skip to content

Extends Stata's egen command to calculate Spearman's rank correlation coefficient

Notifications You must be signed in to change notification settings

rpowers/spearman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

#egen scorr() This small program extends the egen command in Stata. It calculates the Spearman's rank correlation coefficient between two variables using the egen command and stores it in a new variable. This is most useful when combined with the by: or bysort: syntax.

##To Install Place the _gscorr.ado file in your user ado directory (e.g, ~/Library/Application Support/Stata/plus/ado/_).

##Syntax To generate a new variable called varname that stores the Spearman's Rank correlation coefficient between two variables use:

egen newvar = scorr(existingvar1 existingvar2)

You can optionally—and perhaps most usefully—combine this command with the by: or bysort: syntax:

by A: B = scorr(existingvar1 existingvar2)
bysort A: B = scorr(existingvar1 existingvar2)

##Credit This extension is a minimally modified version of a program posted by Nicholas Winter on the Stata mailinglist on July 10, 2002.

Last modified: July 2015.

About

Extends Stata's egen command to calculate Spearman's rank correlation coefficient

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages