pre.psi: predict treatment in psi-Learning

Description Usage Arguments Value Examples

View source: R/pre.R

Description

This function predicts the optimal treatments with model of psi-Learning,which is estimated from psiITR or psiITR_VS

Usage

1
pre.psi(fitobj,Xnew,X=NULL,kernel='linear')

Arguments

fitobj

model of class from psi-Learning

Xnew

new data for prediction, mainly n by p input matrix.

X

in linear case this is NULL and in 'rbf' kernel case this is the training data

kernel

kernel function for psi-Learning, can be 'linear' or 'rbf' (radial basis kernel), default is 'linear'.When using 'rbf' , the bandwidth parameter sigma is asked to provide

Value

predicted treatment for each new observation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
          n=100;p=5;ntest=200
          X=replicate(p,runif(n, min = -1, max = 1))
          A=2*rbinom(n, 1, 0.5)-1
          T=cbind(rep(1,n,1),X)%*%c(1,2,1,0.5,rep(0,1,p-3))
          T0=(cbind(rep(1,n,1),X)%*%c(0.54,-1.8,-1.8,rep(0,1,p-2)))*A
          R=as.vector(rnorm(n,mean=0,sd=1)+T+T0)
          cv_psi_Linear<-cv.psiITR(X,A,R,m=5,kernel='linear',kappa.ratio=0.01,kappa.max=1.5,nkappa=10,tau=0.1,maxit=100, tol=1e-5)
          cv_psi_Rbf<-cv.psiITR(X,A,R,m=5,kernel='rbf',kappa.ratio=0.01,kappa.max=1,nkappa=10,tau=0.1,maxit=100, tol=1e-5)
          Xtest=replicate(p,runif(ntest, min = -1, max = 1))
          pre.psiLin=pre.psi(cv_psi_Linear,Xtest)
          sig=Sig_est(X,A)
          pre.psiRbf=pre.psi(cv_psi_Rbf,Xtest,X,kernel='rbf',sigma=sig)

mylzwq/psi-learning-for-ITR documentation built on Sept. 23, 2018, 12:56 a.m.