An example of using syntax highlighter:
<?php
$example = range(0, 9);
foreach ($example as $value)
{
 echo $value;
}
Tutorial for installing this in Blogger.

Syntax Comments in SPSS

There two way to write comments in SPSS: the non executed line and the in-line comment.

The first, the non executed line, look like this:

* reliability of measures.
RELIABILITY
/VARIABLES=it1 it2 it3
/SCALE('ALL VARIABLES') ALL
/MODEL=ALPHA
/STATISTICS=DESCRIPTIVE SCALE
/SUMMARY=TOTAL.

This is ok for making titles before sectionsn out ot a syntax; or to cancel out commands. like in the following example.

if(it1 = 1) dummy = 1 .
if(it1 = 2) dummy = 0 .
*if(it1 = 3) dummy = 1 .
execute .

On the other hand, the inline comments, serve the purpose of including a comment within a line of commands, like this.

if(it1 = 1) dummy = 1 .
if(it1 = 2) dummy = 0 .
if(it1 = 3) dummy = 1 . /* discuss this option in the research meeting */ 
execute .

 

via

http://www.dummies.com/how-to/content/spss-syntax-language-comments.html

How to import an Excel file in R

In order to import an excel file directly into R, without the need to convert it into a CSV file, and create a data frame (i.e. a dataset), we could use the XLConnect library. We will install the library, and call it right away to work, by typing this:

 

install.packages("XLConnect")                                                       #install package
library("XLConnect")                                                                      #calling library

Lets say we have a file called 'file.xlsx' store in D:/data/, from which we want to read the sheet 'info'. To read this file directly, we use the following code:

info <- readWorksheetFromFile("d:/data/file.xlsx", sheet = "Info")   #opening file / directly

This code will create an object call info, which contains in a data frame, the contents of our excel file. Sometimes, excel files may have different characters, in which teh viewer in R (with R Studio, or Rcmdr) may not able to handle. Characters such as ñ,á,é,í,ó or maybe others. To check if the data was read properly we could export it to text, to see how it looks. 

write.table(info, "d:/data/info.txt", sep="\t")                       #export data to see how it looks

We could also export the data, into an excel file again, to see how it looks.

require(XLConnect)                                                                     #it specifies that for the following command, an specific library needs to be used
writeWorksheetToFile("info.xlsx", data = info, sheet = "info")       #export data to see how it looks in excel
 

 

This is a fairly good start to do things in R.

[need to fix the blog, to store code properly, like here]

HOW TO run a frequencies in SPSS / SAS

In SPSS:

GET

     SAS DATA='D:\DATA\data.sas7bdat'.
DATASET NAME CC WINDOW=FRONT.

FREQ var .

In SAS

Libname data 'd:\data\sas\';
options fmtsearch=(data);

proc freq data= data.example;
table var;
run;

In SAS, it can require more commands due to more speifications are being made, such as: creating a library, specifying where is the format of the data, and then asking for the frequency .

Aditionally,  one can ask for the same table, including the missing values:

proc freq data= data.example;
table var/ missing;
run;

Or can ask for the same table in an html format to be exported:

ods html;
proc freq data=ccalum.ccalumnos;
table i2/ missing;
run;
ods html close;

HOW TO: open a database in SAS / SPSS:

Similarly to SPSS one can call a database and ask for full description of the content.

In the case of SPSS one could do:

GET
     SAS DATA='D:\DATA\data.sas7bdat'.
DATASET NAME CC WINDOW=FRONT.

DISPLAY DICTIONARY .

 

As where in the case of SAS we chould do:

options nocenter;
proc contents position data=' D:\DATA\data';
 run;

'options noncenter' is just giving a format for how the output will look (asking for it be justifyed to the left of the screen).  Only the second syntax line, is mimicing the 'display dictionary', in order to display the contents of the database.

'run' is the simil to execute in the case of spss, or just the ';' in the case of mplus.

 

CFA: RMSEA, CFI and NNFI thresholds

During the confirmatory factor analyses, selected model-fit indices were also used to measure the extent to which a model with an assumed a-priori structure “fitted the data.” For the ICCS analysis, model fit was assessed primarily through use of the root-mean square error of approximation (RMSEA), the comparative fit index (CFI), and the non-normed fit index (NNFI), all of which are less affected than other indices by sample size and model complexity (see Bollen & Long, 1993). 

It was assumed, with respect to the analysis, that RMSEA values over 0.10 would suggest an unacceptable model fit while values below 0.05 would indicate a close model fit. As additional fit indices, CFI and NNFI are bound between 0 and 1. Values below 0.90 and 0.95 indicate a non-satisfactory model fit whereas values greater than 0.95 suggest a close model fit. 

Schulz, Ainley, & Fraillon, 2011, p161

 

References

Schulz, W., Ainley, J., & Fraillon, J. (2011). ICCS 2009 technical report. Amsterdam, The Netherlands: International Association for the Evaluation of Educational Achievement (IEA).

How to write variables labels with ' in between (don'ts; I'll; ain't and so forth)

In SPSS, to document a dataset VARIABLE LABEL command is used.In this respect, for each variable the item in use could be entered, to keep the record for each data field. In other scenarios would be the name of a construct or scale; or a short description for the variable located in data field.
If our item is written in the following format:
I didn't let myself have thoughts related to it. [1]
Lets supposed the answer for this item will be recorded in IES15. Then, the following syntax would apply to build up the corresponding label:
VARIABLE LABELS IES15 'I didn't let myself have thoughts related to it.' .
 However, the result would be following

To avoid this bug or unintended result, the syntax can be corrected using " in the limits of the item label:
VARIABLE LABELS IES15  " I didn't let myself have thoughts related to it." .
obtaining:




[1] REFERENCE for the item in the example: 
Horowitz, M., Wilner, N., & Alvarez, W. (1979). Impact of Event Scale: a measure of subjective stress. Psychosomatic Medicine, 41(3), 209 -218.