Investors have to assume certain risks when buying into small market cap stocks. For instance, these stocks typically have low share counts and low trading volume, thus there tends to be more volatility in the share price. 

These sorts of things are generally known upfront, so investors can swallow the volatility -- hopefully! -- and keep their eyes fixated on the long-term story. 

And so it goes with iRobot Corporation (IRBT -0.73%). Due to this volatility, it can be hard to know if you're getting a good bargain when you buy the stock. And we all want a foolishly good bargain!

Pay attention to valuation, not price
That's why investors should try and focus on the stock's valuation. This is especially important because the stock's price moves so rapidly, both to the upside and the downside, that it can make shares either really undervalued or really overvalued. 

Before we go any further, let's take a look at the stock's trailing-12-month, price-to-earnings ratio, which is in orange, as well as the forward price-to-earnings ratio based on analysts' estimates, which is in blue:

IRBT PE Ratio (Forward 1y) Chart

IRBT P/E Ratio data by YCharts

Here is the same chart, but with the share price of iRobot added in red: 

IRBT PE Ratio (Forward 1y) Chart

IRBT P/E Ratio data by YCharts

All of the chart lines can get a bit confusing. But it hopefully highlights what a volatile stock iRobot can be. And while price action should not be a focal point for long-term investors, volatility is something to consider, since it can be so disruptive to your Foolish psyche. 

Fundamentals, fundamentals, fundamentals
It really all boils down to fundamentals. Yes, the company has extremely impressive technology. It continues to grow its home robot division impressively on year-over-year measures (30% for fiscal 2013), while making inroads into the health care and corporate landscapes. 

But in the end, it's all about value. If shares trade at 1,000 times earnings, the company will likely never deliver satisfying results to investors. So when you're putting your hard-earned money into a stock, you want to pay a reasonable valuation for it. iRobot is no different. 

By taking the forward 12-month estimates for both earnings and revenue, analysts expect growth of 47% and 18%, respectively, from the previous 12 months of business activity. 

The stock's forward 12-month P/E ratio measures in at 29 times. Although that doesn't appear to be the most attractive measure, it's semi-reasonable when you consider how fast earnings and revenues are expected to grow. 

Based on next year's earnings (2015) -- which is the forward P/E measurement used in the charts above -- the stock trades at just 25 times earnings. This too seems reasonable, as analysts expect earnings to grow 28% in 2015. As you can see in the chart, this valuation has represented a level near which investors are comfortable buying.

On a trailing P/E ratio basis, investors appear to be comfortable buying near 35 times last year's earnings. Both of these metrics date back through the previous 18 months, indicating that these so called "buy levels" have at least a little bit of validity. 

What about selling or avoiding the stock?
Remember when we highlighted the stock's volatility a little earlier? Well that actually plays a vital role in its valuation, too. 

You see, when shares of iRobot trade up too high, then its valuation also becomes too high. So high that it makes no sense for investors to still be long, or as long, the stock. For instance, when the stock shot above $45 per share a few months ago, nothing had fundamentally changed with the company. 

Sales were not higher, guidance did not increase, and analysts hadn't hiked their estimates. When estimates don't move higher, the valuation suddenly becomes extremely expensive. Allow me to explain.

At $35 per share, the stock trades at 25 times 2015 earnings, which is semi-reasonable given its growth projections. When the stock is $46 per share, the stock trades at 35 times 2015 earnings, which is not a reasonable valuation given its growth projection.

In other words, the 40% increase in forward valuation is not warranted, since management and analysts do not expect the company to make more money than it did just a few weeks or months ago. It is because of this that the stock becomes overvalued and too expensive, warranting a significant fall in its share price.

The Foolish valuation 
So next time you're trying to value shares of iRobot, but can't decide what price to pay, take a few minutes and chart the trailing and forward P/E ratios. Or calculate them yourself and ask: Is this company really worth X times its 12-month earnings estimates or is iRobot really worth X times 2015 estimates? 

If the answer is no, then have no fear. The stock will eventually come down to a reasonable valuation. Or the company's earnings will catch up with the stock price. But either way, don't overpay for this great company.