logo

Statistical Computing - Assignment

   

Added on  2021-04-17

8 Pages1349 Words93 Views
UNIVERSITY AFFILIATIONFACULTY OR DEPARTMENTSTAT878: STATISTICAL COMPUTINGTITLE:ASSIGNMENT ISTUDENT NAME:STUDENT REGISTRATION NUMBER:PROFESSOR (TUTOR)DATE OF SUBMISSION

1QUESTION 1: MLE WITH NEWTON-RAPHSON (21 marks)Part A: Statistical Model%% STATS878: STATISTICAL COMPUTING% Student name% Student Registration number%% question 1% load the sample data% the import only picks the numerical data on temperature, rainfall, and% ... cancellation respectively.trainInfo=xlsread('TrainCancellation.xlsx');disp(trainInfo)temp=trainInfo(:,1)rainfall=trainInfo(:,2)cancellation=trainInfo(:,3)weather=[temp rainfall];days=1:1:365;figure(1)plot(days, temp,'r',days,rainfall,'b')title('Weather patterns in March 2017- Feb 2018')xlabel('days')ylabel('Weather Patterns')legend('Temperature','Rainfall');%% Defining the model, variables, parameters, probabilistic relationship% defining a nominal response variable using a categorical arraytc=categorical(cancellation);%% fitting the multinominal regression model to predict the species ... the weather information; mnrfit treats NaNs at missing values and ... ignores them [B,dev,stats]=mnrfit(weather,tc,'model','hierarchical'); disp(B) % nominal model for the response category relative risks stats.p % checking the statistical significance of the model ... coefficient. stats.se % Requests the standard error of coefficient estimates%% calculating the 95% confidence limits for the coefficientsLL=stats.beta-1.96*stats.se;UL=stats.beta+1.96*stats.se;[LL(:,1) UL(:,1)]figure(2)

2plot(days,cancellation)[R,M,B]=regression(temp,cancellation)figure (3)plotregression(temp,cancellation)[s,c,r,d]=regr(temp,cancellation,1,2)The solution is,050100150200250300350400days010203040506070WeatherPatternsWeather patterns in March 2017- Feb 2018TemperatureRainfall

End of preview

Want to access all the pages? Upload your documents or become a member.