State funerals are for Governors General and former Governors General, Prime Ministers, former Prime Ministers, and the current sitting ministry.
The Prime Minister does have the discretion if it is somebody who was very notable or exceptional. For example, in the case of Mr. Layton, he would not have been offered a state funeral necessarily. The Prime Minister felt it was an important gesture because of the role he played and so he offered to have the funeral. The Prime Minister does have that discretion to recognize citizens who have had a tremendous impact on the country.