View source: R/CalculateSalience.R
CalculateSalience | R Documentation |
Given a Free list dataset with Codes, Ordering and subject numbers, determine the "salience" of each response by item and/or by category.
CalculateSalience(mydata, Order="Order",Subj="Subj",CODE="CODE",GROUPING=NA,Rescale=FALSE,Salience="Salience")
mydata |
The free-list data. This should be a data frame, where each row contains a single response from a single respondent. For each such response, you need to know the subject number (or some form of unique identifier), the response (or "CODE" of the response) and the ranking/order of the response (What was this respondents the first response? The second? The Seventeenth?). The "CODE" of the response is the target variable. We use "code" here as some free-list data gets coded into another coding scheme. |
Order |
This is the name of the column which contains the "Order" information. For each subject responses should be ordered uniquely from 1 to N, where N is the number of responses. There should be no gaps or double-ups. Defaults to "Order" |
Subj |
This is the name of the column containing your subject names/numbers. Each subject should have a unique identifier in this column. Since each participant is likely to list multiple items, subject numbers will repeat. Defaults to "Subj". Subject numbers need to be unique within each grouping, but may be repeated if you have data from multiple groupings (multiple test sites for example). |
CODE |
What column is your CODE stored in. <NA> values in this column will be excluded from the analysis. |
GROUPING |
Do your subjects come from multiple test sites or subject groups? If so, you may wish to specify the column that specifies this - especially important if subject identification number is only unique within each group. Defaults to <NA>. |
Rescale |
How are you going to scale salience? If set to false, then the Salience scores will be calculated in such a way that each response gets a score (N+1-k)/(N). Thus, the top score will have salience of 1.00. If Rescale is true then the above calculation will be done, and then all scores will be scaled such that each respondent's total salience is 1.00 (Thus preventing respondents with unusually long answer lists from dominating the analysis). This operation will keep the relative size of salience scores the same within each subject. |
Salience |
This is the name of the column that you wish to have the salience scores stored in. Using the default setting is strongly recommended as it will make other functions in this package easier to use. |
Returned will be a dataframe identical to your original data frame, but with an additional column containing the salience value of each response.
This function produces several warning messages, most minor and self-explanatory. If your inputs for Rescale, Subj or Order seem wrong, the function will stop, and request better inputs. The one warning of interest is "Subject X has bad order data and cannot have salience calculated". This indicates that the order data on one of your subjects contains either a missing entry, or a double up, or perhaps a decimal. Whatever the cause, this data is considered bad, and no salience is calculated.
fakeData<- GenerateFakeFreeListData()
fakeSalData<- CalculateSalience(fakeData)
fakeRescaleData<- CalculateSalience(fakeData,Salience="RescaleSalience",Rescale=T)
fakeBothData<- CalculateSalience(fakeSalData,Salience="RescaleSalience",Rescale=T)
fakeData1<- GenerateFakeFreeListData()
fakeData1[,"Group"]="Mainland"
fakeData2<- GenerateFakeFreeListData()
fakeData2[,"Group"]="Island"
fakeDataCombo=rbind(fakeData1,fakeData2)
CalculateSalience(fakeDataCombo,GROUPING="Group")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.