This function provides help to display a series of bivariate points given in 'dat' (multiple data formats possible), to model a linear regression and plot the results. Furthermore, a confidence interval to the regression may be added to the plot, regression parameters get be displayed.
plotLinReg(
dat,
indepVarLst = NULL,
dependVar = NULL,
cusTxt = NULL,
regrLty = 1,
regrLwd = 1,
regrCol = 1,
confInt = 0.95,
confCol = NULL,
xLab = NULL,
yLab = NULL,
xLim = NULL,
yLim = NULL,
tit = NULL,
nSignif = 3,
col = 1,
pch = 1,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
This functions simply plots (to the current graphical devce); an invisible list containing $data, $linRegr, $confInterval (if calculated) may be returned, too
(numeric, data.frame or list) main data to plot/inspect. If numeric 'dat' will be used as dependent variable (y-data)
together with numeric 'indepVarLst' (independent variable); if list, then list-elments indepVarLst
and dependVar
will be used; if matrix, the the 1st and 2nd colum will be used
(character) if 'dat' is list, this designes the list element with the explanatory or independent variable (ie the variable used for explaining, typically x-data)
(character) if 'dat' is list, this designes the list element with dependent variable (ie the variable to be explained, typically y-data) to test
(character) optional custom text to display in subtitle (instead of p-value to H0: slope.regression=0)
(integer) line type for regression
(integer) line width for regression
(integer) color of regression-line
(numeric, between 0 and 1) the probabiity alpha for the regression interval, if NULL
no confidence intervall will be plotted/calculated
(character) (background) color for confidence-interval
(character) optional custom x-label
(character) optional custom y-label
(numeric) custom limit for x-axis (see also par
)
(numeric) custom limit for y-axis (see also par
)
(character) optional title
(integer) number of significant digits for regression parameters in subtitle of plot
(integer or character) custom color for points (choose NULL
for not plotting the actual data)
(integer or character) type of symbol for points (see also par
)
(logical) suppress messages
(logical) additional messages for debugging
(character) allow easier tracking of messages produced
exclExtrValues
for decision of potential outliers; hist
, vioplotW
set.seed(2020); dat1 <- rep(1:6,each=2) +runif(12,0,1)
plotLinReg(dat1, gl(6,2))
## extract elements out of list :
li2 <- list(aa=gl(5,2), bb=dat1[1:10])
plotLinReg(li2, indepVarLst="aa", dependVar="bb")
Run the code above in your browser using DataLab