Asked by Ajay Goyal
on 9 Aug 2018

I have generated 36 values at equidistant distances at an interval of 10. I want to convert it to circular data. Is there a way?

Opportunities for recent engineering grads.

Apply Today
## 18 Comments

## KSSV (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598405

What do you mean by a circular data?

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598419

I have an experimentally and analytically generated data at each equidistant 96 points around the circle (data attached). Data represent the total number of cells at a site. I want to compare two datasets using circular statistics (preferably Watson Test). As noticed in few online solved examples, inputs to model is given in radians (i.e. circular data). In my case, input data unit is total number of cells. My question is whether there is a way to modify my data into circular data.

## Image Analyst (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598423

Do you have (x,y) cartesian coordinates, and you're wanting to convert them into polar coordinates with cart2pol()?

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598439

Ajay, some clarification is needed. In your data you have 3 columns, the first (position) is in degrees. What are the 2nd and 3rd columns?

The test you'd like to do is the Watson-Williams test for significance (one-factor ANOVA) [1]?

What do you mean, "input data unit is total number of cells"?

[1]

Watson GS, Williams EJ (1956). On the Construction of Significance Tests on the Circle and the Sphere." Biometrika, 43, 344{352## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598473

Dear Adam, Second and third column represents total number of a cells generated experimentally and analytically at position specified in column 1. Yes, I am intended to perform Watson William test. I want to compare my experimental and analytical results. So,it will be a two sample two sided independent test. I could not understand how may I give input to the test. My units are total number of cells though inputs in these test are given in radians.

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598474

Cells are present at a circular shaped bone section.

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598582

Ajay, it would be easy to convert your 'position' data from degrees to radians. However, after briefly looking at the distribution of your data, are you sure they fulfill the von Mises distribution criteria for the Watson-William test? If not, you could consider some non-parametric tests. I found this reference helpful . Were you planning on using circ_wwtest() from the circular statistics toolbox?

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_598674

Dear Adam, thank you very much for your reference article. This will certainly help me to proceed. However, at this time of my study, the type of distribution that will fit (i.e. either of von-mises, wrapped, uniform and other distributions) is not my concern. I can use other tests as well instead of Watson test. I just want to understand (if possible with an example) how may I convert my inputs (i.e. column 2 and 3) to radians so that any circular test (depending on distribution fit) can be applied. Any similar example in which similar data is converted to ready for input to a circular statistic test will also be great. My question may sound absurd, but being a novice in circular statistic, I seek for your help. Kindly help me to resolve this issue. Thank you in advance.

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_599014

Hi Ajay, You're right that the inputs must be in radians. Columns 2 and 3 of your data are cell counts so you can't, and don't want to, convert them to radians.

You'll probably want to use first and second inputs of the circ_wwtest() as follows. The first one is a vector of your radian values in column 1 and the second is a grouping variable that groups the first input into the different groups (your two columns). So, if row 1 is [pi, 4, 2], you'll replicate Pi 6 times and your grouping vector will have four ones and two twos which represents Group 1 and 2, your columns 2 and 3. you'll repeat that for all of the rows of your data which will end up with two large vectors. See the first link below, starting at the bottom of page 12 for a description of this function.

The second link is an example of this function but in a different software. I couldn't find a Matlab example.

I'm posting this on my smartphone and I do not have Matlab available right now so if you get stuck let me know and I can help more another time.

http://www.jstatsoft.org/v31/i10/paper

https://www.wavemetrics.com/products/igorpro/dataanalysis/statistics/tests/statistics_pxp32

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_599064

Hi Adam, thank you very much for being very kind to me. You have guided me very well. However, what if 2nd and 3rd column have fractional or decimal values, such as [pi, 0.05, 0.009], [pi/2, 0.005,0.008], [1.5pi, 1.2,0.005] and so on. Most of my statistical based problems have data in decimals.

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_599220

You mentioned that columns 2 and 3 were cell counts and your example data in those columns are integers. I'm not familiar enough with your data to recommend how to apply it to a statistic. Hopefully the jstatsoft journal article (starting ph 12) will be enough to understand who the circ_wwtest() works.

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_599491

I apologize if I offended you. Heartily, I thank you for your valuable suggestions. I will try to figure out the solution based on your guidance. Best Regards.

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_599681

No offense taken! :) it's my pleasure to help but without being familiar with your data, I can't specify how to set it up for a circular ANOVA test. If you get stuck and can explain what you're doing with your data I'd be glad to chip in.

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_600000

Thank you, Adam. You are a nice person. Please find the attached file for the actual data. Column 1 represents the angular positions measured in counterclockwise direction with respect to 0 degrees. 2nd and 3rd column shows the actual and analytically calculated bone thickness (measured in millimeters) respectively. I have to test whether 2nd and 3rd column are significantly same or not. For this, I have previously used Cramer's von mises test, KS test as well as Anderson darling test on this data. They have predicted that both data is significantly same. However, as my data is measured around a circle (a bone section), to my understanding, these tests are not applicable to my data. Therefore, I have studied some literature regarding circular statistics. From there, I understand that there are different fits such as wrapped, uniform, von mises that can be used. I also understand the concept of maximum likelihood to determine parameters involved in these fits. One thing I was unable to understand is that the inputs to these parameters are given in radians though my data is in millimeters. Based on your guidance, I understood that the problem can be solved by repeating angular position depending on data in column 2 and 3. However, my actual data in column 2 and 3 is in decimals. Therefore, I still concern about applicability of circular statistics to my data. Currently, type of circular test is not my concern. I am just keen to learn that how my data can be modified for ready input to a circular statistic test.

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_600151

Previously you mentioned that your data were cell counts (integers) which could be used to produce populations with units of degrees or radians which is why I suggested the Watson test but this is different.

I understand that you want to determine whether or not the two distributions are significantly different and that those measurements are taken around a circular object (bone, I suppose). Your measurements are in millimeters (thickness) and are sampled at intervals in degrees (surface). While it is easy to convert between degrees and mm when measuring distance[1], that's not what you're doing. Correct me if I'm wrong but you're measuring thickness of bone at various location around a circular object and in that context, thickness isn't related to anything circular. Example: my book is 50mm thick - there's no way to convert that to degrees or radians. So, even though your data were collected around a circular object, your data itself isn't circular.

In neuroscience (my field) we often measure the spike rates of neurons as we move the subject in different directions around a circle in order to understand the neuron's heading tuning. While the independent variable is circular, the dependent variable (spike rate) is not. And we don't use circular statistics in that case.

I plotted out your data (below) and the two distributions look different. I don't know whether or not your data from column 2 and 3 are independent or not but a simple paired t-test concludes that the distributions are significantly different (p < 0.5, tstat = -2.33). However your data aren't normally distributed so perhaps a Wilcoxon’s matched-pairs test would be more appropriate.

Take my suggestions with a grain of salt since I only partially understand the context of your data.

[1] https://sciencing.com/convert-degrees-inches-mm-6692856.html

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_600165

Thank you very much, Adam. This reply has resolved my query. My data is independent and is not normally distributed. I understand that although measurements are taken along a circular geometry (bone section); circular statistics is not applicable to my data as bone thickness cannot be converted to radians. Accordingly, I may apply Mann Whitney Wilcoxon test to check whether two data are significantly same or not. I will be pleased in case I may help you anyway in the future. Best Regards

## Adam Danz (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_600204

Great! I'll create an "answer" to this question below so that it is tagged as answered and no longer in the list of unanswered questions.

## Ajay Goyal (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/414189-how-to-convert-data-around-a-circle-for-circular-statistics#comment_600209

Sure :)

Sign in to comment.