Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Data Transformation
#R version 3.3.2 data(iris) str(iris) library(MASS) library(ggplot2) attach(iris) head(iris) ##############Linear Model######### ggplot(iris, aes(Sepal.Width, Petal.Width, colour=Species))+geom_point()+geom_smooth(method=lm)+ggtitle("Sample") Mod=lm(Sepal.Width~Petal.Width) par(mfrow=c(2,2)) plot(Mod, main="Mod") #Log.transformation Mod1=lm(log(Sepal.Width)~log(Petal.Width)) plot(Mod1, main="Mod1") C=coef(Mod1) A=C[1] B=C[2] BackTransform=exp(A+B*log(Petal.Width)) head(BackTransform) #Sqrt.Transormation Mod2=lm(sqrt(Sepal.Width)~Petal.Width) plot(Mod2) C1=coef(Mod2) A1=C1[1] B1=C1[2] ######Box-cox######## bc=boxcox(Sepal.Width~Petal.Width, data=iris) Trans=bc$x[which.max(bc$y)] Mod3=lm(Sepal.Width^Trans~Petal.Width) summary(Mod3) plot(Mod3)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Tournois Mount & Blade
Even.r
Paired t-test [Shear Strength of Girder]
taylorsen7
Regression
Análise de Variâncias DIC e teste de Tukey 1
Chapter 4:Comparing Distributions (same scale)
Testing a faked dice
Gamma
Practice
stackse - search stackoverflow differently
Please log in to post a comment.