![]() These results mostly mirrored the results from Matlab when I used categorical variables, but were not completely identical. Then, trying as cateogorical: model = ols('Result ~ C(Var1) + C(Var2) + C(Var1):C(Var2)', data=df).fit() The results mirrored the results of when I did fitlm in Matlab without using categorical variables. ![]() Model = ols('Result ~ Var1 + Var2 + Var1:Var2', data=df).fit() I tried this in two different ways, first without specifying Var1 and Var2 as categorical, and then the 2nd time I specified them as categorical: import numpy as np So then I switched over to Python, and I tried using the anova_lm function from the statsmodels module. This gave the following results: SumSq DF MeanSq F pValue Lm = fitlm(t2, 'Result ~ Var1 + Var2 + Var1:Var2') Now, Var1 and Var2 are technically categorical/ordinal variables, so I changed the above code to specify that: t2 = t This gave me the following results: SumSq DF MeanSq F pValue Next, I decided to basically do the same thing, but using the fitlm function in Matlab: lm = fitlm(t, 'Result ~ Var1 + Var2 + Var1:Var2') I ran my code like so: t = readtable('data_file.xlsx') Now, I normally use Matlab for my stats, so I use the anovan function which can handle unbalanced designs ( ).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |