Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pandas as pd
- import statsmodels.api as sm
- from statsmodels.formula.api import ols
- import matplotlib.pyplot as plt
- import seaborn as sns
- import scipy.stats as stats
- import statsmodels.stats.oneway as oneway
- 1. Check data for normality with Shapiro Test;
- 2. Check for homogeneity of variances - Bartlet's Test(data is normal), Levene's Test(data is almost normal), Brown-Forsythe Test(data is sort of normal), Fligner-Killen Test(data is non-normal)
- If data is normal and there is homogeneity of variances:
- model = ols("horsepower~C(cylinders)", data = data_new).fit()
- model
- anova = sm.stats.anova_lm(model, type = 2)
- anova
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement