Estimadores de Lui¿Cómo se pueden calcular las estimaciones de Liu usando JMP pro?
Adjunto
Datos reales obtenidos del Hospital Central Infantil de Bagdad - Irak, que representan el número de casos de defectos congénitos de niños en el corazón y sistema circulatorio para el período (2006-2011).
Saludos
AnalíticaTabla de datossecuencias de comandosRe: Estimadores de LuiNo puedo encontrar esta estadística en el índice de estadísticas en JMP. No estoy familiarizado con este estimador. Proporcione una referencia para ello. ¡Gracias!
Re: Estimadores LuiEl método de Liu es un método similar al método de regresión de crestas, que se utiliza para estimar los parámetros de un modelo de regresión de Poisson en caso de que los datos sufran un problema de multicolinealidad.
doi:10.1016/j.jspi.2010.05.030
https://doi.org/10.1080%2F03610929508831585
La Red Integral de Archivos R (r-project.org)
Re: Estimadores de Lui¡Gracias por el fondo!
Mientras tanto, puedes ejecutar código R desde JMP , si eso ayudaría.
Re: Estimadores de LuiEstimado Sr. Markbailey
No sé cómo ejecutar códigos de programa R a través de JMP pro.
(Lo intenté una vez y no pude hacerlo)
Por favor, si lo sabes, ayúdame.
Saludos
Re: Estimadores de Lui¿Leyó la documentación de JMP que cité anteriormente? usted puede encontrar este blanco papel útil, también.
Aquí hay un ejemplo del uso de R con JMP en un proyecto mío reciente. Muestro dos versiones. El primero usa matrices para transferir datos entre JMP y R.
Names Default to Here( 1 );
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
// use Big Class from JMP Sample Data Folder
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
x = :height << Get As Matrix;
y = :weight << Get As Matrix;
Close( dt, No Save );
// connect to R session
R Init( );
// send JMP data as vectors
R Send( x );
R Send( y );
// use mcreg function in mcr package with entire data set
R Submit("
library( mcr )
mc <- mcreg( x, y, alpha = 0.05, method.reg = \!"PaBa\!", method.ci = \!"analytical\!", slope.measure = \!"tangent\!" )
print( mc )
parms <- getCoefficients( mc )
pred <- parms[1] + parms[2]*x
print( pred )
resid <- y - pred
print( resid )
");
// close R connection
R Term();
// select View > Log (Windows) or Windows > Log (macOS) to see results
La segunda versión usa la tabla de datos JMP en su lugar. Se convierte en un marco de datos en R.
Names Default to Here( 1 );
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
// use Big Class from JMP Sample Data Folder
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
x = :height << Get As Matrix;
y = :weight << Get As Matrix;
Close( dt, No Save );
// connect to R session
R Init( );
// send JMP data as vectors
R Send( x );
R Send( y );
// use mcreg function in mcr package with entire data set
R Submit("
library( mcr )
mc <- mcreg( x, y, alpha = 0.05, method.reg = \!"PaBa\!", method.ci = \!"analytical\!", slope.measure = \!"tangent\!" )
print( mc )
parms <- getCoefficients( mc )
pred <- parms[1] + parms[2]*x
print( pred )
resid <- y - pred
print( resid )
");
// close R connection
R Term();
// select View > Log (Windows) or Windows > Log (macOS) to see results
Puede enviar comandos individuales a R o, como ilustré, un script R completo como una cadena de caracteres. Puede usar todas las características de JSL para cadenas y expresiones para crear scripts R personalizados "sobre la marcha".
Re: Estimadores de LuiEstimado
JMP no se conecta con R, leyó y aplicó los comentarios que envió.
¡Pero no lo logré!
Saludos
Re: Estimadores de Lui¿Qué versión de JMP Pro está ejecutando y en qué sistema operativo?
¿Tiene R instalado en su computadora o lo ejecuta en una computadora separada?
Si está instalado en la misma computadora en la que está instalado JMP, ¿qué mensajes se imprimen cuando ejecuta el siguiente script?
Names Default To Here( 1 );
R Init();
R Term();
Re: Estimadores de LuiEstimado
Uso JMPPro versión 16 y R versión 4.1.3
Los dos programas están instalados en la misma computadora que ejecuta Windows Pro 11
y leí las notas en este enlace:
wp-jmp-sinergies-python-r.pdf
¡Pero no lo logré!
Re: Estimadores de LuiNames Default to Here( 1 );
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
// Open Data Table: fatima data.jmp
dta = Open( "/D:/Rdata/fatima data.jmp" );
x1 = :the totals of the children weights << Get As Matrix;
x2 = :age sums of children parents << Get As Matrix;
x3 = :age sums of the mothers of the children << Get As Matrix;
x4 = :number of infected male children << Get As Matrix;
x5 = :number of infected female children << Get As Matrix;
x6 = :number of infected children born from consanguineous marriages << Get As Matrix;
x7 = :children whose mothers were exposed to radiation during pregnancy << Get As Matrix;
y = :total children with congenital heart defects << Get As Matrix;
Close( dta, No Save );
// connect to R session
R Init( );
// send JMP data as vectors
R Send( x1 );
R Send( x2 );
R Send( x3 );
R Send( x4 );
R Send( x5 );
R Send( x6 );
R Send( x7 );
R Send( y );
// use mcreg function in mcr package with entire data set
R Submit("
library(liureg)
mod <-liu(y~., data = as.data.frame(dta), d = seq(0, 0.1, 0.01), scaling = "centered")
print( mod )
## Liu Var-Cov matrix
vcov(mod)
## Liu biasing parameters by researchers
dest(mod)
## Liu related statistics
lstats(mod)
");este es mi script para ejecutar (regresión liu) de jmp a R.
¡¿no correr?!
#nota: los datos adjuntos a continuación
Re: Estimadores de LuiNames Default to Here( 1 );
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
// Open Data Table: fatima data.jmp
dta = Open( "/D:/Rdata/fatima data.jmp" );
x1 = :the totals of the children weights << Get As Matrix;
x2 = :age sums of children parents << Get As Matrix;
x3 = :age sums of the mothers of the children << Get As Matrix;
x4 = :number of infected male children << Get As Matrix;
x5 = :number of infected female children << Get As Matrix;
x6 = :number of infected children born from consanguineous marriages << Get As Matrix;
x7 = :children whose mothers were exposed to radiation during pregnancy << Get As Matrix;
y = :total children with congenital heart defects << Get As Matrix;
Close( dta, No Save );
// connect to R session
R Init( );
// send JMP data as vectors
R Send( x1 );
R Send( x2 );
R Send( x3 );
R Send( x4 );
R Send( x5 );
R Send( x6 );
R Send( x7 );
R Send( y );
// use mcreg function in mcr package with entire data set
R Submit("
library(liureg)
mod <-liu(y~., data = as.data.frame(dta), d = seq(0, 0.1, 0.01), scaling = "centered")
print( mod )
## Liu Var-Cov matrix
vcov(mod)
## Liu biasing parameters by researchers
dest(mod)
## Liu related statistics
lstats(mod)
");este es mi script para ejecutar (regresión liu) de jmp a R.
¡¿no correr?!
#nota: los datos adjuntos a continuación
Re: Estimadores de LuiModifiqué su JSL para que coincida con los nombres de las columnas de la tabla de datos incluida.También agregué Send() para mover los datos de dta a r.
Names Default to Here( 1 );
// make sure JMP can find the desired installed version of R
//Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
// Open Data Table: fatima data.jmp
//dta = Open( "/D:/Rdata/fatima data.jmp" );
dta=current data table();
x1 = :"the totals of the children's weights 109 75.4 69.5 36.2 6.9"n << Get As Matrix;
x2 = :"Age sums of children's parents 1260 811 735 201 82"n << Get As Matrix;
x3 = :"Age sums of the mothers of the children 915 619 503 168 61"n << Get As Matrix;
x4 = :"The number of infected male children 29 18 11 3 2"n << Get As Matrix;
x5 = :"Number of infected female children 10 3 7 2 0"n << Get As Matrix;
x6 = :"Number of infected children born from consanguineous marriages 9 5 3 1 0"n << Get As Matrix;
x7 = :"Number of infected children whose mothers were exposed to radiation during pregnancy 11 3 1 1 0"n << Get As Matrix;
y = :"Total children with congenital heart defects 39 21 18 5 2"n << Get As Matrix;
//Close( dta, No Save );
// connect to R session
R Init( );
// send JMP data as vectors
R Send( x1 );
R Send( x2 );
R Send( x3 );
R Send( x4 );
R Send( x5 );
R Send( x6 );
R Send( x7 );
R Send( y );
R Send(dta);
// use mcreg function in mcr package with entire data set
R Submit("
library(liureg)
mod <-liu(y~., data = as.data.frame(dta), d = seq(0, 0.1, 0.01), scaling = \!"centered\!")
print( mod )
## Liu Var-Cov matrix
vcov(mod)
## Liu biasing parameters by researchers
dest(mod)
## Liu related statistics
lstats(mod)
");
r term();
Los resultados de r fueron
TKIntRJMP.R version 14.0
Call:
liu.default(formula = y ~ ., data = as.data.frame(dta), d = seq(0,
0.1, 0.01), scaling = "centered")
Intercept no.1.2.3.4.5
d=0 NA NA
d=0.01 NA NA
d=0.02 NA NA
d=0.03 NA NA
d=0.04 NA NA
d=0.05 NA NA
d=0.06 NA NA
d=0.07 NA NA
d=0.08 NA NA
d=0.09 NA NA
d=0.1 NA NA
Total.children.with.congenital.heart.defects.39.21.18.5.2
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
the.totals.of.the.children.s.weights.109.75.4.69.5.36.2.6.9
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
Age.sums.of.children.s.parents.1260.811.735.201.82
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
Age.sums.of.the.mothers.of.the.children.915.619.503.168.61
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
The.number.of.infected.male.children.29.18.11.3.2
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
Number.of.infected.female.children.10.3.7.2.0
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
Number.of.infected.children.born.from.consanguineous.marriages.9.5.3.1.0
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
Number.of.infected.children.whose.mothers.were.exposed.to.radiation.during.pregnancy.11.3.1.1.0
d=0 NA
d=0.01 NA
d=0.02 NA
d=0.03 NA
d=0.04 NA
d=0.05 NA
d=0.06 NA
d=0.07 NA
d=0.08 NA
d=0.09 NA
d=0.1 NA
Error: Error in solve.default(t(x) %*% x) :
system is computationally singular: reciprocal condition number = 1.28204e-20
0
la interfaz parece estar funcionando, parece que hay un problema de datos.
Re: Sus estimadoresTengo dos comentarios que podrían ser útiles.
En primer lugar, les mostré cómo asegurarse de que JMP encuentre R después de instalarlo. Aquí tienen el código JSL para ello. ¿Coincide la ruta que utilizo con la que deberían usar? Por favor, verifiquen que la ubicación sea correcta.
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
Tu script de R hace referencia a un marco de datos `dta`, pero se trata de una tabla de datos de JMP que no enviaste. En su lugar, enviaste las columnas de datos de JMP como vectores individuales a R. Por lo tanto, debes crear el marco de datos en R a partir de los vectores que enviaste, o bien enviar la tabla de datos en lugar de los vectores y usarla en R. JMP crea automáticamente un marco de datos para R, por lo que esta última opción parece más sencilla y eficiente. Consulta mi segundo ejemplo anterior.
Además, asegúrese de llamar a esta función al final de su script:
R Term();