{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Matlab Section4

# Matlab Section4 - not use the parenthesis around...

This preview shows page 1. Sign up to view the full content.

Hendrik Wolff February 9, 2006 Matlab appendix to Section 4: Use of Indicator Functions and Plotting (a) In Section we discussed the use of indicators in MATLAB to conveniently arrange and manipulate data. A further more complicated, but useful use of indicators is outlined next. Feel free to use that in HW4: In HW4, question 1, it is asked to replace all durations equal to 0 with 1. The durations are stored as the first column in the datamatrix “data”) data(:,1)=data(:,1).*(data(:,1)>0)+(data(:,1)==0); % adding one for zero durations To test if you understand the use of the indicator function. What would happen if you did
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: not use the parenthesis around data(:,1)==0? (b) Some MATLAB commands to plot functions: 'plot log likelihood function' lambda=(-10:0.1:-4)'; % x-axis lllambda=0*lambda; % y-axis for i=1:length(lambda); lllambda(i,1)=loglik(lambda(i,1),dur,censor); % function loglik returns the likelihood value at lambda(i,1) end, plot(lambda,lllambda,'-') % Alternatively use . , - , *, and see what happens… % to customize the output you can use the following commands: axis([-10 -4 -40000 0]) xlabel('lambda') ylabel('log likelihood function') title('Figure 1: Log Likelihood Function')...
View Full Document

• Spring '06
• IMBENS
• Maximum likelihood, Likelihood function, Indicator function, log likelihood function, Likelihood principle, Hendrik Wolff

{[ snackBarMessage ]}

Ask a homework question - tutors are online