Rapfish in R Software: In May, it was raining heavily all day. I was confused about going to the office because I didn’t have enough equipment to get through the rain. Pensive in the house, trying to learn multidimensional scaling again. This time I learned through Rapfish 3.1, which is run through the R application.
I have not been familiar with R. R is a free application, so it is a good alternative for researchers or students who are constrained by license issues. There are some publishers who ask about the legality of ownership of software used during research. Frankly, I learned multidimensional scaling in R by myself. In connection with the question of how to run Rapfish 3.1 in R, and armed with a little knowledge about MDS, I tried to learn MDS in R.
Actually, Rapfish itself has included instructions when you download the Rapfish 3 script. However, I think the instructions are not too detailed, so they can be confusing for beginners or those who are new to R. This time, I will try to make it easier to understand.
Rapfish in R Software : Download
We download Rapfish first.
This time I used Rapfis 3.1 for Windows. I certainly don’t update regularly if it turns out that Rapfish has an update. Previously, I assumed that you had installed the R application. The application is free; please download it on the internet.
Extract the download result.
We extract the Rapfish download results into a specific folder. This time, I saved it in D/latihan.

Inside the folder are instructions in a file called “guide.doc”. There are also files containing examples of the dimensions of ecology, economics, ethics, institutional, social, and technology. Rapfish itself was originally used to analyze sustainability in the fisheries sector of a system that basically consists of several dimensions. Please open Rapfish journals; in general, they will discuss sustainability. However, we can adopt the MDS concept by replacing these dimensions with the ones we want.
In this exercise, I want to use two dimensions, namely the pillar 1 dimension and the pillar 2 dimension. I deleted the original six dimensions and left two, namely ecology and economics, which I will later change according to the data I have as an example.
I deleted all the images as an example of Rapfish output, and then I also deleted all files that began with the word “result”. I also deleted the ethical.csv, Institutional.csv, Social.csv, and technology.csv files. I renamed the ecology.csv file with pillar1.csv, and I renamed economics.csv with pillar2.csv. The results are as shown below:

Ready for practice…
Material preparation
Just like MDS, in Rapfish also the data used is ordinal, with a scale of 1 to 10, or can be customized as you wish (can only be up to 3, up to 5, up to 20, etc.). However, Rapfish cannot apply an inverse scale. If MDS is in Excel, we can set the highest value as bad (for example, on a scale of 1–5, with bad = 5 and good = 1). Why is the scale reversed? According to conditions such as the population variable, there may be an assumption that the more it is, the worse it will be. I have explained this more fully in the Multidimensional Scaling Part 2 article.
Things like this cannot be done in Rapfish. Rapfish always values bad at the minimum value, and good values are always at the maximum value. Then what if our data is actually inverted-scale data? Yes, we first reverse the scale so that it is in the correct position. For example, on a scale of 1–5, initially 1 is good and 5 is bad, then we change 5 to 1, 4 to 2, 3 remains, 2 to 4, and 5 to 1. So that the scale is suitable for input into the R application.
To enter variable values, we can open the dimension we created earlier. I open the pillar 1 dimension. Then I changed the variable name on the first line. In writing a variable, there should be no spaces. Use underlining to replace spaces. In this pillar 1 dimension, I fill in the variables: production, pests and diseases, water, labor, capital, equipment, livestock, horticulture, and food.
Then column 1 contains fisheries. I call it the object of research. I only use three places, namely: Sumatra, Java, and Kalimantan. Of course, this data is fictitious and for practice only.
Lines 2 to 4 (because there are only 3 fisheries) contain the values of the variables in the object in question. Rows 5 to 7 (I call them the bottom rows) contain the lower limit or bad values of the variables in the object in question. The next 3 rows (I call them the top rows) contain the upper limit or good values of the variables in the object in question. The scale of each variable can be the same or different. If the scale of the production variable is only 1–5, the scale of the equipment could be 1–10. Even each object can vary in scale. For example, in the livestock variable, the value of the bottom row of Java contains 0, and the value of the bottom row of Sumatra contains 2 (according to their respective scales). The scoring value can also be decimal. I have explained how to score in the Multidimensional Scaling Part 2 article.
For more details, please see my results in the image below.

Make it like I did above, but don’t color it or annotate it like the bottom part. I added it to make it easier for you to understand my explanation.
Remember, the bottom row value cannot exceed the variable value, and the variable value cannot exceed the top row value. This step must be done very carefully because most R errors come from determining variable values. If it has been done, don’t forget to save it in the format you are still using. csv
The same thing is done for pillar 2 as the second dimension of this exercise. You can use one dimension, depending on the data you have. You can also use the five complete dimensions that Rapfish offers by default.
In pillar 2, I used the variables: government support, dana_apbd, population, and regional GRDP.
The results are shown in the image below:

Don’t forget to save with the format still using.csv. The material that we will process is ready; now we will set the number of fisheries, variables, and repeat values in Monte Carlo.
Setting the number of fisheries
Setting the number of fisheries in a file called “input1_number_fisheries”. Open the file and replace it with the number 3 according to the number of fisheries in this exercise. You can change the fisheries value according to the research or data you have. Don’t forget to save.
Dimension name input
Setting the dimension name that will be run in the R application is located in a file called “input2_datafile_names”. The format is text. Open it and change it according to the dimension name you are using. This time I replaced them with the names pilar1.csv and pilar2.csv. Don’t forget to save.
Montecarlo simulation
The file “input3_MC_simulations” contains how many Montecarlo replicates you want. I replaced it with 25. Then save.
Open the R application.

Then we change the directory in the file – change dir

Then select the folder where we extracted the rapfish earlier, whose contents we have changed according to the data we have. I use the D/latihan directory.
After pressing OK, we open the script provided by Rapfish in the following sequence:
Rapfish
Click file – open script

Then select rapfish_execution.r

Click Open, and then a script will appear that will be run in R. To run it, we click edit—run all. Let the computer work until it says complete.” When we see the exercise folder, there are already rapfish results in the form of files “result_pilar1” and “result pilar2,” which contain the X and Y coordinates of each object in the MDS or rapfish quadrant. The index value that shows the sustainability status is in the “Kite_result” file with a description of 0–25 poor category (unsustainable), 25.01–50 less sustainable category, 50.01–75 moderately sustainable category, and 75.01–100 good or very sustainable category. I have explained the meaning of each output in the Multidimensional Scaling Part 4 article.
Then there are images of pillars 1 and 2 as rapfish outputs in the folder:


Monte carlo
After successfully running rapfish or MDS, we will run monte carlo. Return to the R application. open the monte carlo script then run all in the edit menu (same as above). The monte carlo script that is suggested by default runs first the script “monte_carlo_triangle.r” and then runs “monte_carlo_uniform.r”.
The result we see again in the exercise folder. There are new files namely “MC_Triangle_pilar1”, “MC_Triangle_pilar2”, “MC_uniform_pilar1”, “MC_uniform_pilar2” complete with pictures.


The Monte Carlo output file itself has provided output with two different Monte Carlo methods, namely triangle and uniform. I am still a little unclear about what the difference between the two is. If you know it, I would be very happy if you would add it in the comments column.
For now, what I understand about Monte Carlo is that it uses a randomized system to determine the probability of changes in the index value issued by Rapfish. If it turns out that the index value tends to change frequently, then the index value is not strong enough. However, if in the randomization it turns out that the difference between the index value and the randomized value does not exceed 1, then the index value can be said to be strong and can be used to represent the research results. In Monte Carlo in R, the index value is already available on randomization with probabilities of 25%, 75%, 2.5%, and 97.5%. Please compare the index value for each probability. Of course, it is expected that the index value does not differ much from the highest probability, 97.5%.
Leverage
There is still 1 more script that we will run in this R application, namely the “leverage.r” script. run the script as above, then we will see the results in the exercise folder.
In this output, files named “leverage_pilar1” and “leverage_pilar2” appear, which contain the coordinates of the x and Y values on the leverage chart. However, there is no image or chart of leverage. Maybe we are asked to create our own in Excel.
Pros and Cons of Rapfish in R
The advantage of R that I felt in this exercise was the ease of input and output. The output is just a click away, and the analysis runs as it should. Whereas if we use Excel, we have to feel where the output is, especially when determining Monte Carlo and leverage. The input is also difficult when using Excel, especially when creating an anchor. Still remember the yellow, red, and white ones? Like making a ladder?
The disadvantage of rapfish in R is that there is no output of stress and RSQ values. These values are, of course, important for the goodness of fit of the Rapfish results. R also does not include leverage in the form of the root mean square, which is directly converted on a scale of 0-100, which is useful for knowing the leverage variable from the MDS output results.
Thus, my review of Rapfish in R Software
Thank You.
Leave a Reply