Page 1 of 1

Confidence interval for variance

Posted: Tue Oct 26, 2021 9:40 pm
by rovargasc
Hello everyone. I am new to creating modules in jamovi. I have the following doubt: I am trying to create a confidence interval for variance, but when I run it in jamovi I get error.

This is what I wrote in the jamovi .a file
CI variance image2.png
CI variance image2.png (6.35 KiB) Viewed 6008 times
Then, in the R code (.b file) I write the following:
CI variance image3.png
CI variance image3.png (25.8 KiB) Viewed 6008 times
but, finally, in Jamovi the following happens
CI variance image4.png
CI variance image4.png (13.86 KiB) Viewed 6008 times
Could you tell me what can I do please? Thanks!

Re: Confidence interval for variance

Posted: Wed Oct 27, 2021 6:21 am
by jonathon
hi,

so you've assigned the variable A to the 'variable' option. so self$options$variable will have the value 'A'. now consider the following:

var(self$options$variable)

the variance of 'A' is undefined, and you'll get a NA or similar.

i'd suggest you want to go:

Code: Select all

if (is.null(self$options$variable))  # if the user hasn't specified a variable, do nothing
    return()

variable <- self$data[[self$options$variable]]
v <- var(variable)
n <- length(variable)
etc.

cheers

jonathon