Title: | Estimate Quantiles Curves |
---|---|
Description: | Non-parametric methods as local normal regression, polynomial local regression and penalized cubic B-splines regression are used to estimate quantiles curves. See Fan and Gijbels (1996) <doi:10.1201/9780203748725> and Perperoglou et al.(2019) <doi:10.1186/s12874-019-0666-3>. |
Authors: | Sandie Ferrigno [cre, aut], Dounia Essaket [ctb], Arthur Mouchot [ctb], Hugo Breton [ctb], Myriam Maumy [ctb] |
Maintainer: | Sandie Ferrigno <[email protected]> |
License: | CeCILL |
Version: | 1.0.0 |
Built: | 2025-03-08 04:00:44 UTC |
Source: | https://github.com/cran/quantCurves |
bandwidth selection function
bandwidth(x, y, method = "CV")
bandwidth(x, y, method = "CV")
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
method |
the bandwidth method choice: CV or plug-in. Default is CV. |
Calculates the bandwidth value using cross validation or plug-in method (for localLin and localCst methods)
#create a data frame example<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(example)<-c("Gestational Age in weeks","Weight in gramms") x<-example$`Gestational Age in weeks` y<-example$`Weight in gramms` #calculate the window value bandwidth(x,y)
#create a data frame example<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(example)<-c("Gestational Age in weeks","Weight in gramms") x<-example$`Gestational Age in weeks` y<-example$`Weight in gramms` #calculate the window value bandwidth(x,y)
Cubic Penalized B-splines quantile regression
bsplines( x, y, lambdas, d = 3, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), leg = TRUE, axes.lab = NULL )
bsplines( x, y, lambdas, d = 3, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), leg = TRUE, axes.lab = NULL )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
lambdas |
tunes the tradeoff between the goodness of fit and the regularity of the spline - numeric value or numeric vector |
d |
differentiation order - 1, 2 or 3. Default is set to d=3. |
cents |
numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)). |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
axes.lab |
NULL or c("Nom_axe_X, Nom_axe_Y"). |
Plots the curves at centiles selected and returns an object of class gcrq.
#create a sample data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000) ages<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42) bsplines(ages,weights,lambdas=50)
#create a sample data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000) ages<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42) bsplines(ages,weights,lambdas=50)
Centile curves using B-splines compared to noise data
bSplinesData( x, y, lambdas, data, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), leg = FALSE )
bSplinesData( x, y, lambdas, data, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), leg = FALSE )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
lambdas |
to be set by user. Can be a vector or a single numeric value. Tunes the tradeoff between the goodness of fit and the regularity of the spline - numeric value or numeric vector |
data |
the noise data to be compared to |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)) |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
Plots centile curves with B-splines of different differential orders (d) and displays them on the same figure as the noise data
#create a sample data frame sample<-data.frame(sample(30:42,30,rep=TRUE),sample(800:5000,30,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,6,rep=TRUE),sample(800:5000,6,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") bSplinesData(x,y,lambdas=1,abnormal)
#create a sample data frame sample<-data.frame(sample(30:42,30,rep=TRUE),sample(800:5000,30,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,6,rep=TRUE),sample(800:5000,6,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") bSplinesData(x,y,lambdas=1,abnormal)
Centile curves based on one of the different methods
CentCurv( x, y, bandwidth.select = "CV", method, lambdas = 0, kernel = locpol::gaussK, d = 3, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = FALSE )
CentCurv( x, y, bandwidth.select = "CV", method, lambdas = 0, kernel = locpol::gaussK, d = 3, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = FALSE )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.select |
the bandwidth method choice: CV or plug-in. Default is CV. |
method |
str - The method choosen for displaying the curve. Could be: "Local normal constant", "Local normal linear", "Polynomial local" or "B-splines". |
lambdas |
set to 0. To be set if method chosen is "B-Splines". Tunes the tradeoff between the goodness of fit and the regularity of the spline - numeric value or numeric vector |
kernel |
the Kernel function that will be used in the algorithm ("trig", "gauss", "circ", "cubic" or "epan"). |
d |
differentiation order - 1, 2 or 3. Default is set to d=3. |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97) ) |
disp_window |
Boolean. Should the scale of bandwidth be displayed (TRUE) or not (FALSE). |
Plots centile curves according to the chosen method
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` CentCurv(x,y,method='Polynomial local') CentCurv(x,y,method='B-Splines',lambdas=1)
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` CentCurv(x,y,method='Polynomial local') CentCurv(x,y,method='B-Splines',lambdas=1)
Centile curves according to different methods
compareCurv(x, y, bandwidth.method = "CV", lambdas, data, leg = FALSE)
compareCurv(x, y, bandwidth.method = "CV", lambdas, data, leg = FALSE)
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the method chosen to calculate bandwdth. Could be cross validation or Plug-in. Default is set to CV. |
lambdas |
to be set for "B-Splines". Can be a vector or a single numeric value. Tunes the tradeoff between the goodness of fit and the regularity of the spline - numeric value or numeric vector |
data |
the abnormal/external data we want to compare the curves with |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
Plots centile curves with the different methods and displays them on the same figure as the noise data to compare
#create a sample data frame sample<-data.frame(sample(30:42,30,rep=TRUE),sample(800:5000,30,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,6,rep=TRUE),sample(800:5000,6,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") compareCurv(x,y,bandwidth.method="Plug-in",lambdas=1,abnormal)
#create a sample data frame sample<-data.frame(sample(30:42,30,rep=TRUE),sample(800:5000,30,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,6,rep=TRUE),sample(800:5000,6,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") compareCurv(x,y,bandwidth.method="Plug-in",lambdas=1,abnormal)
Centile curves based on each of the four different methods
fourCurv(x, y, bandwidth.method = "CV", lambdas)
fourCurv(x, y, bandwidth.method = "CV", lambdas)
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the bandwidth method choice: CV or plug-in. Default is CV (for Local Linear and Local Constant estimators) |
lambdas |
tunes the tradeoff between the goodness of fit and the regularity of the spline - numeric value or numeric vector (for penalized B-spline estimator). |
Four graphs, one for each of the following methods : Local Linear, Local Constant, Cubic Splines and penalized B-splines.
#create a sample data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(weights,age) colnames(sample)<-c("Weight in gramms","Gestational Age in weeks") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` fourCurv(x,y, lambdas=seq(1,10))
#create a sample data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(weights,age) colnames(sample)<-c("Weight in gramms","Gestational Age in weeks") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` fourCurv(x,y, lambdas=seq(1,10))
Normal local constant estimator
locNormCst( x, y, bandwidth.method = "CV", kernel = locpol::gaussK, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = TRUE, leg = FALSE, axes.lab = NULL )
locNormCst( x, y, bandwidth.method = "CV", kernel = locpol::gaussK, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = TRUE, leg = FALSE, axes.lab = NULL )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the bandwidth method choice: CV or plug-in. Default is CV. |
kernel |
Kernel used to perform the estimation, see Kernels (from locpol). |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)). |
disp_window |
Boolean. Should the scale of bandwidth be displayed (TRUE) or not (FALSE). |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
axes.lab |
NULL or c("Nom_axe_X, Nom_axe_Y"). |
Plots the centile curves and returns a list object containing bandwidth value and estimated centiles values.
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` #calculate the centile and plot the curves locNormCst(x,y, kernel=locpol::gaussK)
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` #calculate the centile and plot the curves locNormCst(x,y, kernel=locpol::gaussK)
Centile curves using local polynomial compared to noise data
locNormCstData( x, y, bandwidth.method, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), data, leg = FALSE )
locNormCstData( x, y, bandwidth.method, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), data, leg = FALSE )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the method chosen to calculate bandwidth. Could be cross validation or Plug-in. Default is set to CV. |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97) ) |
data |
the noise data we want to compare |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
Plots centile curves with local constant polynomial and displays them on the same figure as the noise data to be compared
#create an example data frame example<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE)) colnames(example)<-c("Gestational Age in weeks","Weight in gramms") x<-example$`Gestational Age in weeks` y<-example$`Weight in gramms` abnormal<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") locNormCstData(x,y,bandwidth.method="Plug-in",cents=c(0.03,0.25,0.50,0.75,0.97),data=abnormal)
#create an example data frame example<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE)) colnames(example)<-c("Gestational Age in weeks","Weight in gramms") x<-example$`Gestational Age in weeks` y<-example$`Weight in gramms` abnormal<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") locNormCstData(x,y,bandwidth.method="Plug-in",cents=c(0.03,0.25,0.50,0.75,0.97),data=abnormal)
Normal local Linear estimator
locNormLin( x, y, bandwidth.method = "CV", kernel = locpol::gaussK, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = TRUE, leg = TRUE, axes.lab = NULL )
locNormLin( x, y, bandwidth.method = "CV", kernel = locpol::gaussK, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = TRUE, leg = TRUE, axes.lab = NULL )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the bandwidth method choice: CV or plug-in. Default is CV. |
kernel |
Kernel used to perform the estimation, see Kernels (from locpol). |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)). |
disp_window |
Boolean. Should the scale of bandwidth be displayed (TRUE) or not (FALSE). |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
axes.lab |
NULL or c("Nom_axe_X, Nom_axe_Y"). |
Plots the centile curves and returns a list object containing bandwidth value and estimated centiles values.
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` #calculate the centile and plot the curves locNormLin(x,y)
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` #calculate the centile and plot the curves locNormLin(x,y)
Centile curves using local linear polynomial compared to noise data
locNormLinData( x, y, bandwidth.method, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), data, leg = FALSE )
locNormLinData( x, y, bandwidth.method, cents = c(0.03, 0.25, 0.5, 0.75, 0.97), data, leg = FALSE )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the method chosen to calculate bandwidth. Could be cross validation or Plug-in. Default is set to CV. |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)) |
data |
the noise data we want to compare |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
Plots centile curves with local linear polynomial using a Gaussian kernel and displays them on the same figure as the noise data to be compared
#create a sample data frame sample<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") locNormLinData(x,y,bandwidth.method="Plug-in",cents=c(0.03,0.25,0.50,0.75,0.97),data=abnormal)
#create a sample data frame sample<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") locNormLinData(x,y,bandwidth.method="Plug-in",cents=c(0.03,0.25,0.50,0.75,0.97),data=abnormal)
Polynomial local linear estimator
polylocLin( x, y, bandwidth.method = "CV", cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = TRUE, leg = TRUE, axes.lab = NULL )
polylocLin( x, y, bandwidth.method = "CV", cents = c(0.03, 0.25, 0.5, 0.75, 0.97), disp_window = TRUE, leg = TRUE, axes.lab = NULL )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the bandwidth method choice: CV or plug-in. Default is CV. |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)). |
disp_window |
Boolean. Should the scale of bandwidth be displayed (TRUE) or not (FALSE). |
leg |
Boolean. Should the legend be desplayed (TRUE) or not (FALSE). |
axes.lab |
NULL or c("Nom_axe_X, Nom_axe_Y"). |
Plots the centile curves and returns a list object containing bandwidth value and estimated centiles values.
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` #calculate the centile and plot the curves polylocLin(x,y)
#create an example data frame weights=c(500,600,1000,1150,1200,1260,1240,1300,1370,1500,2000,2100,2150,2500, 2800,2900,3050,3200,2980,3000,3300,3100,3200,3600,3500,3700,3900,3900,4000, 4200,3000,4500,4300,4900,4350,3700,4000,5000,4300) age<-c(30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,36, 37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42) sample<-data.frame(age,weights) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` #calculate the centile and plot the curves polylocLin(x,y)
Polynomial local linear estimator compared to noise data
polylocLinData( x, y, bandwidth.method = "Plug-in", cents = c(0.03, 0.25, 0.5, 0.75, 0.97), data, leg = FALSE )
polylocLinData( x, y, bandwidth.method = "Plug-in", cents = c(0.03, 0.25, 0.5, 0.75, 0.97), data, leg = FALSE )
x |
the explanatory variable - numeric |
y |
the response variable - numeric |
bandwidth.method |
the bandwidth method choice: CV or plug-in. Default is CV. |
cents |
A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97)). |
data |
the noise data we want to compare |
leg |
Boolean. Should the legend be displayed (TRUE) or not (FALSE). |
Plots the centile curves and data points to compare with.
#create a sample data frame sample<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") polylocLinData(x,y,bandwidth.method="Plug-in",cents=c(0.03,0.25,0.50,0.75,0.97),data=abnormal)
#create a sample data frame sample<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE)) colnames(sample)<-c("Gestational Age in weeks","Weight in gramms") x<-sample$`Gestational Age in weeks` y<-sample$`Weight in gramms` abnormal<-data.frame(sample(30:42,10,rep=TRUE),sample(800:5000,10,rep=TRUE)) colnames(abnormal)<-c("Gestational Age in weeks","Weight in gramms") polylocLinData(x,y,bandwidth.method="Plug-in",cents=c(0.03,0.25,0.50,0.75,0.97),data=abnormal)