Confidence interval for variance

Everything related to the development of modules in jamovi
Post Reply
rovargasc
Posts: 10
Joined: Tue Oct 26, 2021 9:22 pm

Confidence interval for variance

Post 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 4487 times
Then, in the R code (.b file) I write the following:
CI variance image3.png
CI variance image3.png (25.8 KiB) Viewed 4487 times
but, finally, in Jamovi the following happens
CI variance image4.png
CI variance image4.png (13.86 KiB) Viewed 4487 times
Could you tell me what can I do please? Thanks!
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Confidence interval for variance

Post 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
Post Reply