Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in factor analysis due to subset assumption #38

Merged
merged 1 commit into from
Feb 21, 2024
Merged
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
2 changes: 1 addition & 1 deletion coverage.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<coverage version="7.3.1" timestamp="1708500367269" lines-valid="147" lines-covered="145" line-rate="0.9864" branches-valid="54" branches-covered="51" branch-rate="0.9444" complexity="0">
<coverage version="7.3.1" timestamp="1708501583665" lines-valid="147" lines-covered="145" line-rate="0.9864" branches-valid="54" branches-covered="51" branch-rate="0.9444" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.3.1 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
Expand Down
6 changes: 3 additions & 3 deletions covid19_drdfm/streamlit/pages/1_Factor_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@

# Normalize original data for state / valid variables
raw = raw.set_index("Time", drop=False)
raw = raw.loc[df.index, :]
new = normalize(raw.query("State == @state")[columns]) # .iloc[1:]) # .reset_index(drop=True)
new = normalize(raw[raw.State == state][columns]).set_index("Time", drop=False)

# Normalize factors and add to new dataframe
if st.sidebar.checkbox("Invert Factor"):
df[factor] = df[factor] * -1
df = normalize(df[df.State == state]).reset_index(drop=True)
df = normalize(df[df.State == state]).set_index("Time", drop=False) # .reset_index(drop=True)
new = new.loc[df.index, :]
new[factor] = list(df[factor])

# Melt into format for plotting
Expand Down
Loading