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

Problem with localTests function #56

Open
juandavidgutier opened this issue Feb 9, 2022 · 0 comments
Open

Problem with localTests function #56

juandavidgutier opened this issue Feb 9, 2022 · 0 comments

Comments

@juandavidgutier
Copy link

Hello,
I am new in dagitty, and I am trying to use localTests function, but I get some errors.

I appreciate your cooperation.

This is my code:

`
library(dagitty)
library(lavaan)
library(CondIndTests)
library(dplyr)

data <- read.csv("D:/clases/UDES/articulo leishmaniasis/causal_inference/dowhy/Data_SD.csv")

data_temp <- select(data, incidence100k, zscore_Temperature,
zscore_SST12, zscore_epac850, zscore_soi, zscore_Forest)

dag_temp <- dagitty('dag {
Temperature [pos="0,0"]
Forest [pos="0.99, 1"]
epac850 [pos="0.66, 1"]
soi [pos="0, 1"]
SST12 [pos="0.33, 1"]
incidence100k [pos="1, 0"]
SST12 -> Temperature
SST12 -> incidence100k
soi -> Temperature
soi -> incidence100k
epac850 -> Temperature
epac850 -> incidence100k
Forest -> Temperature
Forest -> incidence100k
Temperature -> incidence100k }')

plot(dag_temp)

impliedConditionalIndependencies(dag_temp)
corr <- lavCor(data_temp)

plotLocalTestResults(localTests(dag_temp, sample.cov=corr, sample.nobs=nrow(data_temp)))
#HERE THIS ERROR: Error in sample.cov[vars, vars] : subscript out of bounds

plotLocalTestResults(localTests(dag_temp, data, R=100, sample.nobs=nrow(data_temp)))
#HERE THIS ERROR: Error in [.data.frame(x, , ind$X) : undefined columns selected

plotLocalTestResults(localTests(dag_temp, data, R=100, type="cis.loess", sample.nobs=nrow(data_temp)))
#HERE THIS ERROR: Error in [.data.frame(x, , ind$X) : undefined columns selected
`
and here is my dataset:
[Data_SD.csv]

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