Learn R Programming

semsfa (version 1.1)

plot.semsfa: Default SEMSFA plotting

Description

This function plots the semiparametric/nonparametric intermediate model object estimated in the first step of the algorithm and, if efficiencies.semsfa() is esecuted, individual point estimate of the efficiency.

Usage

# S3 method for semsfa
plot(x, g.type, mod, ...)

Value

The function simply generates plots.

Arguments

x

a semsfa object as returned from semsfa() or efficiencies.semsfa()

g.type

a character string indicating the type of plot. Possible values are: "reg" to plot the semiparametric/nonparametric model object estimated in the first step from semsfa(), "eff" to draw point estimate of the efficiency obtained from efficiencies.semsfa()

mod

a character string indicating the plot style for g.type="eff": "hist" for histogram and "dens" for density plot

...

further arguments passed to plot.default.

Author

Giancarlo Ferrara and Francesco Vidoli

See Also

semsfa, efficiencies.semsfa.

Examples

Run this code
set.seed(0)
n<-200

#generate data
x<- runif(n, 1, 2)
fy<- 2+30*x-5*x^2
v<- rnorm(n, 0, 1)
u<- abs(rnorm(n,0,2.5))
#production frontier
y <- fy + v - u
dati<-data.frame(y,x)

#first-step: gam, second-step: fan (default)
o<-semsfa(y~s(x),dati,sem.method="gam")
#the following plot will be like that generated by plot.gam
plot(o,g.type="reg")

#adding a covariate
z<- runif(n, 1, 2)
dati$z<-z

#first-step: kernel, second-step: fan (default)
o<-semsfa(y~x+z,dati,sem.method="kernel")
#the plot will be like that generated by a plot.npreg
if (FALSE) plot(o,g.type="reg")

#calculate efficiencies ...
a<-efficiencies.semsfa(o)
plot(a,g.type="eff",mod="dens")

#adding further parameters as for plot.default: col, main, xlim, ...
plot(a,g.type="eff",mod="dens",col=2,main="Density Efficiency",xlim=c(0,1),xlab="Efficiency")

Run the code above in your browser using DataLab