EDIT: Just wanted to let you all know I figured out the issue-- the indirects function I was using indicated that the boot function should use the 6th regression coefficient in the linear regression model to do its things but it turns out I only had five coefficients in this particular model. Whoops, haha. Thank you to everyone who helped me troubleshoot this!
I know this issue has been addressed in past posts (here and here) but I have not been able to resolve it using the answers given there. The first post said that there was a NA
in t
but I didn't know what t
was. The second post said to remove missing values from the variables you're using, but I've checked and none of my variables have missing values.
I know I need to give a "reproducible example" (meaning I would need to upload the data set, yes?) but I can't figure out how to upload data to a question. I have checked StackOverflow's help center, FAQ's, and advanced editing help page. I would really, really appreciate it if someone could explain to me how to upload R data in order to give a reproducible example.
The code I am using is:
indirects = function(data,indices) {
return(lm(monin2$directharm~monin2$racismc*monin2$vig+monin2$manip)$coef[6] *
lm(monin2$hatecrime~monin2$racismc*monin2$vig+monin2$manip+monin2$directharm,data=data,subset=indices)$coef[6]) }
b = boot(data=monin2,statistic=indirects,R=5000)
ci = boot.ci(b,conf=.95,type="bca")
b
ci
The error it produces is
Error in if (const(t, min(1e-08, mean(t, na.rm = TRUE)/1e+06))) { :
missing value where TRUE/FALSE needed
I used the following code to check if any of my variables had missing values, and my interpretation of the output is that no missing values exist in any of them:
which (is.na(monin2$hatecrime))
integer(0)
> which (is.na(monin2$directharm))
integer(0)
> which (is.na(monin2$vig))
integer(0)
> which (is.na(monin2$manip))
integer(0)
> which (is.na(monin2$racismc))
integer(0)