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

Trouble with plot.estimateEffect #281

Open
nms001 opened this issue May 24, 2023 · 0 comments
Open

Trouble with plot.estimateEffect #281

nms001 opened this issue May 24, 2023 · 0 comments

Comments

@nms001
Copy link

nms001 commented May 24, 2023

I keep running into an issue when trying to use stm's plot.estimateEffect function, similar to #16. The plot I am trying to create is the expected topic proportion over time. Here is the code I use:

russia_stm_10 <- stm(documents = russia_out$documents, vocab = russia_out$vocab,
                    K = 10, prevalence = ~party_id + splines::bs(date) + region + speak_type
                    + speech_type, data = russia_out$meta, init.type = 'Spectral', 
                    seed = 710)
                    
russia_prep_10 <- estimateEffect(1:10 ~party_id + splines::bs(date) + region + speak_type + speech_type,
                                russia_stm_10, metadata = russia_out$meta,
                                uncertainty = 'Global')

plot.estimateEffect(russia_prep_10, covariate = 'date', topics = 4,
                    method = 'continuous')

The error I get is Error: object 'cdata' not found. I have also tried running plot.estimateEffect(russia_prep_10, covariate = 'party_id', topics = 4, method = 'pointestimate'), but the error I get instead is Error in `[.data.frame`(cdata, , names(prep$data)) : undefined columns selected

Here is a description of the variables I'm using:

  • party_id indicates the party of an American presidential administration
  • date indicates the day/month/year a president gave a speech
  • region indicates the geographical location where a president gave a speech (e.g., Europe, North America, East Asia, etc.)
  • speak_type indicates whether the speech was given by the president or one of their staff
  • speech_type indicates whether spoken remarks were given in a speech or an interview

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant