dagitty icon indicating copy to clipboard operation
dagitty copied to clipboard

Problem with localTests function

Open juandavidgutier opened this issue 4 years ago • 0 comments

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]

juandavidgutier avatar Feb 09 '22 00:02 juandavidgutier