SlideShare a Scribd company logo

Q1Ansdata - read.table(httpfisher.stat.wmich.edujoeSta.pdf

A
ajitdoll

The document discusses fitting linear regression models to data with multiple predictors. It loads data, separates the response and predictor matrices, defines a function to calculate R-squared and sigmahat for all 2-variable models and ranks them by R-squared, and applies this function. The top 3 models are examined, with the best having the lowest sigmahat and highest R-squared, while the worst has the highest sigmahat and lowest R-squared. However, as the best model only has an R-squared of 0.479, there may be better fitting models involving more variables.

1 of 3
Download to read offline
Q1:
Ans:
data <- read.table("http://fisher.stat.wmich.edu/joe/Stat2600/GA/xmaty.text",sep="
",header=TRUE)
attach(data)
head(data)
y <- data[,7]
xmat <- data[,1:6]
> head(data)
x1 x2 x3 x4 x5 x6 y
1 38.7 13.5 70.2 62.6 60.8 58.6 -12.7
2 69.0 75.2 48.7 43.2 68.6 64.7 -36.4
3 55.1 76.5 51.5 67.5 58.5 87.9 -53.9
4 77.3 84.7 48.5 79.5 74.2 93.9 -56.5
5 62.4 27.3 112.8 63.0 55.9 73.9 -83.8
6 49.5 47.8 42.9 79.4 53.0 83.7 -20.2
Q2:
Ans:
lmbest2 <- function(y,xmat){
# This returns R-squared and sigmahat for all linear
# models of size 2 (2 x's). The results are sorted on R-squared.
p <- length(xmat[1,])
coll <- c()
for(i in 1:(p-1)){
for(j in (i+1):p){
fit <- lm(y ~ xmat[,i] + xmat[,j])
sfit <- summary(fit)
tmp <- c(i,j,sfit$sigma,sfit$r.squared)
coll <- rbind(coll,tmp)
}
}
ind <- order(coll[,4],decreasing=TRUE)
collf <- coll[ind,]
colnames(collf) <- c("i","j","sigmahat","R-squared")
ic <- length(collf[,1])
rownames(collf) <- rep("Model",ic)
return(collf)
}
Q3:
Ans:
lmbest2(y,xmat)
Top 3 models are:
For better model we need lower sigmahat and higher R-squared. Model 1 has lowest sigmahat
and highest R-squared followed by Model 2 then model 3.
Hence among these three Model 1 is the best fit and Model 3 is the worst fit and model 2 is in
between the other two models.
From the value of R-squared = 0.479 we can say that there are other models which are better fit
because for good fits R-squared should be close to 1. Hence I would like to choose another
models with more variables involved.
Solution
Q1:
Ans:
data <- read.table("http://fisher.stat.wmich.edu/joe/Stat2600/GA/xmaty.text",sep="
",header=TRUE)
attach(data)
head(data)
y <- data[,7]
xmat <- data[,1:6]
> head(data)
x1 x2 x3 x4 x5 x6 y
1 38.7 13.5 70.2 62.6 60.8 58.6 -12.7
2 69.0 75.2 48.7 43.2 68.6 64.7 -36.4
3 55.1 76.5 51.5 67.5 58.5 87.9 -53.9
4 77.3 84.7 48.5 79.5 74.2 93.9 -56.5
5 62.4 27.3 112.8 63.0 55.9 73.9 -83.8
6 49.5 47.8 42.9 79.4 53.0 83.7 -20.2
Q2:
Ans:
lmbest2 <- function(y,xmat){
# This returns R-squared and sigmahat for all linear
# models of size 2 (2 x's). The results are sorted on R-squared.
p <- length(xmat[1,])
coll <- c()
for(i in 1:(p-1)){
for(j in (i+1):p){
fit <- lm(y ~ xmat[,i] + xmat[,j])
sfit <- summary(fit)
tmp <- c(i,j,sfit$sigma,sfit$r.squared)
coll <- rbind(coll,tmp)
}
}
ind <- order(coll[,4],decreasing=TRUE)
collf <- coll[ind,]
colnames(collf) <- c("i","j","sigmahat","R-squared")
ic <- length(collf[,1])
rownames(collf) <- rep("Model",ic)
return(collf)
}
Q3:
Ans:
lmbest2(y,xmat)
Top 3 models are:
For better model we need lower sigmahat and higher R-squared. Model 1 has lowest sigmahat
and highest R-squared followed by Model 2 then model 3.
Hence among these three Model 1 is the best fit and Model 3 is the worst fit and model 2 is in
between the other two models.
From the value of R-squared = 0.479 we can say that there are other models which are better fit
because for good fits R-squared should be close to 1. Hence I would like to choose another
models with more variables involved.

Recommended

Current Score – 0 Due Wednesday, November 19 2014 0400 .docx
Current Score  –  0 Due  Wednesday, November 19 2014 0400 .docxCurrent Score  –  0 Due  Wednesday, November 19 2014 0400 .docx
Current Score – 0 Due Wednesday, November 19 2014 0400 .docxfaithxdunce63732
 
ridgeandlasso - Jupyter Notebook.pdf
ridgeandlasso - Jupyter Notebook.pdfridgeandlasso - Jupyter Notebook.pdf
ridgeandlasso - Jupyter Notebook.pdfPiyushBorhade1
 
Julia: The language for future
Julia: The language for futureJulia: The language for future
Julia: The language for future岳華 杜
 
The Language for future-julia
The Language for future-juliaThe Language for future-julia
The Language for future-julia岳華 杜
 
Apache Commons Math @ FOSDEM 2013
Apache Commons Math @ FOSDEM 2013Apache Commons Math @ FOSDEM 2013
Apache Commons Math @ FOSDEM 2013netomi
 
ARitificial Intelligence - Project - Data Classification
ARitificial Intelligence - Project - Data ClassificationARitificial Intelligence - Project - Data Classification
ARitificial Intelligence - Project - Data Classificationmayank0318
 
july release (1)lt prep satchel paige atl
july release (1)lt prep satchel paige atljuly release (1)lt prep satchel paige atl
july release (1)lt prep satchel paige atlKarl Brooks
 

More Related Content

Similar to Q1Ansdata - read.table(httpfisher.stat.wmich.edujoeSta.pdf

Tycs ds logistic regression
Tycs ds logistic regressionTycs ds logistic regression
Tycs ds logistic regressionRohitSutar13
 
Provide a numeric example of how this regression equation ma.pdf
Provide a numeric example of how this regression equation ma.pdfProvide a numeric example of how this regression equation ma.pdf
Provide a numeric example of how this regression equation ma.pdfaddtechglobalmarketi
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.pptEdFeranil
 
20190907 Julia the language for future
20190907 Julia the language for future20190907 Julia the language for future
20190907 Julia the language for future岳華 杜
 
(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014
(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014
(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014Amazon Web Services
 
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...Jhonatan Minchán
 
Solucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economiaSolucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economiaLuis Perez Anampa
 
Sol mat haeussler_by_priale
Sol mat haeussler_by_prialeSol mat haeussler_by_priale
Sol mat haeussler_by_prialeJeff Chasi
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manualMahrukh Khalid
 
Learning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleLearning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleYvonne K. Matos
 
Kaggle digits analysis_final_fc
Kaggle digits analysis_final_fcKaggle digits analysis_final_fc
Kaggle digits analysis_final_fcZachary Combs
 
Machine Learning Model for M.S admissions
Machine Learning Model for M.S admissionsMachine Learning Model for M.S admissions
Machine Learning Model for M.S admissionsOmkar Rane
 
Perlで任意精度計算
Perlで任意精度計算Perlで任意精度計算
Perlで任意精度計算lestrrat
 
M11 bagging loo cv
M11 bagging loo cvM11 bagging loo cv
M11 bagging loo cvRaman Kannan
 
1136d2d7a30d0424187c48238befee18_angola-local-content_en2
1136d2d7a30d0424187c48238befee18_angola-local-content_en21136d2d7a30d0424187c48238befee18_angola-local-content_en2
1136d2d7a30d0424187c48238befee18_angola-local-content_en2Sophie Tricaud
 
Algebra and Trigonometry 9th Edition Larson Solutions Manual
Algebra and Trigonometry 9th Edition Larson Solutions ManualAlgebra and Trigonometry 9th Edition Larson Solutions Manual
Algebra and Trigonometry 9th Edition Larson Solutions Manualkejeqadaqo
 
Incremental statistics for partitioned tables in 11g by wwf from ebay COC
Incremental statistics for partitioned tables in 11g  by wwf from ebay COCIncremental statistics for partitioned tables in 11g  by wwf from ebay COC
Incremental statistics for partitioned tables in 11g by wwf from ebay COCLouis liu
 
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdfKunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdfMutiaraPutri41
 

Similar to Q1Ansdata - read.table(httpfisher.stat.wmich.edujoeSta.pdf (20)

Tycs ds logistic regression
Tycs ds logistic regressionTycs ds logistic regression
Tycs ds logistic regression
 
R and data mining
R and data miningR and data mining
R and data mining
 
Provide a numeric example of how this regression equation ma.pdf
Provide a numeric example of how this regression equation ma.pdfProvide a numeric example of how this regression equation ma.pdf
Provide a numeric example of how this regression equation ma.pdf
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 
20190907 Julia the language for future
20190907 Julia the language for future20190907 Julia the language for future
20190907 Julia the language for future
 
(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014
(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014
(PFC307) Auto Scaling: A Machine Learning Approach | AWS re:Invent 2014
 
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
 
Solucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economiaSolucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economia
 
Sol mat haeussler_by_priale
Sol mat haeussler_by_prialeSol mat haeussler_by_priale
Sol mat haeussler_by_priale
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual
 
Learning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleLearning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and Kaggle
 
Kaggle digits analysis_final_fc
Kaggle digits analysis_final_fcKaggle digits analysis_final_fc
Kaggle digits analysis_final_fc
 
Machine Learning Model for M.S admissions
Machine Learning Model for M.S admissionsMachine Learning Model for M.S admissions
Machine Learning Model for M.S admissions
 
Perlで任意精度計算
Perlで任意精度計算Perlで任意精度計算
Perlで任意精度計算
 
M11 bagging loo cv
M11 bagging loo cvM11 bagging loo cv
M11 bagging loo cv
 
1136d2d7a30d0424187c48238befee18_angola-local-content_en2
1136d2d7a30d0424187c48238befee18_angola-local-content_en21136d2d7a30d0424187c48238befee18_angola-local-content_en2
1136d2d7a30d0424187c48238befee18_angola-local-content_en2
 
Algebra and Trigonometry 9th Edition Larson Solutions Manual
Algebra and Trigonometry 9th Edition Larson Solutions ManualAlgebra and Trigonometry 9th Edition Larson Solutions Manual
Algebra and Trigonometry 9th Edition Larson Solutions Manual
 
Petunjuk stata dan eviews
Petunjuk stata dan eviewsPetunjuk stata dan eviews
Petunjuk stata dan eviews
 
Incremental statistics for partitioned tables in 11g by wwf from ebay COC
Incremental statistics for partitioned tables in 11g  by wwf from ebay COCIncremental statistics for partitioned tables in 11g  by wwf from ebay COC
Incremental statistics for partitioned tables in 11g by wwf from ebay COC
 
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdfKunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
 

More from ajitdoll

1. Genes are made of molecules of DNA which is made of nucleotides t.pdf
1. Genes are made of molecules of DNA which is made of nucleotides t.pdf1. Genes are made of molecules of DNA which is made of nucleotides t.pdf
1. Genes are made of molecules of DNA which is made of nucleotides t.pdfajitdoll
 
Gold star Rice Contribution income statemet .pdf
       Gold star Rice           Contribution income statemet          .pdf       Gold star Rice           Contribution income statemet          .pdf
Gold star Rice Contribution income statemet .pdfajitdoll
 
where is data .pdf
                     where is data                                   .pdf                     where is data                                   .pdf
where is data .pdfajitdoll
 
Substitution Reactions of Benzene and Other Aroma.pdf
                     Substitution Reactions of Benzene and Other Aroma.pdf                     Substitution Reactions of Benzene and Other Aroma.pdf
Substitution Reactions of Benzene and Other Aroma.pdfajitdoll
 
sp2 Solu.pdf
                     sp2                                      Solu.pdf                     sp2                                      Solu.pdf
sp2 Solu.pdfajitdoll
 
no reaction is visible .pdf
                     no reaction is visible                           .pdf                     no reaction is visible                           .pdf
no reaction is visible .pdfajitdoll
 
Leu-Phen-Val-Met .pdf
                     Leu-Phen-Val-Met                                 .pdf                     Leu-Phen-Val-Met                                 .pdf
Leu-Phen-Val-Met .pdfajitdoll
 
Its Br2- and O2- .pdf
                     Its Br2- and O2-                                 .pdf                     Its Br2- and O2-                                 .pdf
Its Br2- and O2- .pdfajitdoll
 
heterolytic elimination .pdf
                     heterolytic elimination                          .pdf                     heterolytic elimination                          .pdf
heterolytic elimination .pdfajitdoll
 
httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf
                     httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf                     httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf
httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdfajitdoll
 
Gxggdggdgeg .pdf
                     Gxggdggdgeg                                      .pdf                     Gxggdggdgeg                                      .pdf
Gxggdggdgeg .pdfajitdoll
 
d. 7 is the answer Solution .pdf
                     d. 7  is the answer Solution                 .pdf                     d. 7  is the answer Solution                 .pdf
d. 7 is the answer Solution .pdfajitdoll
 
When You connect a host to a switch, the host is capable only of hal.pdf
When You connect a host to a switch, the host is capable only of hal.pdfWhen You connect a host to a switch, the host is capable only of hal.pdf
When You connect a host to a switch, the host is capable only of hal.pdfajitdoll
 
cl- Solu.pdf
                     cl-                                      Solu.pdf                     cl-                                      Solu.pdf
cl- Solu.pdfajitdoll
 
The first trigonometric table was compiled by Hipparchus, who is now.pdf
The first trigonometric table was compiled by Hipparchus, who is now.pdfThe first trigonometric table was compiled by Hipparchus, who is now.pdf
The first trigonometric table was compiled by Hipparchus, who is now.pdfajitdoll
 
tahithi problem- x=months y=temperature we have 2 points here.pdf
tahithi problem- x=months y=temperature we have 2 points here.pdftahithi problem- x=months y=temperature we have 2 points here.pdf
tahithi problem- x=months y=temperature we have 2 points here.pdfajitdoll
 
by reversing the order of integration 7y = x y = .pdf
                     by reversing the order of integration 7y = x y = .pdf                     by reversing the order of integration 7y = x y = .pdf
by reversing the order of integration 7y = x y = .pdfajitdoll
 
Answer4).DNA codes for mRNA directs the synthesis of proteins..pdf
Answer4).DNA codes for mRNA directs the synthesis of proteins..pdfAnswer4).DNA codes for mRNA directs the synthesis of proteins..pdf
Answer4).DNA codes for mRNA directs the synthesis of proteins..pdfajitdoll
 
pseudcode for calculating all the partial sums of a list on 2^n numb.pdf
pseudcode for calculating all the partial sums of a list on 2^n numb.pdfpseudcode for calculating all the partial sums of a list on 2^n numb.pdf
pseudcode for calculating all the partial sums of a list on 2^n numb.pdfajitdoll
 
Pressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdf
Pressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdfPressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdf
Pressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdfajitdoll
 

More from ajitdoll (20)

1. Genes are made of molecules of DNA which is made of nucleotides t.pdf
1. Genes are made of molecules of DNA which is made of nucleotides t.pdf1. Genes are made of molecules of DNA which is made of nucleotides t.pdf
1. Genes are made of molecules of DNA which is made of nucleotides t.pdf
 
Gold star Rice Contribution income statemet .pdf
       Gold star Rice           Contribution income statemet          .pdf       Gold star Rice           Contribution income statemet          .pdf
Gold star Rice Contribution income statemet .pdf
 
where is data .pdf
                     where is data                                   .pdf                     where is data                                   .pdf
where is data .pdf
 
Substitution Reactions of Benzene and Other Aroma.pdf
                     Substitution Reactions of Benzene and Other Aroma.pdf                     Substitution Reactions of Benzene and Other Aroma.pdf
Substitution Reactions of Benzene and Other Aroma.pdf
 
sp2 Solu.pdf
                     sp2                                      Solu.pdf                     sp2                                      Solu.pdf
sp2 Solu.pdf
 
no reaction is visible .pdf
                     no reaction is visible                           .pdf                     no reaction is visible                           .pdf
no reaction is visible .pdf
 
Leu-Phen-Val-Met .pdf
                     Leu-Phen-Val-Met                                 .pdf                     Leu-Phen-Val-Met                                 .pdf
Leu-Phen-Val-Met .pdf
 
Its Br2- and O2- .pdf
                     Its Br2- and O2-                                 .pdf                     Its Br2- and O2-                                 .pdf
Its Br2- and O2- .pdf
 
heterolytic elimination .pdf
                     heterolytic elimination                          .pdf                     heterolytic elimination                          .pdf
heterolytic elimination .pdf
 
httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf
                     httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf                     httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf
httpchemwiki.ucdavis.eduPhysical_ChemistryQu.pdf
 
Gxggdggdgeg .pdf
                     Gxggdggdgeg                                      .pdf                     Gxggdggdgeg                                      .pdf
Gxggdggdgeg .pdf
 
d. 7 is the answer Solution .pdf
                     d. 7  is the answer Solution                 .pdf                     d. 7  is the answer Solution                 .pdf
d. 7 is the answer Solution .pdf
 
When You connect a host to a switch, the host is capable only of hal.pdf
When You connect a host to a switch, the host is capable only of hal.pdfWhen You connect a host to a switch, the host is capable only of hal.pdf
When You connect a host to a switch, the host is capable only of hal.pdf
 
cl- Solu.pdf
                     cl-                                      Solu.pdf                     cl-                                      Solu.pdf
cl- Solu.pdf
 
The first trigonometric table was compiled by Hipparchus, who is now.pdf
The first trigonometric table was compiled by Hipparchus, who is now.pdfThe first trigonometric table was compiled by Hipparchus, who is now.pdf
The first trigonometric table was compiled by Hipparchus, who is now.pdf
 
tahithi problem- x=months y=temperature we have 2 points here.pdf
tahithi problem- x=months y=temperature we have 2 points here.pdftahithi problem- x=months y=temperature we have 2 points here.pdf
tahithi problem- x=months y=temperature we have 2 points here.pdf
 
by reversing the order of integration 7y = x y = .pdf
                     by reversing the order of integration 7y = x y = .pdf                     by reversing the order of integration 7y = x y = .pdf
by reversing the order of integration 7y = x y = .pdf
 
Answer4).DNA codes for mRNA directs the synthesis of proteins..pdf
Answer4).DNA codes for mRNA directs the synthesis of proteins..pdfAnswer4).DNA codes for mRNA directs the synthesis of proteins..pdf
Answer4).DNA codes for mRNA directs the synthesis of proteins..pdf
 
pseudcode for calculating all the partial sums of a list on 2^n numb.pdf
pseudcode for calculating all the partial sums of a list on 2^n numb.pdfpseudcode for calculating all the partial sums of a list on 2^n numb.pdf
pseudcode for calculating all the partial sums of a list on 2^n numb.pdf
 
Pressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdf
Pressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdfPressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdf
Pressure of the ozone gas = 2.28 torrTemperature, T = 250 KVolum.pdf
 

Recently uploaded

Mycology Update February 2024 Microbes with Morgan
Mycology Update February 2024 Microbes with MorganMycology Update February 2024 Microbes with Morgan
Mycology Update February 2024 Microbes with MorganMargie Morgan
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxdeputymitchell2
 
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfSSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfMohonDas
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...EduSkills OECD
 
MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...
MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...
MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...SABC News
 
Can Brain Science Actually Help Make Your Training & Teaching "Stick"?
Can Brain Science Actually Help Make Your Training & Teaching "Stick"?Can Brain Science Actually Help Make Your Training & Teaching "Stick"?
Can Brain Science Actually Help Make Your Training & Teaching "Stick"?Aggregage
 
Organic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional GroupsOrganic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional GroupsDr.M.Geethavani
 
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...Katherine Villaluna
 
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.Florence Dayana
 
Persuasive Speaking and Organizational Patterns
Persuasive Speaking and Organizational PatternsPersuasive Speaking and Organizational Patterns
Persuasive Speaking and Organizational PatternsCorinne Weisgerber
 
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...liera silvan
 
Understanding Canada's international higher education landscape (2024)
Understanding Canada's international higher education landscape (2024)Understanding Canada's international higher education landscape (2024)
Understanding Canada's international higher education landscape (2024)CaraSkikne1
 
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptxBIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptxRAVEESHAD
 
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...AKSHAYMAGAR17
 
ADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS method.pptx
ADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS  method.pptxADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS  method.pptx
ADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS method.pptxAKSHAYMAGAR17
 
Unit 5th topic Drugs used in congestive Heart failure and shock.pdf
Unit 5th topic Drugs used in congestive Heart failure and shock.pdfUnit 5th topic Drugs used in congestive Heart failure and shock.pdf
Unit 5th topic Drugs used in congestive Heart failure and shock.pdfSUMIT TIWARI
 
Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Sue Beckingham
 
2024-02-24_Session 1 - PMLE_UPDATED.pptx
2024-02-24_Session 1 - PMLE_UPDATED.pptx2024-02-24_Session 1 - PMLE_UPDATED.pptx
2024-02-24_Session 1 - PMLE_UPDATED.pptxgdgsurrey
 
Dr.M.Florence Dayana-Cloud Computing-Unit - 1.pdf
Dr.M.Florence Dayana-Cloud Computing-Unit - 1.pdfDr.M.Florence Dayana-Cloud Computing-Unit - 1.pdf
Dr.M.Florence Dayana-Cloud Computing-Unit - 1.pdfDr.Florence Dayana
 

Recently uploaded (20)

Mycology Update February 2024 Microbes with Morgan
Mycology Update February 2024 Microbes with MorganMycology Update February 2024 Microbes with Morgan
Mycology Update February 2024 Microbes with Morgan
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfSSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
 
MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...
MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...
MEC MAJUBA SADDENED BY THE PASSING AWAY OF THREE TEACHERS FOLLOWING A CAR ACC...
 
Can Brain Science Actually Help Make Your Training & Teaching "Stick"?
Can Brain Science Actually Help Make Your Training & Teaching "Stick"?Can Brain Science Actually Help Make Your Training & Teaching "Stick"?
Can Brain Science Actually Help Make Your Training & Teaching "Stick"?
 
Organic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional GroupsOrganic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional Groups
 
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
 
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
 
Persuasive Speaking and Organizational Patterns
Persuasive Speaking and Organizational PatternsPersuasive Speaking and Organizational Patterns
Persuasive Speaking and Organizational Patterns
 
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
 
Understanding Canada's international higher education landscape (2024)
Understanding Canada's international higher education landscape (2024)Understanding Canada's international higher education landscape (2024)
Understanding Canada's international higher education landscape (2024)
 
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptxBIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx
 
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
 
ADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS method.pptx
ADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS  method.pptxADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS  method.pptx
ADAPTABILITY, Types of Adaptability AND STABILITY ANALYSIS method.pptx
 
Unit 5th topic Drugs used in congestive Heart failure and shock.pdf
Unit 5th topic Drugs used in congestive Heart failure and shock.pdfUnit 5th topic Drugs used in congestive Heart failure and shock.pdf
Unit 5th topic Drugs used in congestive Heart failure and shock.pdf
 
Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...
 
2024-02-24_Session 1 - PMLE_UPDATED.pptx
2024-02-24_Session 1 - PMLE_UPDATED.pptx2024-02-24_Session 1 - PMLE_UPDATED.pptx
2024-02-24_Session 1 - PMLE_UPDATED.pptx
 
Dr.M.Florence Dayana-Cloud Computing-Unit - 1.pdf
Dr.M.Florence Dayana-Cloud Computing-Unit - 1.pdfDr.M.Florence Dayana-Cloud Computing-Unit - 1.pdf
Dr.M.Florence Dayana-Cloud Computing-Unit - 1.pdf
 

Q1Ansdata - read.table(httpfisher.stat.wmich.edujoeSta.pdf

  • 1. Q1: Ans: data <- read.table("http://fisher.stat.wmich.edu/joe/Stat2600/GA/xmaty.text",sep=" ",header=TRUE) attach(data) head(data) y <- data[,7] xmat <- data[,1:6] > head(data) x1 x2 x3 x4 x5 x6 y 1 38.7 13.5 70.2 62.6 60.8 58.6 -12.7 2 69.0 75.2 48.7 43.2 68.6 64.7 -36.4 3 55.1 76.5 51.5 67.5 58.5 87.9 -53.9 4 77.3 84.7 48.5 79.5 74.2 93.9 -56.5 5 62.4 27.3 112.8 63.0 55.9 73.9 -83.8 6 49.5 47.8 42.9 79.4 53.0 83.7 -20.2 Q2: Ans: lmbest2 <- function(y,xmat){ # This returns R-squared and sigmahat for all linear # models of size 2 (2 x's). The results are sorted on R-squared. p <- length(xmat[1,]) coll <- c() for(i in 1:(p-1)){ for(j in (i+1):p){ fit <- lm(y ~ xmat[,i] + xmat[,j]) sfit <- summary(fit) tmp <- c(i,j,sfit$sigma,sfit$r.squared) coll <- rbind(coll,tmp) } } ind <- order(coll[,4],decreasing=TRUE) collf <- coll[ind,] colnames(collf) <- c("i","j","sigmahat","R-squared") ic <- length(collf[,1])
  • 2. rownames(collf) <- rep("Model",ic) return(collf) } Q3: Ans: lmbest2(y,xmat) Top 3 models are: For better model we need lower sigmahat and higher R-squared. Model 1 has lowest sigmahat and highest R-squared followed by Model 2 then model 3. Hence among these three Model 1 is the best fit and Model 3 is the worst fit and model 2 is in between the other two models. From the value of R-squared = 0.479 we can say that there are other models which are better fit because for good fits R-squared should be close to 1. Hence I would like to choose another models with more variables involved. Solution Q1: Ans: data <- read.table("http://fisher.stat.wmich.edu/joe/Stat2600/GA/xmaty.text",sep=" ",header=TRUE) attach(data) head(data) y <- data[,7] xmat <- data[,1:6] > head(data) x1 x2 x3 x4 x5 x6 y 1 38.7 13.5 70.2 62.6 60.8 58.6 -12.7 2 69.0 75.2 48.7 43.2 68.6 64.7 -36.4 3 55.1 76.5 51.5 67.5 58.5 87.9 -53.9 4 77.3 84.7 48.5 79.5 74.2 93.9 -56.5 5 62.4 27.3 112.8 63.0 55.9 73.9 -83.8 6 49.5 47.8 42.9 79.4 53.0 83.7 -20.2 Q2: Ans: lmbest2 <- function(y,xmat){
  • 3. # This returns R-squared and sigmahat for all linear # models of size 2 (2 x's). The results are sorted on R-squared. p <- length(xmat[1,]) coll <- c() for(i in 1:(p-1)){ for(j in (i+1):p){ fit <- lm(y ~ xmat[,i] + xmat[,j]) sfit <- summary(fit) tmp <- c(i,j,sfit$sigma,sfit$r.squared) coll <- rbind(coll,tmp) } } ind <- order(coll[,4],decreasing=TRUE) collf <- coll[ind,] colnames(collf) <- c("i","j","sigmahat","R-squared") ic <- length(collf[,1]) rownames(collf) <- rep("Model",ic) return(collf) } Q3: Ans: lmbest2(y,xmat) Top 3 models are: For better model we need lower sigmahat and higher R-squared. Model 1 has lowest sigmahat and highest R-squared followed by Model 2 then model 3. Hence among these three Model 1 is the best fit and Model 3 is the worst fit and model 2 is in between the other two models. From the value of R-squared = 0.479 we can say that there are other models which are better fit because for good fits R-squared should be close to 1. Hence I would like to choose another models with more variables involved.