(this is my first post, just started out with R - so please forgive me for my mistakes )
I am trying to do a Causal Impact Analysis with the "CausalImpact" Package. I keep running into the same error message: "data is not a numeric or integer vector"
I don't understand this, as my data is numeric... can anyone help me??
> # Synthetic control method =====================================================
>
> #select data
> informal_small <- informal[ c("year_s", "informal_output", "carbon_tax_dummy") ]
> informal_small$informal_output <- as.numeric(informal_small$informal_output)
Warnmeldung:
NAs durch Umwandlung erzeugt
> informal_small %>% convert(int( "carbon_tax_dummy"), dte("year_s"))
# A tibble: 150 x 3
year_s informal_output carbon_tax_dummy
<date> <dbl> <int>
1 1990-01-01 35.4 0
2 1991-01-01 35.6 0
3 1992-01-01 35.4 0
4 1993-01-01 35.3 0
5 1994-01-01 35.0 0
6 1995-01-01 34.9 0
7 1996-01-01 34.5 0
8 1997-01-01 34.2 0
9 1998-01-01 33.9 0
10 1999-01-01 33.8 0
# … with 140 more rows
>
>
>
> # Set pre and post intervention period
> pre.period <- as.Date(c("1990-01-01", "2013-01-01") )
> post.period <- as.Date(c("2014-01-01", "2020-01-01") )
>
> # Determining the causal impact
> impact <- CausalImpact(informal_small, pre.period, post.period)
Fehler: data is not a numeric or integer vector
> plot(impact)
Fehler in plot(impact) : Objekt 'impact' nicht gefunden
>
I have no knowedge of CausalImpact" so I may be of little help but can you give us a reproducible example (reprex). In particular it would be good to see some sample data in dput() format. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.
Hi, thanks for getting back to me. I actually managed to make it work. The data had too many columns as it seems. The first column "year" needed to be stored in "time.points" now it works...