coe_sum <-
function(data.name, data, data.folder="I:/Dropbox/1_STB Project/R scripts/Output 3D",
weights, picked, selected, func,
para.initials=list(a1 = 0.03, b1 = 1, a2=0.3, b2=0.6),
dist=3, trans="log", output=TRUE, intg.length=0,
func.name, xlab, ylab="Integral",
file.folder=getwd(), file.name, auto.smooth=TRUE,
pdf=TRUE){
if(!missing(data.name)){
if (!missing(data))
cat("data.name and data are supplied at the same time, and data is used.\n")
else data = read_3d(data.name, data.folder)
}
coe_lm_fit <-
coe_lm(mat=data, weights=weights, picked=picked, xlabel=xlab,
func=func, para.initials=para.initials)
if (pdf) pdf(paste(file.folder, "/", file.name, ".pdf", sep=""), width=16, height=12)
print(coe_lm_fit$fit_plot)
print(coe_lm_fit$residual_plot)
print(coe_lm_fit$coe_result_plot_func1)
print(coe_lm_fit$coe_result_plot_func2)
print(coe_lm_fit$coe_result_plot_all)
coe_gam_fit<-
coe_gam(data=coe_lm_fit$nls_fitting_all, dist=dist, trans=trans, output=output,
intg.length=intg.length, func.name=func.name,
xlab=xlab, ylab=ylab, file.folder=file.folder,
file.name=file.name, auto.smooth=auto.smooth)
nls_fit <- nls_1d_fit(mat=data, picked=selected,
func=func, para.initials=para.initials)
# ymax <- max(data[, selected+1-adjust],na.rm=T)
# ymin <- min(data[, selected+1-adjust])
# yupper <- min(ymax*1.1,1, na.rm=T)
# ylower <- max((ymin-abs(ymin)*0.1), 0)
# print(nls_fit$plot+coord_cartesian(ylim=c(0, yupper)))
print(nls_fit$plot)
if (pdf) dev.off()
return(list(coe_lm_fit=coe_lm_fit, coe_gam_fit=coe_gam_fit, nls_fit=nls_fit))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.