Python Forum
stats model OLS question/issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
stats model OLS question/issue
#4
(Aug-05-2020, 12:02 PM)russoj5 Wrote: Its not really relevant to my problem, but do you know why it would work when using matplotlib module and not with the statsmodels module?

There is no magic with - character, it is just one character of a string. Statsmodels internally parses the formula given. It looks for +, ~ and - symbols in a string representing the formula. When statsmodels find -, it treats surrounding alphanumeric substrings C and IC_6MU as factor/column names (but your data frame doesn't have such columns). All this behavior is implemented in statsmodels to get it closer to R-like (formula) syntax.
When you call plt.plot(chem_film_data_df['C-IC_6MU'], chem_film_data_df['pass_fail'],'o'), only pandas selection
engine works: you get chem_film_data_df['C-IC_6MU'] and chem_film_data_df['pass_fail'] which are iterables (Pandas.Series instances); and these iterables are passed to the plot function.


When AFAIK, Matplotlib doesn't perform similar parsing. How
Reply


Messages In This Thread
stats model OLS question/issue - by russoj5 - Aug-04-2020, 04:56 PM
RE: stats model OLS question/issue - by scidam - Aug-05-2020, 12:48 AM
RE: stats model OLS question/issue - by russoj5 - Aug-05-2020, 12:02 PM
RE: stats model OLS question/issue - by scidam - Aug-06-2020, 02:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  issue displaying summary of whole keras CNN model on TensorFlow with python Afrodizzyjack 0 1,664 Oct-27-2021, 04:07 PM
Last Post: Afrodizzyjack

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020