## Dummy example
## Create dataset
set.seed(10)
x<-rnorm(200,3,2)
y<-3*x+rnorm(200)
dat<-data.frame(y,x)
## Fit a FKML GLD regression
example<-GLD.lm(y~x,data=dat,fun=fun.RMFMKL.ml.m,param="fkml")
## Fit FKML GLD regression with 3 simulations
fit<-GLD.lm.full(y~x,data=dat,fun=fun.RMFMKL.ml.m,param="fkml",n.simu=3)
## Find median regression, use empirical method
med.fit<-GLD.quantreg(0.5,fit,slope="fixed",emp=TRUE)
if (FALSE) {
## Extract the Engel dataset
library(quantreg)
data(engel)
## Fit GLD Regression along with simulations
engel.fit.all<-GLD.lm.full(foodexp~income,data=engel,
param="fmkl",fun=fun.RMFMKL.ml.m)
## Plot coefficient summary
summaryGraphics.gld.lm(engel.fit.all)
## Fit quantile regression from 0.1 to 0.9, with equal spacings between
## quantiles
result<-GLD.quantreg(seq(0.1,.9,length=9),engel.fit.all,intercept="fixed")
## Plot quantile regression lines
fun.plot.q(x=engel$income,y=engel$foodexp,fit=engel.fit.all[[1]],result,
xlab="income",ylab="Food Expense")
## Sometimes the maximum likelihood estimation may fail, for example when
## minimum/maximum support of GLD is exactly at the minimum/maximum value of the
## dataset, if this the case, try to use the L-moment matching method.
engel.fit.all<-GLD.lm.full(foodexp~income,data=engel,
param="fmkl",fun=fun.RMFMKL.lm)
## Fit Accelerated Failure Time model to actg data:
actg.rs<-GLD.lm.full.surv(log(time)~factor(txgrp)+hemophil+cd4+priorzdv+age,
censoring=actg[which(actg$txgrp!=3 & actg$txgrp!=4),]$censor,
data=actg[which(actg$txgrp!=3 & actg$txgrp!=4),],
param="rs",fun=fun.RPRS.ml.m,summary.plot=F,n.simu=1000)
summaryGraphics.gld.surv.lm(actg.rs,label=c("(Intercept)",
"IDV versus no IDV","Hemophiliac","Baseline CD4",
"Months of prior \n ZDV use","Age"),exp="TRUE")
}
Run the code above in your browser using DataLab