LFL: Check linearity assumption

Description Usage Arguments Value Examples

Description

Check linearity assumption in a model using a given link function.

Usage

1
LFL(dsn,X,Y,nkat,link.type,outlier)

Arguments

dsn

data set name containing X and Y;

X

continuous covariate

Y

outcome variable

nkat

number of categories into which X should be divided (an even number)

link.type

link function to be used: link.type is coded as follows: "identity" = identity link; "logit" = logit link; "probit" = probit link; "log" = log link; "clog-log" = complementary log-log link; "log-log" = log-log link; "reciprocal" = reciprocal link;

outlier

exclude outliers from the plot.

Value

Return a matrix with 6 columns:

X

intervals of continuous covariate.

Frequency

number of observations in each group.

mean

group means of outcome variable.

link

name of link function.

gmu

group means of outcome variable with link function.

midpt

median of continuous covariate in each group.

Examples

1
2
3
4
5
6
7
Data.X <- runif(1000)
Data.Y <- exp(Data.X+1)+rnorm(1000,0,1)
Data <- data.frame(cbind(Data.X,Data.Y))
LFL(Data,"Data.Y","Data.X",20,4)
##Use NH data:
NH$quality.rating <- (scale(NH$quality.rating)/2+0.5)
LFL(dsn = NH,Y = "quality.rating", X = "RNHRD", nkat = 40, link.type = "logit", outlier = F)

CastleLi/BetaPSS documentation built on May 15, 2019, 10:34 p.m.