# monitoria 11 dia 29 de maio #capitulo 3 #exercicio C2------------------------------------------ install.packages('wooldridge') library(wooldridge) data("hprice1") names(hprice1) #i results <- summary(lm(price~sqrft+bdrms, hprice1)) results #ii #aumento de 15.19 milhares de dolares #para cada quarto a mais #iii coefs = results$coefficients coefs[2,1]*140+coefs[3,1] #aumento de 33.18 milhares de dolares #iv #R2 é 0.63 #v coefs[1,1] + coefs[2,1]*2438+coefs[3,1]*4 #354.8 milhares de dolares #vi aux_hprice <- hprice1[1,] class(aux_hprice) coefs[1,1] + coefs[2,1]*aux_hprice[1,5]+coefs[3,1]*aux_hprice[1,3] #C4------------------------------------------ # data('attend') names(attend) #i attach(attend) summary(atndrte) summary(priGPA) summary(ACT) #ii model1 <- summary(lm(atndrte~priGPA+ACT)) model1 #se priGPA e ACT é zero entao atndrte é 75.7 #iii #o aumento de ACT faz com que o aluno vá menos #às aulas #iv 75.700 + 17.261 * 3.65 -1.717*20 #tem um aluno, linha 569 #v (75.700 + 17.261 * 3.1 -1.717*21) - (75.700 + 17.261 * 2.1 -1.717*26) attend[priGPA==3.65 & ACT==20,] #C7 ------------------------------------------ #i data("meap93") names(meap93) attach(meap93) summary(lm(math10~lexpend+lnchprg)) #o coeficiente para lnchprg é inesperado #ii #não faz sentido colocar expenditure = 1 #(gastar só um dolar por crianca) #iii summary(lm(math10~lexpend)) #o coeficiente é maior #iv cor(lexpend,lnchprg) cov(lexpend,lnchprg) #FIM ------------------------------------------