Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ jobs:
- name: Run tests
run: |
source .venv/bin/activate
pytest tests/
pytest tests/ --ignore-glob='test_graph_vis.py' .--cov=./ --cov-report=xml
pytest tests/ --ignore=tests/test_graph_vis.py --cov-report=xml
- name: Upload coverage data to coveralls.io
run: |
python -m pip install coveralls==2.2
Expand Down
2 changes: 2 additions & 0 deletions examples/Animal_Science/model_data_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def fit_model():


model = Lmer(formula='Weight ~ Time + (1|Litter) + (1|Pig) + (1|Time)', family="gaussian", data=df)

print(model.fit())
return model

Expand All @@ -21,6 +22,7 @@ def fit_model():
# Read more here: https://sscc.wisc.edu/sscc/pubs/RegressionDiagnostics.html
def show_model_diagnostics(model):

plt.axhline(y=0, color='r', linestyle='-')
plt.scatter(model.fits, model.residuals)
plt.title("Fitted values vs. Residuals")
plt.xlabel("fitted values")
Expand Down
4 changes: 3 additions & 1 deletion examples/Animal_Science/model_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def fit_model():
df = pd.read_csv('/Users/emjun/Git/tisane/data.csv') # Make sure that the data path is correct


model = Lmer(formula='Weight ~ Time + (1|Litter) + (1|Pig) + (1|Time)', family="gaussian", data=df)
model = Lmer(formula='Weight ~ Time + (1|Pig) + (1|Time) + (1|Litter)', family="gaussian", data=df)

print(model.fit())
return model

Expand All @@ -24,6 +25,7 @@ def fit_model():
# Read more here: https://sscc.wisc.edu/sscc/pubs/RegressionDiagnostics.html
def show_model_diagnostics(model):

plt.axhline(y=0, color='r', linestyle='-')
plt.scatter(model.fits, model.residuals)
plt.title("Fitted values vs. Residuals")
plt.xlabel("fitted values")
Expand Down
4 changes: 3 additions & 1 deletion examples/Animal_Science/model_no_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def fit_model():
# df = <your pandas Dataframe>


model = Lmer(formula='Weight ~ Time + (1|Pig) + (1|Litter) + (1|Time)', family="gaussian", data=df)
model = Lmer(formula='Weight ~ Time + (1|Litter) + (1|Time) + (1|Pig)', family="gaussian", data=df)

print(model.fit())
return model

Expand All @@ -25,6 +26,7 @@ def fit_model():
# Read more here: https://sscc.wisc.edu/sscc/pubs/RegressionDiagnostics.html
def show_model_diagnostics(model):

plt.axhline(y=0, color='r', linestyle='-')
plt.scatter(model.fits, model.residuals)
plt.title("Fitted values vs. Residuals")
plt.xlabel("fitted values")
Expand Down
2 changes: 2 additions & 0 deletions examples/Exercise/tisane_generated_files/model_data_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def fit_model():


model = smf.glm(formula='endurance ~ age + exercise', data=df, family=sm.families.Gaussian(sm.families.links.identity()))

res = model.fit()
print(res.summary())
return model
Expand All @@ -26,6 +27,7 @@ def show_model_diagnostics(model):
res = model.fit()
plt.clf()
plt.grid(True)
plt.axhline(y=0, color='r', linestyle='-')
plt.plot(res.predict(linear=True), res.resid_pearson, 'o')
plt.xlabel("Linear predictor")
plt.ylabel("Residual")
Expand Down
2 changes: 2 additions & 0 deletions examples/Exercise/tisane_generated_files/model_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def fit_model():


model = smf.glm(formula='endurance ~ age + exercise', data=df, family=sm.families.Gaussian(sm.families.links.identity()))

res = model.fit()
print(res.summary())
return model
Expand All @@ -29,6 +30,7 @@ def show_model_diagnostics(model):
res = model.fit()
plt.clf()
plt.grid(True)
plt.axhline(y=0, color='r', linestyle='-')
plt.plot(res.predict(linear=True), res.resid_pearson, 'o')
plt.xlabel("Linear predictor")
plt.ylabel("Residual")
Expand Down
2 changes: 2 additions & 0 deletions examples/Exercise/tisane_generated_files/model_no_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def fit_model():


model = smf.glm(formula='endurance ~ age + exercise', data=df, family=sm.families.Gaussian(sm.families.links.identity()))

res = model.fit()
print(res.summary())
return model
Expand All @@ -30,6 +31,7 @@ def show_model_diagnostics(model):
res = model.fit()
plt.clf()
plt.grid(True)
plt.axhline(y=0, color='r', linestyle='-')
plt.plot(res.predict(linear=True), res.resid_pearson, 'o')
plt.xlabel("Linear predictor")
plt.ylabel("Residual")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def fit_model():


model = Lmer(formula='pounds_lost ~ motivation + treatment + (1|group)', family="gaussian", data=df)

print(model.fit())
return model

Expand All @@ -21,6 +22,7 @@ def fit_model():
# Read more here: https://sscc.wisc.edu/sscc/pubs/RegressionDiagnostics.html
def show_model_diagnostics(model):

plt.axhline(y=0, color='r', linestyle='-')
plt.scatter(model.fits, model.residuals)
plt.title("Fitted values vs. Residuals")
plt.xlabel("fitted values")
Expand Down
2 changes: 2 additions & 0 deletions examples/Group_Exercise/tisane_generated_files/model_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def fit_model():


model = Lmer(formula='pounds_lost ~ motivation + treatment + (1|group)', family="gaussian", data=df)

print(model.fit())
return model

Expand All @@ -24,6 +25,7 @@ def fit_model():
# Read more here: https://sscc.wisc.edu/sscc/pubs/RegressionDiagnostics.html
def show_model_diagnostics(model):

plt.axhline(y=0, color='r', linestyle='-')
plt.scatter(model.fits, model.residuals)
plt.title("Fitted values vs. Residuals")
plt.xlabel("fitted values")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def fit_model():


model = Lmer(formula='pounds_lost ~ motivation + treatment + (1|group)', family="gaussian", data=df)

print(model.fit())
return model

Expand All @@ -25,6 +26,7 @@ def fit_model():
# Read more here: https://sscc.wisc.edu/sscc/pubs/RegressionDiagnostics.html
def show_model_diagnostics(model):

plt.axhline(y=0, color='r', linestyle='-')
plt.scatter(model.fits, model.residuals)
plt.title("Fitted values vs. Residuals")
plt.xlabel("fitted values")
Expand Down
Binary file modified examples/readme_dot_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/test_more_complex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/test_units.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading