I will try to collect all my SPSS/STATA and other stats notes here!!
Monday, 7 March 2011
Thursday, 24 February 2011
Tuesday, 15 February 2011
Truncating a string variable & other things
This text has been copied from UCLA website!!!
Create a String Variable up that will be the name converted into upper case, lo that will be the name converted to lower case, and sub that will be the third through eighth character in the persons name. Note that we first had to use the string command to tell SPSS that up lo and sub are string variables that will have a length of up to 14 characters. Had we omitted the string command, these would have been treated as numeric variables, and when SPSS tried to assign a character value to the numeric variables, it would have generated an error. We also create len that is the length of the name variable, and len2that is the length of the persons name.
STRING up lo (A14)
/sub (A6).
COMPUTE up = UPCASE(name).
COMPUTE lo = LOWER(name).
COMPUTE sub = SUBSTR(name,3,8).
COMPUTE len = LENGTH(name).
COMPUTE len2 = LENGTH(RTRIM(name)).
For more info visit: http://www.ats.ucla.edu/stat/spss/modules/functions.htm
Tuesday, 8 February 2011
Assigning Student Grades Using Excel
Here is the formula from MS office website:
=IF(A2>89,"A",IF(A2>79,"B", IF(A2>69,"C",IF(A2>59,"D","F"))))
If more than 6 conditions to check, better to use LOOKUP then IF/THEN
=LOOKUP(A2,{0,60,63,67,70,73,77,80,83,87,90,93,97},{"F","D-","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"})
source: http://office.microsoft.com/en-us/excel-help/if-HP005209118.aspx
=IF(A2>89,"A",IF(A2>79,"B", IF(A2>69,"C",IF(A2>59,"D","F"))))
If more than 6 conditions to check, better to use LOOKUP then IF/THEN
=LOOKUP(A2,{0,60,63,67,70,73,77,80,83,87,90,93,97},{"F","D-","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"})
source: http://office.microsoft.com/en-us/excel-help/if-HP005209118.aspx
Thursday, 13 January 2011
a very simple table using CTables
|
| group Universe vs sample | |||||
| 1 Universe | 2 Sample | Total Respondents | ||||
| Column N % | Count | Column N % | Count | Column N % | Count | |
| 1 Female | 53.0% | 904 | 61.0% | 153 | 54.0% | 1057 |
| 2 Male | 46.3% | 789 | 39.0% | 98 | 45.3% | 887 |
| Not specified | .7% | 12 | .0% | 0 | .6% | 12 |
To get the above table use the following syntex:
CTABLES /TABLE gender2 by group [colpct count]
/CATEGORIES VARIABLES=group TOTAL=YES LABEL='Total Respondents'.
&
|
| Main groups | ||||||
| Our big univ | our sample | Total | |||||
| Column N % | Count | Column N % | Count | Column N % | Count | ||
|
| 1 Female | 53.0% | 904 | 61.0% | 153 | 54.0% | 1057 |
| 2 Male | 46.3% | 789 | 39.0% | 98 | 45.3% | 887 | |
| 3 Not specified | .7% | 12 | .0% | 0 | .6% | 12 | |
| Total | 100.0% | 1705 | 100.0% | 251 | 100.0% | 1956 | |
For the above, here is the syntax (notice the columns also have totals now):
CTABLES /TABLE gender2 by group [colpct count]
/CATEGORIES VARIABLES=group TOTAL=YES LABEL='Total Respondents'
/CATEGORIES VARIABLES= gender2 TOTAL=YES POSITION=AFTER.
Thursday, 16 December 2010
Confirmatory vs. Exploratory analysis
Here is a very nice and succinct analysis of the difference between confirmatory vs. exploratory data analysis:
http://www.geog.ucsb.edu/~joel/g210_w07/lecture_notes/lect01/oh07_01_2.html
So, my dissertation would be more on the exploratory side.....
http://www.geog.ucsb.edu/~joel/g210_w07/lecture_notes/lect01/oh07_01_2.html
So, my dissertation would be more on the exploratory side.....
Subscribe to:
Posts (Atom)