A ronin is a samurai.
Samurai was a status in Japan. A ronin was simply someone of samurai status that had no clan affiliation.
A samurai without a lord was called a Ronin
Ronin are samurai without a master
When a Samurai has no master, they are referred to as Ronin I believe.
The difference between a shogun and a samurai is like the difference between a king and a knight.
Ronin who were master-less Samurai .
they are the positions in which a samurai serves his daimyo
The samurai were responsible only to their master who in turn were part of a chain of alliances ranging up to the emperor. Samurai had no lateral responsibility and if told to attacker kill an equal would do so without hesitation. Ronin (masterless samurai) were pretty much on their own. Challenges were e met, failure to accept challenges was not an option for samurai or ronin.
You may may be thinking of 'Ronin', who were Samurai without a master to serve.
A masterless Samurai is called a 'Ronin' (literally: drifting person).
Samurai's social role is to protect and serve his master, in other words they are considered as a warrior caste or a fighter for his master, similar to Knight. Samurai who does not serve or have a master named as Ronin.
Rurouni Kenshin or Samurai Champloo
Emperor, Shogun, Daimyo, Samurai*, Peasants, Artisan, and Merchants. *There are also Ronin, which are Samurai without a Daimyo (because he/she was killed, committed seppuku, etc.).