{"cells":[{"metadata":{"_uuid":"051d70d956493feee0c6d64651c6a088724dca2a","_execution_state":"idle","trusted":true},"cell_type":"code","source":"# This R environment comes with many helpful analytics packages installed\n# It is defined by the kaggle/rstats Docker image: https://github.com/kaggle/docker-rstats\n# For example, here's a helpful package to load\n\nlibrary(tidyverse) # metapackage of all tidyverse packages\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\n# list.files(path = \"../input\")\n\n# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Read the inputs ","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train <- read_csv('../input/birdsong-recognition/train.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"test <- read_csv('../input/birdsong-recognition/test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sample_sub <- read_csv('../input/birdsong-recognition/sample_submission.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"options(repr.matrix.max.cols=50, repr.matrix.max.rows=100)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"head(train)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Convert Data Frame To Numeric Matrix","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train2 <- data.matrix(data.frame(unclass(train)))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"library(carData)\nlibrary(MASS)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Fit the model","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"model_fit <- polr(as.factor(ebird_code)~playback_used+species+type ,data = train2, Hess = TRUE)\n# try different independent variables\nsummary(model_fit)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"summary_table <- coef(summary(model_fit))\npval <- pnorm(abs(summary_table[, \"t value\"]),lower.tail = FALSE)* 2\nsummary_table <- cbind(summary_table, \"p value\" = round(pval,3))\nsummary_table","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# That's it folks! I haven't figured out how to make submissions yet! Comment below if you have ideas.","execution_count":null}],"metadata":{"kernelspec":{"name":"ir","display_name":"R","language":"R"},"language_info":{"name":"R","codemirror_mode":"r","pygments_lexer":"r","mimetype":"text/x-r-source","file_extension":".r","version":"3.6.3"}},"nbformat":4,"nbformat_minor":4}