Package 'ALSM'

Title: Companion to Applied Linear Statistical Models
Description: Functions and Data set presented in Applied Linear Statistical Models Fifth Edition (Chapters 1-9 and 16-25), Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li, 2005. (ISBN-10: 0071122214, ISBN-13: 978-0071122214) that do not exist in R, are gathered in this package. The whole book will be covered in the next versions. Compatibility updates by Renova.
Authors: Ali Ghanbari [aut, cre]
Maintainer: Ali Ghanbari <[email protected]>
License: GPL-2 | GPL-3
Version: 0.2.0.9001
Built: 2026-11-19 06:38:50 UTC
Source: https://github.com/renova-r/ALSM

Help Index


ABT Electronics Corporation

Description

ABT Electronics Corporation dataset

Usage

data("ABTElectronicsCorporation")

Format

A data frame with 40 observations on the following 3 variables.

y

response variable

group

factor variable

row

index corresponding to each response

Examples

data(ABTElectronicsCorporation)
## maybe str(ABTElectronicsCorporation) ; plot(ABTElectronicsCorporation) ...

Calculate AIC

Description

Akaike's information criterion

AIC=n∗ln(SSEp)−n∗ln(n)+2∗pAIC = n*ln(SSEp)-n*ln(n)+2*p

Usage

AICp(model)

Arguments

model

model of regression

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. page 360

See Also

cpc,SBCp,pressc

Examples

#### example page 360
AICp(lm(lny~x4,SurgicalUnit))

Aligned dot plot specific variable correspond to two factor

Description

Aligned dot plot specific variable correspond to two factor

Usage

aligned.dot.plot2(y, factor1, factor2)

Arguments

y

variable based on plot aligned dot plot

factor1

first factor variable

factor2

second factor variable

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition.

Examples

library('ALSM')
y=CashOffers$y
A=CashOffers$A
B=CashOffers$B
aligned.dot.plot2(y,A,B)

ApexEnterprises

Description

ApexEnterprises

Usage

data("ApexEnterprises")

Format

A data frame with 20 observations on the following 3 variables.

y

a numeric vector

officer

a numeric vector

candidate

a numeric vector

References

neter

Examples

data(ApexEnterprises)
## maybe str(ApexEnterprises) ; plot(ApexEnterprises) ...

Auditor Training (10 block)

Description

Auditor Training (10 block)

Usage

data("AuditorTraining_10")

Format

A data frame with 30 observations on the following 3 variables.

y

a numeric vector

block

a numeric vector

factor

a numeric vector

x

covariate

Examples

data(AuditorTraining_10)
## maybe str(AuditorTraining_10) ; plot(AuditorTraining_10) ...

Auditor Training ( 5 block)

Description

Auditor Training ( 5 block)

Usage

data("AuditorTraining_5")

Format

A data frame with 30 observations on the following 4 variables.

y

a numeric vector

block

a numeric vector

factor

a numeric vector

num

a numeric vector

Examples

data(AuditorTraining_5)
## maybe str(AuditorTraining_5) ; plot(AuditorTraining_5) ...

Automatic Search Procedures for Model Selection; Best Subsets Algorithms

Description

best subsets according to a specified criterion are identified without requiring the fitting of all of the possible subset regression models.

Usage

BestSub(x,y,method=c('r2','r2adj','sse','cp','press','aic','sbc'),num=2)

Arguments

x

matrix of predictors

y

response vector

method

best subsets according to this specified criterion. R2,R2adj,sse,cp,press,aic and sbc.

num

number of best subset model per number of predictor variable.

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition.chapter 9

Examples

## page 363
library("leaps")
BestSub(SurgicalUnit[,1:8],SurgicalUnit[,10],method='r2',num=2)

Brown-Forsythe Test between two group

Description

Tests for Constancy of Error Variance between two group

Usage

bftest(fit,group,alpha=.05)

Arguments

fit

model of regression

group

vector, determine two group

alpha

Type I error level

Details

length group and number of observations should be equal

Value

test statistic, p.value, alpha and degree of freedom

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 116

Examples

################### EXAMPLE PAGE 117


### Group
g<-rep(1,25)
g[TolucaCompany$x<=70]=0
### TEST
bftest(lm(y~x,TolucaCompany),g)

Body Fat dataset

Description

study of the relation of amount of body fat (Y) to several possible predictor variables, based on a sample of 20 healthy females 25-34 years old

Usage

data("BodyFat")

Format

A data frame with 20 observations on the following 4 variables.

x1

a numeric vector

x2

a numeric vector

x3

a numeric vector

y

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .TABLE 7.1 page 257

Examples

data(BodyFat)
## maybe str(BodyFat) ; plot(BodyFat) ...

Box-Cox Transformations (SSE)

Description

transformation from the family of power transformations on Y. box-cox transformation according to SSE.

also plot SSE against lambda

Usage

boxcox.sse(x,y,l=seq(-2,2,.1))

Arguments

x

vector predictor variable

y

vector response variable

l

vector, Different values of lambda

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition.page 134

Examples

### table 3.9 & figure 3.17 (page 136)
boxcox.sse(Plasma[,1],Plasma[,2])

### table 18.6 page 792
boxcox.sse(factor(ServoData[,2]),ServoData[,1])

Cash Offers

Description

Cash Offers dataset

Usage

data("CashOffers")

Format

A data frame with 36 observations on the following 3 variables.

y

response variable

A

factor variable

B

factor variable

num

index corresponding to each response

x

covariate

Examples

data(CashOffers)
## maybe str(CashOffers) ; plot(CashOffers) ...

Castle Bakery

Description

Castle Bakery data set

Usage

data("CastleBakery")

Format

A data frame with 12 observations on the following 4 variables.

y

a numeric vector

A

a numeric vector

B

a numeric vector

num

a numeric vector

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. Table 19.7

Examples

data(CastleBakery)
## maybe str(CastleBakery) ; plot(CastleBakery) ...

Estimation and confidence interval of Mean Response and Prediction of New Observation in regression model

Description

Estimation of Mean Response and Prediction of New Observation:

Interval Estimation of E{Y_h}

Confidence Region for Regression Surface. WorkingHotelling confidence band

Simultaneous Confidence Intervals for Several Mean Responses ( Working-Hotelling, Bonferroni confidence limit )

Prediction of New Observation Yh(new)

Prediction of Mean of m New Observations at Xh

Predictions of g New Observations. Simultaneous Scheffe prediction limits for g new observations at g different levels X_h

Usage

ci.reg(model, newdata, type = c("b", "s","w","n","m","nm","gn"), alpha = 0.05,m=1)

Arguments

model

model of regression

newdata

Data frame, New data on which the point estimate and confidencr interval is calculated.

type

Type of confidence interval

alpha

Confidence interval calculate with 1-α\alpha percent

m

When use "type=nm", m is equal, new observations are to be selected at the same levels x_h

Details

Type values:

b Simultaneous Confidence Intervals for Several Mean Responses by Bonferroni simultaneous confidence intervals.

s Simultaneous Scheffe prediction limits for g new observations at g different levels x_h

w Confidence Region for Regression Surface or Simultaneous Confidence Intervals for Several Mean Responses

n Prediction of New Observation.

m Mean response of New Observation.

nm When In new observations are to be selected at the same levels X_h and their mean Yh(new) is to be predicted

gn Simultaneous Bonferroni prediction limits for g new observations at g different levels X_h

NOTE: for the rest of the type states, m = 1.

Value

calculate estimation and cofidence interval

Note

by default, type is 'b'

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition

Examples

#### problem 6.14.a page 250
d<-data.frame(282000,7.1,0)
ci.reg(lm(y~x1+x2+x3,GroceryRetailer),d,type='nm',m=3)

#### problem 6.13.b page 250
d<-data.frame(c(230000,250000,280000,340000),c(7.5,7.3,7.1,6.9),c(0,0,0,0))
ci.reg(lm(y~x1+x2+x3,GroceryRetailer),d,type='gn')

#### problem 6.12.a page 250
d<-data.frame(c(302000,245000,280000,350000,295000),c(7.2,7.4,6.9,7,6.7),c(0,0,0,0,1))
ci.reg(lm(y~x1+x2+x3,GroceryRetailer),d,type='b')

### example page 158
d<-data.frame(c(30,65,100))
ci.reg(lm(y~x,TolucaCompany),d,type='w',alpha=.1)

### example page 54
d<-data.frame(65)
ci.reg(lm(y~x,TolucaCompany),d,type='m',alpha=.1)

### example page 59
d<-data.frame(100)
ci.reg(lm(y~x,TolucaCompany),d,type='n',alpha=.1)

Coin Operated Tenninals

Description

Coin Operated Tenninals

Usage

data("CoinOperatedTenninals")

Format

A data frame with 8 observations on the following 3 variables.

y

a numeric vector

A

a numeric vector

B

a numeric vector

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. problem 20.2

Examples

data(CoinOperatedTenninals)
## maybe str(CoinOperatedTenninals) ; plot(CoinOperatedTenninals) ...

Computerized Game

Description

Computerized Game dataset

Usage

data("ComputerizedGame")

Format

A data frame with 80 observations on the following 3 variables.

y

a numeric vector

group

a numeric vector

num

a numeric vector

Examples

data(ComputerizedGame)
## maybe str(ComputerizedGame) ; plot(ComputerizedGame) ...

Calculate cp critera

Description

Mallows' Cp Criterion

Usage

cpc(r,f)

Arguments

r

Reduced model

f

Full model

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 358

See Also

AICp,SBCp,pressc

Examples

#### example page 358

cpc(lm(lny~x4,SurgicalUnit),lm(lny~x1+x2+x3+x4,SurgicalUnit))

CrackerPromotion

Description

CrackerPromotion

Usage

data("CrackerPromotion")

Format

A data frame with 15 observations on the following 4 variables.

y

a numeric vector

x

a numeric vector

treatment

a numeric vector

store

a numeric vector

Examples

data(CrackerPromotion)
## maybe str(CrackerPromotion) ; plot(CrackerPromotion) ...

Disk Drive Service

Description

DiskDriveService

Usage

data("DiskDriveService")

Format

A data frame with 45 observations on the following 4 variables.

y

a numeric vector

A

a numeric vector

B

a numeric vector

num

a numeric vector

Examples

data(DiskDriveService)
## maybe str(DiskDriveService) ; plot(DiskDriveService) ...

Filling Machines

Description

Filling Machines dataset

Usage

data("FillingMachines")

Format

A data frame with 120 observations on the following 3 variables.

y

response variable

group

factor variable

row

index corresponding to each response

Examples

data(FillingMachines)
## maybe str(FillingMachines) ; plot(FillingMachines) ...

Grocery Retailer dataset

Description

A large, national grocery retailer tracks productivity and costs of its facilities closely.

Usage

data("GroceryRetailer")

Format

A data frame with 52 observations on the following 4 variables.

y

a numeric vector

x1

a numeric vector

x2

a numeric vector

x3

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .problem 6.9 page 249

Examples

data(GroceryRetailer)
## maybe str(GroceryRetailer) ; plot(GroceryRetailer) ...

GrowthHormone

Description

GrowthHormone

Usage

data("GrowthHormone")

Format

A data frame with 14 observations on the following 4 variables.

y

a numeric vector

A

a numeric vector

B

a numeric vector

num

a numeric vector

Examples

data(GrowthHormone)
## maybe str(GrowthHormone) ; plot(GrowthHormone) ...

Hay Fever Relief

Description

Hay Fever Relief dataset

Usage

data("HayFeverRelief")

Format

A data frame with 36 observations on the following 4 variables.

y

response variable

A

factor A variable

B

factor B variable

row

index corresponding to each response

Examples

data(HayFeverRelief)
## maybe str(HayFeverRelief) ; plot(HayFeverRelief) ...

Helicopter Service

Description

Helicopter Service dataset

Usage

data("HelicopterService")

Format

A data frame with 80 observations on the following 3 variables.

y

a numeric vector

group

a numeric vector

num

a numeric vector

Examples

data(HelicopterService)
## maybe str(HelicopterService) ; plot(HelicopterService) ...

Job Proficiency dataset

Description

A personnel officer in a governmental agency administered four newly developed aptitude tests to each of 25 applicants for entry-level clerical positions in the agency

Usage

data("JobProficiency")

Format

A data frame with 25 observations on the following 5 variables.

y

a numeric vector

x1

a numeric vector

x2

a numeric vector

x3

a numeric vector

x4

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .problem 9.10 page 377

Examples

data(JobProficiency)
## maybe str(JobProficiency) ; plot(JobProficiency) ...

Job Proficiency Additional dataset

Description

25 additional applicants for entry-level clerical positions in the ,agency were similarly tested and hired irrespcctive of their test scores.

Usage

data("JobProficiencyAdditional")

Format

A data frame with 25 observations on the following 5 variables.

y

a numeric vector

x1

a numeric vector

x2

a numeric vector

x3

a numeric vector

x4

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .problem 9.22 page 380

Examples

data(JobProficiencyAdditional)
## maybe str(JobProficiencyAdditional) ; plot(JobProficiencyAdditional) ...

Kenton Food Company

Description

Kenton Food Company dataset

Usage

data("KentonFoodCompany")

Format

A data frame with 19 observations on the following 3 variables.

y

response variable

group

factor variable

row

index corresponding to each response

Examples

data(KentonFoodCompany)
## maybe str(KentonFoodCompany) ; plot(KentonFoodCompany) ...

MLS

Description

MLS

Usage

MLS(MSE1, df1, c1, MSE2, df2, c2, alpha = 0.05)

Arguments

MSE1

mean square of the first source of variation (with df1 degrees of freedom)

df1

df1

c1

c1

MSE2

mse2

df2

df2

c2

c2

alpha

a

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. chapter 25.

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (MSE1, df1, c1, MSE2, df2, c2, alpha = 0.05)
{
    f1 = qf(1 - alpha/2, df1, Inf)
    f2 = qf(1 - alpha/2, df2, Inf)
    f3 = qf(1 - alpha/2, Inf, df1)
    f4 = qf(1 - alpha/2, Inf, df2)
    f5 = qf(1 - alpha/2, df1, df2)
    f6 = qf(1 - alpha/2, df2, df1)
    g1 <- 1 - 1/f1
    g2 <- 1 - 1/f2
    g3 <- (((f5 - 1)^2) - ((g1 * f5)^2) - ((f4 - 1)^2))/f5
    g4 <- f6 * ((((f6 - 1)/f6)^2) - 1 * (((f3 - 1)/f6)^2) - g2^2)
    hl <- sqrt(((g1 * c1 * MSE1)^2) + (((f4 - 1) * c2 * MSE2)^2) -
        1 * ((g3 * c1 * c2 * MSE1 * MSE2)))
    hu <- sqrt((((f3 - 1) * c1 * MSE1)^2) + ((g2 * c2 * MSE2)^2) -
        1 * ((g4 * c1 * c2 * MSE1 * MSE2)))
    l = c1 * MSE1 + c2 * MSE2
    L = sum(l)
    lower <- L - hl
    upper <- L + hu
    return(cbind(estimate = L, lower = lower, upper = upper))
  }

Criteria for Model Selection

Description

SSEp, R2.p, R2.adj.p, Cp, AICp, SBCp and PRESSP Values for All Possible Regression Modes

Usage

model.s(x,y)

Arguments

x

matrix of predictors

y

response vector

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .chapter 9

Examples

### table 9.2, page 353
library("leaps")
model.s(SurgicalUnit[,1:4],SurgicalUnit[,10])

Model Validation

Description

Compare (estimation, SE estimation, PRESSp, AICp, SBSp, R2 , R2.adj, MSE) Training and validition data

Usage

modelval(building.set,response.building, prediction.set, response.prediction)

Arguments

building.set

matrix predictor Training data

response.building

vector response Training data

prediction.set

matrix predictor Validation data

response.prediction

vector response Validation data

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .chapter 9

Examples

#### page 373 (table)
b<-SurgicalUnit
p<-SurgicalUnitAdditional

modelval(b[,c(1,2,3,8)],b[,10],p[,c(1,2,3,8)],p[,10])
modelval(b[,c(1,2,3,5,6,8)],b[,10],p[,c(1,2,3,5,6,8)],p[,10])

normal correation test

Description

normal correation test

Usage

normal.cor.test(residuals, MSE)

Arguments

residuals

residual

MSE

MSE

References

neter

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (residuals, MSE)
{
    w <- 1:length(residuals)
    r <- cor(sort(residuals), sqrt(MSE) * (qnorm((w - 0.375)/(length(residuals) +
        0.25))))
    return(r)
  }

one random effect model

Description

onerandom effect model.

Usage

onerandom(y, treatment, alpha)

Arguments

y

y

treatment

tr

alpha

a

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. chapter 25.

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (y, treatment, alpha)
{
    treatment <- factor(treatment)
    aov = Anova(lm(y ~ treatment), type = 2)
    mse2 <- aov[, 1]/aov[, 2]
    mse <- mse2[2]
    mstr <- mse2[1]
    r <- aov[1, 2] + 1
    n <- (aov[2, 2] + r)/r
    s <- sqrt(mstr/(r * n))
    lower <- mean(y) - qt(1 - alpha/2, r - 1) * s
    upper <- mean(y) + qt(1 - alpha/2, r - 1) * s
    out.mu <- cbind(estimate = mean(y), lower = lower, upper = upper)
    l = ((mstr/mse) * (1/qf(1 - alpha/2, r - 1, r * (n - 1))) -
        1)/n
    u = ((mstr/mse) * (1/qf(alpha/2, r - 1, r * (n - 1))) - 1)/n
    lower <- l/(l + 1)
    upper <- u/(1 + u)
    out.prop.sigma2.mu <- cbind(lower = lower, upper = upper)
    lower <- (r * (n - 1) * mse)/(qchisq(1 - alpha/2, r * (n -
        1)))
    upper <- (r * (n - 1) * mse)/(qchisq(alpha/2, r * (n - 1)))
    out.sigma2 <- cbind(lower = lower, upper = upper)
    out1 <- satterthwaite(c = c(1/n, -1/n), MSE = c(mstr, mse),
        df = c(r - 1, r * (n - 1)), alpha = alpha)
    out2 <- MLS(MSE1 = mstr, df1 = r - 1, c1 = 1/n, MSE2 = mse,
        df2 = r * (n - 1), c2 = -1/n, alpha = alpha)
    o <- list(anova = aov, mu = out.mu, prop.sigma2.mu = out.prop.sigma2.mu,
        sigma2 = out.sigma2, sigma2.mu.satterthwaite = out1,
        sigma2.mu.MLS = out2)
    return(o)
  }

Single-Factor ANOVA

Description

Fitting of ANOVA Model

Analysis of Variance (test & table)

Test and confidence interval for Single Factor level Mean

inferences for Difference between Two Factor level Means

Contrast of Factor level Means

test and confidence interval for linear Combination of Factor level Means

Analysis of Means (CI for treatment effects)

*** Tests for Constancy of Error Variance: ***

Hartley Test

Brown-Forsythe Test

*** Simultaneos Inference Procedures: ***

Tukey multiple comparison procedure

Scheffe multiple comparison procedure

Bonferroni multiple comparison procedure

*** Nonparametric ***

Nonparametric Rank F Test and multiple Pairwise Testing Procedure

***A variety of residuals in the output: ***

residuals

semistudentized residuals

studentized residuals

studentized deleted residuals

*** PLOT ***

boxplot by factors

Line Plot of Estimated Factor Level Mean

Bar Graph and Main Effects Plot

bar graph and the main etfects plot of factor level means is to display the confidence limits

*** PLOT for residuals: ***

against fitted value

Aligned Residual Dot Plot

Normal Q-Q plot

histogram

boxplot

Usage

oneway(y, group, alpha=0.05,MSE=NULL, c.value=0, mc=NULL, residual,omission.variable=NULL)

Arguments

y

vector, response variable

group

vector INTEGER, group variable

alpha

Confidence interval calculate with 1-alpha percent

MSE

mean squre of error

c.value

c value for single factor test. H_0: mu_i=c

mc

Matrix contrast(s), Each row was included in a contrast

residual

Type of residuals. simple (default), semistudentized, studentized or studentized.deleted

omission.variable

numeric vector. Omission of Important Explanatory Variables. Residual analysis may also be used to study whether or not the single-factor ANOVA model is an adequate model.

Value

test & CI

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. chapter 16, 17 and 18

Examples

library('ALSM')
library('SuppDists')

with(KentonFoodCompany,oneway(y,group,mc=matrix(c(.5,.5,-.5,-.5),1,4)))

plasma level of a polyamine

Description

Data on age (X) and plasma level of a polyamine (Y) for a portion of the 25 healthy children in a study

Usage

data("Plasma")

Format

A data frame with 25 observations on the following 3 variables.

x

a numeric vector

y

a numeric vector

log.y

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .TABLE 3.8 page 133

Examples

data(Plasma)
## maybe str(Plasma) ; plot(Plasma) ...

plot Criterias for Model Selection

Description

plot R2.p, R2.adj.p, Cp, AICp, SBCp and PRESSP Values for All Possible Regression Modes

Usage

plotmodel.s(x,y)

Arguments

x

matrix of predictors

y

response vector

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .chapter 9

Examples

### figure 9.4, page 356
plotmodel.s(SurgicalUnit[,1:4],SurgicalUnit[,10])

Portrait Studio dataset

Description

Dwaine Studios, Inc., operates portrait studios in 21 cities of medium size. These studios specialize in p0l1raits of children

Usage

data("PortraitStudio")

Format

A data frame with 21 observations on the following 3 variables.

x1

a numeric vector

x2

a numeric vector

y

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 237

Examples

data(PortraitStudio)
## maybe str(PortraitStudio) ; plot(PortraitStudio) ...

Premium Distribution

Description

Premium Distribution

Usage

data("PremiumDistribution")

Format

A data frame with 100 observations on the following 3 variables.

y

a numeric vector

group

a numeric vector

num

a numeric vector

Examples

data(PremiumDistribution)
## maybe str(PremiumDistribution) ; plot(PremiumDistribution) ...

calculate PRESS

Description

prediction sum of squares

Usage

pressc(fit)

Arguments

fit

model of regression

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 360

Examples

######## example page 361
pressc(lm(lny~x2+x3+x4,SurgicalUnit))

Productivity Improvement

Description

Productivity Improvement dataset

Usage

data("ProductivityImprovement")

Format

A data frame with 27 observations on the following 4 variables.

y

response variable

group

factor variable

num

index corresponding to each response

x

covariate

Examples

data(ProductivityImprovement)
## maybe str(ProductivityImprovement) ; plot(ProductivityImprovement) ...

Programmer Requirements

Description

Programmer Requirements dataset

Usage

data("ProgrammerRequirements")

Format

A data frame with 24 observations on the following 4 variables.

y

response variable

A

factor A variable

B

factor B variable

row

index corresponding to each response

Examples

data(ProgrammerRequirements)
## maybe str(ProgrammerRequirements) ; plot(ProgrammerRequirements) ...

Questionnaire Color

Description

Questionnaire Color

Usage

data("QuestionnaireColor")

Format

A data frame with 15 observations on the following 3 variables.

y

a numeric vector

group

a numeric vector

num

a numeric vector

Examples

data(QuestionnaireColor)
## maybe str(QuestionnaireColor) ; plot(QuestionnaireColor) ...

Rehabilitation Therapy

Description

Rehabilitation Therapy

Usage

data("RehabilitationTherapy")

Format

A data frame with 24 observations on the following 3 variables.

y

a numeric vector

group

a numeric vector

num

a numeric vector

Examples

data(RehabilitationTherapy)
## maybe str(RehabilitationTherapy) ; plot(RehabilitationTherapy) ...

Risk Premium

Description

Risk Premium

Usage

data("RiskPremium")

Format

A data frame with 15 observations on the following 3 variables.

y

a numeric vector

block

a numeric vector

factor

a numeric vector

Examples

data(RiskPremium)
## maybe str(RiskPremium) ; plot(RiskPremium) ...

RoadPaintWear

Description

RoadPaintWear

Usage

data("RoadPaintWear")

Format

A data frame with 40 observations on the following 3 variables.

y

a numeric vector

location

a numeric vector

paint

a numeric vector

Examples

data(RoadPaintWear)
## maybe str(RoadPaintWear) ; plot(RoadPaintWear) ...

RustIn hibitor

Description

RustIn hibitor dataset

Usage

data("RustInhibitor")

Format

A data frame with 40 observations on the following 3 variables.

y

response variable

group

factor variable

row

index corresponding to each response

Examples

data(RustInhibitor)
## maybe str(RustInhibitor) ; plot(RustInhibitor) ...

Salable Flowers

Description

Salable Flowers

Usage

data("SalableFlowers")

Format

A data frame with 24 observations on the following 5 variables.

y

a numeric vector

x

a numeric vector

A

a numeric vector

B

a numeric vector

num

a numeric vector

Examples

data(SalableFlowers)
## maybe str(SalableFlowers) ; plot(SalableFlowers) ...

satterthwaite

Description

satterthwaite

Usage

satterthwaite(c, MSE, df, alpha = 0.05)

Arguments

c

c

MSE

mse

df

df

alpha

a

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. chapter 25.

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (c, MSE, df, alpha = 0.05)
{
    l = c * MSE
    L = sum(c * MSE)
    dff <- ((L^2)/sum((l^2)/df))
    lower <- (dff * L)/(qchisq(1 - alpha/2, round(dff)))
    upper <- (dff * L)/(qchisq(alpha/2, round(dff)))
    return(cbind(estimate = L, df = round(dff), lower = lower,
        upper = upper))
  }

Calculate SBC

Description

Schwarz' Bayesian criterion

SBC=n∗ln(SSEp)−n∗ln(n)+ln(n)∗pSBC = n*ln(SSEp)-n*ln(n)+ln(n)*p

Usage

SBCp(model)

Arguments

model

model of regression

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 360

Examples

##################use data Surgical Unit, page 360

SBCp(lm(lny~x4,SurgicalUnit))

Servo Data

Description

Servo Data dataset

Usage

data("ServoData")

Format

A data frame with 15 observations on the following 3 variables.

y

response variable

group

factor variable

row

index corresponding to each response

Examples

data(ServoData)
## maybe str(ServoData) ; plot(ServoData) ...

SolutionCon centration

Description

Solution Concentration

Usage

data("SolutionConcentration")

Format

A data frame with 15 observations on the following 2 variables.

y

a numeric vector

x

a numeric vector

Examples

data(SolutionConcentration)
## maybe str(SolutionConcentration) ; plot(SolutionConcentration) ...

Planning of Sample Sizes with Estimation Approach Single factor ANOVA

Description

This approach is to specify the major comparisons of interest. Determine the expected widths of the confidence intervals for various sample sizes, given standard deviation (sigma).

Usage

ssea.oneway(number.group,mc,sigma,n.weight,ci.width,type=c("s", "b"), alpha = 0.05)

Arguments

number.group

number of treatments.

mc

matrix of contrast. each row determine one contrast.

sigma

Standard deviation.

n.weight

weight of sample size Corresponding to each treatment.

ci.width

width of confidence interval Corresponding to each contrast.

type

type of calculate confidence interval.

alpha

Confidence interval calculate with 1-alpha percent

Value

sample size obtain based on confidence interval.

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. page 759.

Examples

mc=matrix(c(1,-1,0,0,.5,.5,-.5,-.5,1/3,1/3,1/3,-1),byrow=TRUE,nrow = 3)
ssea.oneway(4,mc,sigma=2,n.weight=c(1,1,1,1),ci.width=c(2.61,1.85,2.14)*2,type='s')
#### page 761
mc=matrix( c(1,0,0,-1,0,1,0,-1,0,0,1,-1),byrow=TRUE,nrow = 3)
ssea.oneway(4,mc,2,n.weight=c(1,1,1,2),ci.width=c(1,1,1)*2,type='b',alpha=.1)

#### problem 17.25 page 772
mc=matrix(c(1,-1,0,0,0,0,
            .5,.5,-.5,-.5,0,0,
            0,0,1,-1,0,0,
            .25,.25,.25,.25,-.5,-.5),byrow=TRUE,nrow=4)
ssea.oneway(6,mc,.15,n.weight=rep(1,6),ci.width=rep(2*0.08,4),type='b',alpha=.05)

Surgical Unit dataset

Description

A hospital surgical unit was interested in predicting survival in patients undergoing a particular of type of liver operation.

Usage

data("SurgicalUnit")

Format

A data frame with 54 observations on the following 10 variables.

x1

a numeric vector

x2

a numeric vector

x3

a numeric vector

x4

a numeric vector

x5

a numeric vector

x6

a numeric vector

x7

a numeric vector

x8

a numeric vector

y

a numeric vector

lny

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 350

Examples

data(SurgicalUnit)
## maybe str(SurgicalUnit) ; plot(SurgicalUnit) ...

Surgical Unit Additional dataset

Description

54 additional data for SurgicalUnit dataset.

Usage

data("SurgicalUnitAdditional")

Format

A data frame with 54 observations on the following 10 variables.

x1

a numeric vector

x2

a numeric vector

x3

a numeric vector

x4

a numeric vector

x5

a numeric vector

x6

a numeric vector

x7

a numeric vector

x8

a numeric vector

y

a numeric vector

lny

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .TABLE 9.5 page 374

Examples

data(SurgicalUnitAdditional)
## maybe str(SurgicalUnitAdditional) ; plot(SurgicalUnitAdditional) ...

Task Completion

Description

Task Completion

Usage

data("TaskCompletion")

Format

A data frame with 16 observations on the following 4 variables.

y

a numeric vector

block

a numeric vector

factor

a numeric vector

num

a numeric vector

Examples

data(TaskCompletion)
## maybe str(TaskCompletion) ; plot(TaskCompletion) ...

Telephone Communications

Description

Telephone Communications datas set

Usage

data("TelephoneCommunications")

Format

A data frame with 30 observations on the following 3 variables.

y

a numeric vector

group

a numeric vector

num

a numeric vector

Examples

data(TelephoneCommunications)
## maybe str(TelephoneCommunications) ; plot(TelephoneCommunications) ...

Toluca Company dataset

Description

The Toluca Company manufactures refrigeration equipment as well as many replacement parts. In the past, one of the replacement parts has been produced periodically in lots of varying sizes. When a cost improvement program was undertaken, company officials wished to determine the optimum lot size for producing this part.

Usage

data("TolucaCompany")

Format

A data frame with 25 observations on the following 2 variables.

x

a numeric vector

y

a numeric vector

Source

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition .page 19

Examples

data(TolucaCompany)
## maybe str(TolucaCompany) ; plot(TolucaCompany) ...

Confidence intervals for tow way ANOVA

Description

Confidence intervals for tow way ANOVA.

Estimation and confidense interval of Factor Level Mean.

Estimation and confidense interval of Contrast of Factor Level Means

Estimation and confidense interval of linear Combination of Factor level Means

Multiple Pairwise Comparisons and confidense interval of Factor level Means (Tukey and Bonferroni Procedurs)

Multiple Contrasts and confidense interval of Factor Level Means (scheffe and Bonferroni Procedurs)

Etimates and confidense interval Based on Treatment Means

Interactions Are Important:

Multiple Pairwise Comparisons of Treatment Means(Tukey and Bonferroni Procedure.)

Multiple Contrasts of Treatment Means(Scheffe and Bonferroni Procedure.)

Usage

towway.ci(y, x1, x2, mc = NULL, mp = NULL,mt=NULL, mse= NULL,alpha = 0.05)

Arguments

y

response variabel

x1

first factor

x2

second factor

mc

matrix of contrast(s)

mp

matrix of pairwise. each row is one pairwise

mt

matrix of treatment means. (interaction NOT important)

mse

MSE of model

alpha

Confidence intervals calculate with 1-alpha percent

References

Michael H. Kutner; Christopher J. Nachtsheim; John Neter; William Li. Applied Linear Statistical Models Fifth Edition. chapter 19.

Examples

library('ALSM')
y=HayFeverRelief$y
A=HayFeverRelief$A
B=HayFeverRelief$B

m=matrix(c(1,2,3,0,0,0,.5,-1,.5),byrow = TRUE,nrow = 3)
towway.ci(y,A,B,mc=m)

Winding Speeds

Description

In a completely randomized design to study the effect of the speed of winding thread (1: slow; 2: normal; 3: fast; 4: maximum) onto 75-yard spools, 16 runs of 10,000 spools each were made at each of the four winding speeds. The response variable is the number of thread breaks during, the production run.

Usage

data("WindingSpeeds")

Format

A data frame with 64 observations on the following 3 variables.

y

response variable

group

factor variable

row

index corresponding to each response

Examples

data(WindingSpeeds)
## maybe str(WindingSpeeds) ; plot(WindingSpeeds) ...