#Final Project, Olsen #Regression modeling print(`Hello, World!`): print(): lprint(`This program contains the linear regression models for the final project in Dr. Z's Experimanetal Mathematics Course, Spring 2019.`): lprint(`To properly use this program, please have the DATA.txt file ready to go. This program assumes the list of data has been named "MR" and is of the particular format distributed to the group through email.`): lprint(`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`): lprint(`To see the three variable regression model considering Number of Publications, Number of Citations, and H-Index, use the command ThreeVarRegression().`): lprint(`To see the four variable regression model considering Number of Publications, Number of Citations, H-Index, and Year of Ph.D., use the command FourVarRegression().`): print(): with(LinearAlgebra): with(Statistics): #ThreeIndependentVars(List) inputs a list of data of the form indicated in DATA.txt and #Outputs a nops(List)x3 matrix, where each row is the data for a specific professor, #The first column is the list of values for Number of Publications, the second #column is the vlaues for number of citations, and the third column is the vlaues for #H-Index ThreeIndependentVars:=proc(List) local i,j,n,IndependentVars: n:=nops(List): IndependentVars:=Matrix(n,3): for i from 1 to n do for j from 1 to 3 do IndependentVars[i]:=: od: od: Matrix(IndependentVars): end: #FourIndependentVars(List) inputs a list of data of the form indicated in DATA.txt and #Outputs a nops(List)x4 matrix, where each row is the data for a specific professor, #The first column is the list of values for Number of Publications, the second #column is the vlaues for number of citations, and the third column is the values for #H-Index, and the fourth column is the year the Ph.D. was recieved FourIndependentVars:=proc(List) local i,j,n,k,IndependentVars: n:=nops(List): IndependentVars:=Matrix(n,4): for i from 1 to n do for j from 1 to 3 do IndependentVars[i,j]:=List[i][j+3]: od: od: for k from 1 to n do IndependentVars[k,4]:=List[k][9]: od: IndependentVars: end: #DependentVars(List) inpust a list of the form indicated in DATA.txt and outputs #A vector containing the all of the values for Base Salary, in order DependentVars:=proc(List) local i,n: n:=nops(List): : end: #These two functions will be used in the following procedures as the models #for our regressions. f[1] will be used for the three variable regression, while #f[2] will be used for the four vsriable regression f[1]:=constant+NumOfPubs*x[1]+NumOfCites*x[2]+HIndex*x[3]: f[2]:=constant+NumOfPubs*x[1]+NumOfCites*x[2]+HIndex*x[3]+PHDYear*x[4]: #ThreeVarRegression() uses the above code to generate a linear regression in the three #variables Number of Publications, Number of Citations, and H-Index ThreeVarRegression:=proc() Fit(f[1],ThreeIndependentVars(MR),DependentVars(MR),[x[1],x[2],x[3]], summarize=embed): end: #FourVarRegression() uses the above code to generate a linear regression in the #four variables Number of Publications, Number of Citations, H-Index, and Year of Ph.D. FourVarRegression:=proc() Fit(f[2],FourIndependentVars(MR),DependentVars(MR),[x[1],x[2],x[3],x[4]],summarize=embed): end: