I have been an intensive SPSS user since my time as psychology student. Accompanying me across all versions during this time were the simple brief commands in order to show me descriptive statistics. These short commands quickly become second nature and thus enable a fast data viewing.
Currently, my tool focus is on R. It is an excellent alternative but despite extensive experience with this open source tool, I still feel a lack of the usability of SPSS. I simply miss my short commands. However, it is relatively easy to add simple commands similar to SPSS as functions in R yourself.
Inhaltsverzeichnis
Short commands in SPSS
SPSS-FREQUENCIES
For example, let us look at the frequencies command. In SPSS, it is sufficient to use only the first 3 to 4 letters for commands as long as they are unambiguous. E.g. "FREQ category." displays the absolute frequency, the frequency in percent, the frequency in percent of all valid cases without missing values and the cumulated frequency in percent for each distinct value for the column "category". This is very useful for an explorative data analysis as I can see at one glance:
Which are the most frequent or the rarest values?
Which share do these values have in all data and/or the valid basis?
Which share do the top three categories hold together?
If one then adjusts the command, e.g. "FREQ category /FORMAT AFREQ.", the frequencies are presented in ascending instead of descending order.
FREQUENCIES-Replica in R
Well ..., that is exactly what I would like to have in R.
The command can be realized via a user-defined function as follows:
First of all, the simple frequency is retrieved via the table command and pressed into a data frame.
The contents are arranged depending on the parameter "order".
Calculations via the entire frequency vector follow in order to determine the percentages.
Finally, the vector perc_cum_v is built up with the accumulated percentages. For this purpose, the result is run in a loop.
I really like the final result! I will probably integrate further functionalities later, e.g. a "limit" command in order to display only the top x categories etc. But in the meantime, the new function "freq" has already made my job much easier :-).
The example below shows a result of the function. I have deliberately decided to let the function differ from SPSS in a way that the missing values are taken into account in the accumulated percent (perc_cum), as I need it that way more often.
Example Output in R
Let’s Unlock the Full Potential of Your Data – Together!
Looking to become more data-driven, optimize processes, or leverage cutting-edge technologies? Our blog provides valuable insights – but the best way to tackle your specific challenges is through a direct conversation.
Let’s talk – our experts are just one click away!
Want To Learn More? Contact Us!
Your contact person
Dr. Sebastian Petry
Domain Lead Data Science & AI
Who is b.telligent?
Do you want to replace the IoT core with a multi-cloud solution and utilise the benefits of other IoT services from Azure or Amazon Web Services? Then get in touch with us and we will support you in the implementation with our expertise and the b.telligent partner network.
With Snowflake Document AI, information can be easily extracted from documents, such as invoices or handwritten documents, within the data platform. Document AI is straightforward and easy to use: either via a graphical user interface, via code in a pipeline or integrated into a Streamlit application. In this article, we explain the feature, describe how the integration into the platform works and present interesting application possibilities.
Neural Networks for Tabular Data: Ensemble Learning Without Trees
Neural networks are applied to just about any kind of data (images, audio, text, video, graphs, ...). Only with tabular data, tree-based ensembles like random forests and gradient boosted trees are still much more popular. If you want to replace these successful classics with neural networks, ensemble learning may still be a key idea. This blog post tells you why. It is complemented by a notebook in which you can follow the practical details.
Azure AI Search, Microsoft’s top serverless option for the retrieval part of RAG, has unique sizing, scaling, and pricing logic. While it conceals many complexities of server based solutions, it demands specific knowledge of its configurations.