title: How can I implement Unobserved components model in R?
body: <p>I need to check if the day of the week or month of the year has effect on stock returns. I decided to use unobserved components model with "rucm" package in R because it can extract seasonal characteristics from time series. In my case, I want to determine if there exists daily and monthly seasonality. My dataset is just a time series of daily stock returns:</p>
  
  <pre><code>structure(list(Date = structure(c(1388966400, 1389139200, 1389225600, 
  1389312000, 1389571200, 1389657600, 1389744000, 1389830400, 1389916800, 
  1390176000, 1390262400, 1390348800, 1390435200), class = c("POSIXct", 
  "POSIXt"), tzone = "UTC"), LogReturn = c(-0.009, 0.016, 0.021, 
  0.036, 0.049, 0.092, 0.023, -0.05, 0.044, -0.018, 0.001, -0.021, 
  -0.022)), .Names = c("Date", "LogReturn"), row.names = c(NA, 
  -13L), class = c("tbl_df", "tbl", "data.frame"))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VN40w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VN40w.png" alt="enter image description here"></a> This is what it looks like</p>
  
  <p>The code I used:</p>
  
  <pre><code>install.packages(rucm)
  library(rucm)
  model1&lt;-ucm(formula=LogReturn~0,data=data, level=TRUE,slope=FALSE,season=TRUE,season.length=30)
  </code></pre>
  
  <p>I put season.length =30 randomly. I thought that if I have daily data and seasonality is daily, season.length should be 1, but it doesnt accept 1.</p>
  
  <p>And my output looks like this</p>
  
  <p>Estimated variance:
  "Irregular_Variance"      "Level_Variance"    "Season_Variance" </p>
  
  <p>As you can see I didnt get much information on how day of the week or month of the year affects stock returns. Could you please help me with this problem?</p>
  
  <p>Update1. I added some features to my dataset. Now it shows what day of the week is on each date and added proxy variables for each day of the week.</p>
  
  <pre><code>structure(list(Date = structure(c(1388966400, 1389139200, 1389225600, 
  1389312000, 1389571200, 1389657600, 1389744000, 1389830400, 1389916800, 
  1390176000, 1390262400, 1390348800, 1390435200), class = c("POSIXct", 
  "POSIXt"), tzone = "UTC"), LogReturn = c(-0.009, 0.016, 0.021, 
  0.036, 0.049, 0.092, 0.023, -0.05, 0.044, -0.018, 0.001, -0.021, 
  -0.022), Dayoftheweek = c("Monday", "Wednesday", "Thursday", 
  "Friday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", 
  "Monday", "Tuesday", "Wednesday", "Thursday"), proxymonday = c(1, 
  0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0), proxytuesday = c(0, 0, 0, 
  0, 0, 1, 0, 0, 0, 0, 1, 0, 0), proxywednesday = c(0, 1, 0, 0, 
  0, 0, 1, 0, 0, 0, 0, 1, 0), proxythursday = c(0, 0, 1, 0, 0, 
  0, 0, 1, 0, 0, 0, 0, 1), proxyfriday = c(0, 0, 0, 1, 0, 0, 0, 
  0, 1, 0, 0, 0, 0)), .Names = c("Date", "LogReturn", "Dayoftheweek", 
  "proxymonday", "proxytuesday", "proxywednesday", "proxythursday", 
  "proxyfriday"), row.names = c(NA, -13L), class = c("tbl_df", 
  "tbl", "data.frame"))
  </code></pre>
  
  <p>It looks like this<a href="https://i.stack.imgur.com/bMMSl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bMMSl.png" alt="enter image description here"></a></p>