Correlation between dependent and independent variables in non-normal distribution

Viewed 904

Edit & Update:

I am trying to use Python or SPSS to measure the effectiveness of some factors on one or more metrics. My dataset contains 100 records of patients who have been treated different times (e.g., three months). The dataset looks like below:

     a1  a2  a3  b1  b2  b3  metric1 metric2 metric3
1    1.2 2.3 3.5 90  58  29  2.1     3.2     1.2  
2    3.2 3.4 1.5 58  54  39  3.1     4.2     3.2  
...
100  3.1 1.3 2.5 36  63  45  5.1     4.2     3.2  

As you can see, factor a (let's say Glucose with non-normal distribution) and factor b (let's say a treatment or drug with normal distribution) have been recorded three times for each patient. In each patient's visit, a metric (for example a health metric) has been recorded as well. Now I want to know how factor b influence on the metric in my dataset during three visits. For example, is there any (co)relation between factor b with the metric in this dataset? If so, to what extent it is significant?

I tried several approaches including one-way Annova or finding correlation between the means of samples, but it was unsuccessful. I know that these kinds of data should be analyzed by repeated measures method, but now that I have multiple independent variables with non-normal distribution I am bit confused. What statistical method I should leverage?

Any help is appreciated!

1 Answers

You currently have your data in wide format, I haven't done statistics in Python but for R you need it on long format for most functions.

Convert your dataframe into long. I think you can do that with pd.melt()

df["Patient"] = df.index + 1
pd.melt(df, id_vars=["Patient"], value_vars=['b1', 'b2', 'b3'], var_name='Repeated', value_name='Glucose')

this is wrong ebcause you need to do the same for your treatments, not sure how to do twice, you can do it by separatign the DF and then merging it again.

Your goal dataframe should look like this:

Patient     Glucose  GRepeated  Treatment  TReapeatedb1   Metric MRepeated
1           1.2      a1          90        b1             3.2     metric1  
2           3.2      a2          54        b2             4.2     metric2
...
100         3.1      a3          45        b3             3.2     metric3
Related