--- title: "ounad" output: html_document --- ```{r cars} library(tidyverse) ounad=read_csv("http://www.tlu.ee/~jaagup/andmed/muu/ounad/antoonovka2.txt") ggplot(ounad, aes(august, september))+geom_point() cor(ounad) cor.test(ounad$august, ounad$september) kymmeouna=ounad %>% head(10) cor.test(kymmeouna$august, kymmeouna$september) ggplot(ounad, aes(august, september))+geom_point()+ geom_smooth(method="lm") lm(ounad$september~ounad$august) summary(lm(ounad$september~ounad$august)) lm(september~august, data=ounad) tibble(august=c(4, 5, 6)) predict(lm(september~august, data=ounad), tibble(august=c(2,3,4))) uuritavad=tibble(august=c(2,3,4)) mudel=lm(september~august, data=ounad) uuritavad$september=predict(mudel, uuritavad) uuritavad ggplot(ounad, aes(august, september))+geom_point(color="gray")+ geom_point(data=uuritavad, color="red") ounad2=read_csv("http://www.tlu.ee/~jaagup/andmed/muu/ounad/liivi_antoonovka_aug_sept_1000.txt") ggplot(ounad2, aes(august, september, color=ounasort))+geom_point() lm(september~august+ounasort, data=ounad2) predict(lm(september~august+ounasort, data=ounad2), tibble(august=c(4, 4, 5, 5), ounasort=c("Antoonovka", "Liivi sibul", "Antoonovka", "Liivi sibul"))) ```