Title: | Easy Polynomial Regression |
---|---|
Description: | Performs analysis of polynomial regression in simple designs with quantitative treatments. |
Authors: | Emmanuel Arnhold |
Maintainer: | Emmanuel Arnhold <[email protected]> |
License: | GPL-2 |
Version: | 3.0 |
Built: | 2024-12-17 06:53:48 UTC |
Source: | CRAN |
Performs analysis of polynomial regression in simple designs with quantitative treatments.
Package: | epr |
Type: | Package |
Version: | 3.0 |
Date: | 2017-11-14 |
License: | GPL-2 |
Emmanuel Arnhold <[email protected]>
KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.
SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.
# analysis in completely randomized design data(data1) r1=pr2(data1) names(r1) r1 r1[1] pr1(data1) # analysis in randomized block design data(data2) r2=pr2(data2, design=2) r2 # analysis in latin square design data(data3) r3=pr2(data3, design=3) r3 # analysis in several latin squares data(data4) r4=pr2(data4, design=4) r4
# analysis in completely randomized design data(data1) r1=pr2(data1) names(r1) r1 r1[1] pr1(data1) # analysis in randomized block design data(data2) r2=pr2(data2, design=2) r2 # analysis in latin square design data(data3) r3=pr2(data3, design=3) r3 # analysis in several latin squares data(data4) r4=pr2(data4, design=4) r4
The function performs analysis of broken line regression.
bl(data, xlab="Explanatory Variable", ylab="Response Variable", position=1)
bl(data, xlab="Explanatory Variable", ylab="Response Variable", position=1)
data |
data is a data.frame The first column should contain the treatments (explanatory variable) and the second column the response variable |
xlab |
name of explanatory variable |
ylab |
name of response variable |
position |
position of equation in the graph top=1 bottomright=2 bottom=3 bottomleft=4 left=5 topleft=6 (default) topright=7 right=8 center=9 |
Returns coefficients of the models, t test for coefficients, R squared, adjusted R squared, AIC and BIC, normality test and residuals.
Emmanuel Arnhold <[email protected]>
lm, ea1(easyanova package), pr2, regplot
x=c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08,0.09,0.10) y=c(5.5,4,3.2,2.1,1,0.1,1.6,2.2,3,5) y=y/100 data=data.frame(x,y) ### bl(data)
x=c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08,0.09,0.10) y=c(5.5,4,3.2,2.1,1,0.1,1.6,2.2,3,5) y=y/100 data=data.frame(x,y) ### bl(data)
Quantitative treatments in completely randomized design.
data(data1)
data(data1)
A data frame with 24 observations on the following 2 variables.
treatment
a numeric vector
gain
a numeric vector
SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.
data(data1) summary(data1)
data(data1) summary(data1)
Quantitative treatments in randomizad block design.
data(data2)
data(data2)
A data frame with 25 observations on the following 3 variables.
protein_level
a numeric vector
litter
a factor with levels l1
l2
l3
l4
l5
feed_conversion
a numeric vector
KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.
data(data2) summary(data2)
data(data2) summary(data2)
Quantitative treatments in latin square design.
data(data3)
data(data3)
A data frame with 25 observations on the following 4 variables.
treatment
a numeric vector
animal
a factor with levels a1
a2
a3
a4
a5
period
a factor with levels p1
p2
p3
p4
p5
milk_fat
a numeric vector
data(data3) summary(data3)
data(data3) summary(data3)
Quantitative treatments in several latin squares design.
data(data4)
data(data4)
A data frame with 50 observations on the following 5 variables.
treatment
a numeric vector
square
a numeric vector
animal
a factor with levels a1
a2
a3
a4
a5
period
a factor with levels p1
p2
p3
p4
p5
milk_fat
a numeric vector
data(data4) summary(data4)
data(data4) summary(data4)
Quantitative treatments and three response variable.
data(data5)
data(data5)
A data frame with 24 observations on the following 4 variables.
treatments
a numeric vector
variable1
a numeric vector
variable2
a numeric vector
variable3
a numeric vector
data(data5) summary(data5)
data(data5) summary(data5)
The function performs analysis of polynomial regression in simple designs with quantitative treatments. The function also performs with randon factor in mixed models.
pr1(data, mixed = FALSE, digits = 6)
pr1(data, mixed = FALSE, digits = 6)
data |
data is a data.frame The first column should contain the treatments (explanatory variable) and the remaining columns the response variables (fixed model). The first column should contain the treatments (explanatory variable), second colunm should contais de random variable and the remaining columns the response variables (mixed model). |
mixed |
FALSE = fixed model TRUE = mixed model |
digits |
6 = defalt (number of digits) |
Returns coefficients of the models, t test for coefficients, R squared, adjusted R squared, AIC, BIC and the maximum (or minimum) values of y and critical point of x, residuals and normality test.
Emmanuel Arnhold <[email protected]>
lm, ea1(easyanova package), pr2, regplot
# data data(data5) # linear and quadratic models results1=pr1(data5) results1 # analysis in completely randomized design data(data1) r1=pr2(data1) names(r1) r1 r1[1] pr1(data1) # analysis in randomized block design data(data2) r2=pr2(data2, design=2) r2 pr1(data2, mixed=TRUE)
# data data(data5) # linear and quadratic models results1=pr1(data5) results1 # analysis in completely randomized design data(data1) r1=pr2(data1) names(r1) r1 r1[1] pr1(data1) # analysis in randomized block design data(data2) r2=pr2(data2, design=2) r2 pr1(data2, mixed=TRUE)
The function performs analysis of polynomial regression in simple designs with quantitative treatments. This function performs analysis the lack of fit .
pr2(data, design = 1, list = FALSE, type = 2)
pr2(data, design = 1, list = FALSE, type = 2)
data |
data is a data.frame data frame with two columns, treatments and response (completely randomized design) data frame with three columns, treatments, blocks and response (randomized block design) data frame with four columns, treatments, rows, cols and response (latin square design) data frame with five columns, treatments, square, rows, cols and response (several latin squares) |
design |
1 = completely randomized design 2 = randomized block design 3 = latin square design 4 = several latin squares |
list |
FALSE = a single response variable TRUE = multivariable response |
type |
type is form of obtain sum of squares 1 = a sequential sum of squares 2 = a partial sum of squares |
The response and the treatments must be numeric. Other variables can be numeric or factors.
Returns analysis of variance, models, t test for coefficients and R squared and adjusted R squared.
Emmanuel Arnhold <[email protected]>
KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.
SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.
lm, lme(package nlme), ea1(package easyanova), pr1, regplot
# analysis in completely randomized design data(data1) r1=pr2(data1) names(r1) r1 r1[1] # analysis in randomized block design data(data2) r2=pr2(data2, design=2) r2 # analysis in latin square design data(data3) r3=pr2(data3, design=3) r3 # analysis in several latin squares data(data4) r4=pr2(data4, design=4) r4 # data treatments=rep(c(0.5,1,1.5,2,2.5,3), c(3,3,3,3,3,3)) r1=rnorm(18,60,3) r2=r1*1:18 r3=r1*18:1 r4=r1*c(c(1:10),10,10,10,10,10,10,10,10) data6=data.frame(treatments,r1,r2,r3, r4) # use the argument list = TRUE pr2(data6, design=1, list=TRUE)
# analysis in completely randomized design data(data1) r1=pr2(data1) names(r1) r1 r1[1] # analysis in randomized block design data(data2) r2=pr2(data2, design=2) r2 # analysis in latin square design data(data3) r3=pr2(data3, design=3) r3 # analysis in several latin squares data(data4) r4=pr2(data4, design=4) r4 # data treatments=rep(c(0.5,1,1.5,2,2.5,3), c(3,3,3,3,3,3)) r1=rnorm(18,60,3) r2=r1*1:18 r3=r1*18:1 r4=r1*c(c(1:10),10,10,10,10,10,10,10,10) data6=data.frame(treatments,r1,r2,r3, r4) # use the argument list = TRUE pr2(data6, design=1, list=TRUE)
The function performs tests of parameters and models.
r.test(data, digits=6)
r.test(data, digits=6)
data |
data is a data.frame The first column should contain the x (explanatory variable) second treatments and the remaining columns the response variables. |
digits |
number of digits (defalt = 6) |
Returns coefficients of the models, t test for coefficients and tests for parameters and models.
Emmanuel Arnhold <[email protected]>
lm, ea1(easyanova package), pr2, regplot
x=c(1,1,1,2,2,2,3,3,3,4,4,4) y=c(5,5.3,6,8,8.9,12,14,18,25,25,29,32) t=c("a1","a2","a3","a1","a2","a3","a1","a2","a3","a1","a2","a3") data=data.frame(x,t,y) r.test(data)
x=c(1,1,1,2,2,2,3,3,3,4,4,4) y=c(5,5.3,6,8,8.9,12,14,18,25,25,29,32) t=c("a1","a2","a3","a1","a2","a3","a1","a2","a3","a1","a2","a3") data=data.frame(x,t,y) r.test(data)
The function generates the scatter plot with the regression equation.
regplot(data, xlab="Explanatory Variable", ylab="Response Variable", position=6, mean=TRUE, digits=4)
regplot(data, xlab="Explanatory Variable", ylab="Response Variable", position=6, mean=TRUE, digits=4)
data |
data is a data.frame the first column contain the explanatory variable the others columns contain the responses variables |
xlab |
name of variable x |
ylab |
name of variable y |
position |
position of equation in the graph top=1 bottomright=2 bottom=3 bottomleft=4 left=5 topleft=6 (default) topright=7 right=8 center=9 |
mean |
TRUE = scatter plots with averages (default) FALSE = scatter plots with all data |
digits |
number of digits |
The function generates the scatter plot with the regression equation.
Emmanuel Arnhold <[email protected]>
lm, lme, ea1(easyanova package), pr2, pr2, dplot(ds package)
# data data(data5) d1=data5[,c(1,2)] regplot(d1, position=8) d2=data5[,c(1,3)] regplot(d2, position=8) d3=data5[,c(1,4)] regplot(d3, position=8)
# data data(data5) d1=data5[,c(1,2)] regplot(d1, position=8) d2=data5[,c(1,3)] regplot(d2, position=8) d3=data5[,c(1,4)] regplot(d3, position=8)