i have read about RAW sockets that they are UNIX domain sockets and don't generally go over the wire unlike TCP or UDP. They are used for interprocess communication. Also they are used in the implementation of new transport layer protocols and are also used in ICMP(for ping).
unix domain sockets are intentionally present to reduce transport overhead. they allow to exchange data between applications and thus related to application layer in
[tcp/ip model]. There is no need for transport protocol to ensure ordering, reliability or flow control. you do not need network access layer as recipient of a message transfer is a process in the same machine.
Raw sockets and Unix sockets are not the same thing. A raw IP socket gives you direct access to IP packets. It does go over the wire (or at least over the IP layer). All applications (such as ping) that send or receive IP packets that aren't a UDP or TCP connection must use raw sockets.
A Unix domain socket is local to the machine, it is a means of communication between processes running on the same machine.
Neither type of sockets give you access to the physical layer. Unix domain sockets don't have a physical layer, and raw IP sockets carry IP packets. Accessing physical layer requires a different type of socket, neither IP nor Unix. This might be called a “raw” socket sometimes, but the name is rather misleading since this is as different from a raw IP socket as it is different from a Unix socket. Under Linux, Ethernet or other physical layer packets (e.g. for ARP) are accessed through netlink sockets.