Lui推定量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プロでRプログラムコードを実行する方法がわかりません。
(一度試してみましたができませんでした)
よろしければ、助けてください
よろしく
Re:Lui推定量上で引用したJMPのドキュメントを読みましたか? あなたが見つけるかもしれませんこの白紙も便利です。
これは私の最近のプロジェクトでJMPでRを使用した例です。 2つのバージョンを示します。 1つ目は、行列を使用して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
2番目のバージョンは、代わりに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推定量どのバージョンのJMPProを実行していて、どのオペレーティングシステムで実行していますか?
Rをコンピューターにインストールしていますか、それとも別のコンピューターで実行していますか?
JMPがインストールされているのと同じコンピューターにインストールされている場合、次のスクリプトを実行するとどのようなメッセージが出力されますか?
Names Default To Here( 1 );
R Init();
R Term();
Re:Lui推定量拝啓
JMPProバージョン16とRバージョン4.1.3を使用しています
2つのプログラムは、WindowsPro11を実行している同じコンピューターにインストールされます。
そして私はこのリンクのメモを読みました:
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回帰)私のスクリプトです。
走りません?!
#note:以下に添付されているデータ
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: 彼の見積もり担当者お役に立てそうなコメントが2つあります。
まず、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用のデータフレームを自動的に作成するため、後者の方法の方が簡単で効率的です。上記の2番目の例を参照してください。
また、スクリプトの最後に必ずこの関数を呼び出してください。
R Term();