set the time index for MarkovRegression

39 views
Skip to first unread message

D. K

unread,
Nov 23, 2023, 4:34:08 PM11/23/23
to pystatsmodels

 

Hello,


I am trying to set the time index for data which in their original form are in panel format, to estimate a .MarkovRegression. I have managed with code to perform the estimation. Except that when I try to do the plots, they come up empty. I have tried in various manners to set the index but have not succeeded. In this case, it should be as in the time series. The latest code I am running is the following:


# Assuming 'common_time_index' and 'predicted_values' are defined before this section
# Ensure 'common_time_index' and 'predicted_values' have the same length

df = pd.read_csv("Data.csv", sep=',')
df = df.dropna(how='all')

# Assuming 'df' is your DataFrame with a 'year' column representing years
# Convert 'year' to datetime and set it as the index
df['year'] = pd.to_datetime(df['year'].astype(str).str.strip(), format='%Y')
df = df.set_index('year')

# Create a new index with frequency information
common_time_index = pd.date_range(start=df.index.min(), end=df.index.max(), freq='A')

The waning for each model are:

 Error during model_name estimation: Inferred frequency AS-JAN from passed values does not conform to passed frequency A-DEC

 Plots come empty.

Obviously I have checked the data and have no problems whatsoever, I would appreciate any help

David

Reply all
Reply to author
Forward
0 new messages