루이 추정기JMP pro를 사용하여 Liu의 추정치를 어떻게 계산할 수 있습니까?!
첨부된
이라크 바그다드에 있는 중앙 아동 병원에서 얻은 실제 데이터로, 해당 기간(2006-2011년) 동안 심장 및 순환계에 선천적 아동의 선천적 결함 사례 수를 나타냅니다.
문안 인사
해석학데이터 테이블스크립팅Re: Lui 추정기JMP의 통계 색인에서 이 통계를 찾을 수 없습니다. 나는 이 추정기에 익숙하지 않습니다. 이에 대한 참조를 제공하십시오. 감사해요!
Re: Lui 추정기Liu의 방법은 다중공선성 문제가 있는 데이터의 경우 푸아송 회귀 모델의 매개변수를 추정하는 데 사용되는 능선 회귀 방법과 유사한 방법입니다.
doi:10.1016/j.jspi.2010.05.030
https://doi.org/10.1080%2F03610929508831585
포괄적인 R 아카이브 네트워크(r-project.org)
Re: Lui 추정기배경 감사합니다!
그동안 JMP에서 R 코드 실행 , 도움이 된다면.
Re: Lui 추정기친애하는 마크베일리 씨
JMP pro를 통해 R 프로그램 코드를 실행하는 방법을 모르겠습니다.
(한번 해봤는데 안되더라구요)
아시는 분 도와주세요.
문안 인사
Re: Lui 추정기위에서 인용한 JMP 문서를 읽었습니까? 당신은 찾을 수 있습니다 이 흰색 종이도 유용하다.
다음은 저의 최근 프로젝트에서 JMP와 함께 R을 사용하는 예입니다. 두 가지 버전을 보여줍니다. 첫 번째는 행렬을 사용하여 JMP와 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
두 번째 버전은 대신 JMP 데이터 테이블을 사용합니다. 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
개별 명령을 R에 보낼 수도 있고, 내가 설명한 대로 전체 R 스크립트를 문자열로 보낼 수도 있습니다. 문자열 및 표현식에 대한 모든 JSL 기능을 사용하여 '즉시' 사용자 정의 R 스크립트를 작성할 수 있습니다.
Re: Lui 추정기귀하에게
JMP는 R과 연결되지 않으며 귀하가 보낸 피드백을 읽고 적용했습니다.
하지만 나는 성공하지 못했다!
문안 인사
Re: Lui 추정기실행 중인 JMP Pro 버전과 운영 체제는 무엇입니까?
컴퓨터에 R이 설치되어 있습니까, 아니면 별도의 컴퓨터에서 실행합니까?
JMP가 설치된 컴퓨터와 동일한 컴퓨터에 설치된 경우 다음 스크립트를 실행하면 어떤 메시지가 출력됩니까?
Names Default To Here( 1 );
R Init();
R Term();
Re: Lui 추정기귀하에게
JMPPro 버전 16과 R 버전 4.1.3을 사용합니다.
두 프로그램은 Windows Pro 11을 실행하는 동일한 컴퓨터에 설치됩니다.
이 링크의 메모를 읽었습니다.
wp-jmp-synergies-python-r.pdf
하지만 나는 성공하지 못했다!
Re: Lui 추정기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" );
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)
");이것은 jmp에서 R로 (liu 회귀)를 실행하는 스크립트입니다.
안 뛰다?!
#참고: 아래 첨부된 데이터
Re: Lui 추정기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" );
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)
");이것은 jmp에서 R로 (liu 회귀)를 실행하는 스크립트입니다.
안 뛰다?!
#참고: 아래 첨부된 데이터
Re: Lui 추정기포함된 데이터 테이블의 열 이름과 일치하도록 JSL을 수정했습니다.또한 dta 데이터를 r로 이동하기 위해 Send()를 추가했습니다.
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();
r의 결과는 다음과 같습니다.
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
인터페이스가 작동하는 것으로 보이며 데이터 문제가 있는 것 같습니다.
Re: 그의 추정치도움이 될 만한 두 가지 의견이 있습니다.
우선, JMP가 R을 설치한 후 제대로 인식하는지 확인하는 방법을 보여드렸습니다. 다음은 그 목적을 위한 JSL 코드입니다. 제가 사용한 경로가 여러분이 사용해야 할 경로와 일치하는지 확인해 주세요. 위치가 정확한지 다시 한번 확인해 주시기 바랍니다.
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
R 스크립트에서 dta 데이터프레임을 참조하고 있는데, 이는 보내주신 JMP 데이터 테이블이 아닙니다. JMP 데이터 열을 개별 벡터로 R에 보내셨습니다. 따라서 보내주신 벡터들을 이용하여 R에서 데이터프레임을 생성하거나, 벡터 대신 데이터 테이블 자체를 보내 R에서 사용해야 합니다. JMP는 R용 데이터프레임을 자동으로 생성하므로 후자의 방법이 더 쉽고 효율적입니다. 위의 두 번째 예시를 참조하세요.
또한 스크립트의 마지막 부분에서 이 함수를 호출하는 것을 잊지 마세요.
R Term();