cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar

Taylor Series Linearization to Calculate Variance in NHANES

Hello, 


Looking at the NHANES data that incorporates demographic weightings and population stratum & PSU, is there a way to do a survey design in JMP? There is SAS code attached from the CDC below as well as R & Stata code. 

https://wwwn.cdc.gov/nchs/nhanes/tutorials/Module4.aspx

Code: 
SAS

PROC SURVEYMEANS data=one varmethod=taylor nomcar;
  STRATA sdmvstra;
  CLUSTER sdmvpsu;
  WEIGHT WTMEC4YR;
  DOMAIN Select;
   * more statements...;
run;


Ideally, I can get this done so that I can run the tabulate function, which I am very found of in JMP. 
 

M. Dereviankin
1 REPLY 1
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Taylor Series Linearization to Calculate Variance in NHANES

I am not sure whether you can do this in just JMP/JSL, but JMP makes it so convenient to run R code I wonder if it is worth reinventing the wheel here. You could let R do the analysis and then bring results back into JMP to use tabulate/graph builder.

 

I've not tested this, but after installing R your code would look something like this:

 

Names default to here(1);

//Open R
R Init();

//Open your data table here:
dt = Current data table();

//send data to R
R Send(dt);

//run your code
R Submit( "\[
	# install package if needed, really only needs to happen once
	if (!("survey" %in% installed.packages())) install.packages("survey")
	
	#load package
	library(survey)

	#code from the website, you will want to verify column names here
	NHANES_all <- svydesign(data=dt, id=~SDMVPSU, strata=~SDMVSTRA, weights=~WTMEC4YR, nest=TRUE)                    
	NHANES <- subset(NHANES_all, inAnalysis==1)
	m <- svymean(~Depression, NHANES)
	
]\" );

//return data from R
svymean = R Get( m )

//Close R
R Term();

More info on integrating R with JMP:

https://www.jmp.com/en_au/events/ondemand/mastering-jmp/jmp-and-r-integration.html

https://community.jmp.com/t5/JMPer-Cable/Getting-started-with-the-JMP-to-R-Interface/ba-p/43920

 

And here is some info on the R package they use:

https://cran.r-project.org/web/packages/survey/survey.pdf