Академический Документы
Профессиональный Документы
Культура Документы
May 4, 2017
Motivation Model Overview Data R/Shiny application Conclusion
Introduction
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Motivation
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Motivation
Motivation 1/3
Motivation
Motivation 2/3
Sacramento Bee 2017.04.28:
Motivation
Motivation 3/3
Motivation Model Overview Data R/Shiny application Conclusion
De-motivation
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
De-motivation
De-motivation
Re-motivation
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Re-motivation
The resurrection...
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Model Overview
Appraisal HomeValuatorTM
Based on 20+ years of
Based on 1-3 months sales
sales, rent, and other
data
data.
Value adjusted by deviation Value derived from market
from cross-sectional rent, a number that includes
averages home characteristics
HomeValuatorTM
Takes advantage of home price - apartment rent relationship.
Takes advantage of the information content in market rent
numbers.
Produces an emotionless cap-rate based valuation estimate.
Rent Costs
V =
Cap Rate
Motivation Model Overview Data R/Shiny application Conclusion
Price
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Price
Price data
Price
###########################
# Read i n C a l i f o r n i a d a t a #
###########################
x < r e a d . c s v ( " i n / P r i c e C A 2 0 1 6 1 1 3 0 . c s v " , h e a d e r=TRUE, f i l l =
, TRUE, s t r i n g s A s F a c t o r s = FALSE )
x < m e l t ( x , i d . v a r s=c ( yyyymm ) , v a r i a b l e _ n a m e = c o u n t y )
x $ s t a t e < "CA"
x$Date < a s . yearmon ( a s . c h a r a c t e r ( x$yyyymm ) , %Y%m )
# Drop u n u s e d v a r i a b l e s
m y v a r s < c ( " Date " , " s t a t e " , " c o u n t y " , " M e d i a n P r i c e " )
x < na . o m i t ( x [ , m y v a r s ] )
Motivation Model Overview Data R/Shiny application Conclusion
Price
Rent data
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Rent data
Rent data
Note the odd formating of fmrxx_y where xx= two-digit year and
y=number of bedrooms.
Motivation Model Overview Data R/Shiny application Conclusion
Rent data
# Read i n F e d e r a l I n f o r m a t i o n P r o c e s s i n g S t a n d a r d s t o o b t a i n
# s t a t e c d <> s t a t e two l e t t e r a b b r e v i a t i o n t a b l e
f i p s < r e a d . c s v ( " i n / f i p s . c s v " , h e a d e r=TRUE, f i l l =TRUE,
, s t r i n g s A s F a c t o r s = FALSE )
f i p s < f i p s [ , c ( 2 , 3 ) ] # a l l I c a r e a b o u t i s t h e s t a t e and
, s t a t e c d
# Add s t a t e name t o r e n t d a t a
r e n t < merge ( r e n t , f i p s , by = s t a t e c d )
Rent data
# E x t r a c t County name
r e n t $ c o u n t y < s t r _ r e p l a c e ( r e n t $ c n t y n a m e , " County " , " " )
r e n t $ c n t y n a m e < NULL # no l o n g e r n e e d e d
# C r e a t e l i s t o f v a r i a b l e s t h a t c o n t a i n fmr
f m r v a r s < g r e p ( fmr , c o l n a m e s ( r e n t ) , v a l u e=TRUE)
# R e t a i n o n l y v a r i a b l e s t h a t c o n t a i n _
f m r v a r s < g r e p ( _ , f m r v a r s , v a l u e=TRUE)
# Drop v a r i a b l e s t h a t c o n t a i n a r e a
f m r v a r s < f m r v a r s [ 1 : ( g r e p ( a r e a , f m r v a r s ) 1) ]
r e n t < r e n t [ , c ( " s t a t e " , " c o u n t y " , f m r v a r s ) ]
# Sort data
r e n t < r e n t [ o r d e r ( r e n t $ s t a t e , r e n t $ c o u n t y ) , ]
Motivation Model Overview Data R/Shiny application Conclusion
Rent data
# C o n v e r t year_bed from f a c t o r t o c h a r a c t e r
r e n t $ y e a r _ b e d < a s . c h a r a c t e r ( r e n t $ y e a r _ b e d )
# C r e a t e bedroom v a r i a b l e
r e n t $ b e d r o o m s < p a s t e ( " Rent " , s u b s t r ( r e n t $ y e a r _ b e d , 7 , 7 ) ,
, s e p ="")
# Drop o b s e r v a t i o n s w i t h m i s s i n g d a t a
r e n t < na . o m i t ( r e n t )
Motivation Model Overview Data R/Shiny application Conclusion
Rent data
Other data
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Other data
Other data
Shiny overview
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Shiny overview
Shiny overview
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
# Obtain i n i t i a l l i s t of c o u n t i e s #
d e f a u l t S t a t e < "CA"
d e f a u l t C o u n t y < " S a c r a m e n t o "
C o u n t i e s < u n i q u e ( s u b s e t ( r e n t , s t a t e==d e f a u l t S t a t e ) [ , "
, c o u n t y " ] )
# P r i c e and r e n t s o u r c e d a t a s t r i n g s a r e NOT f a c t o r s
# R a t h e r , t h e y a r e c o u n t y names .
o p t i o n s ( s t r i n g s A s F a c t o r s=FALSE )
# S i d e b a r w i t h a s l i d e r i n p u t f o r number o f b i n s
s i d e b a r L a y o u t ( p o s i t i o n =" r i g h t " ,
sidebarPanel (
inputPanel (
s e l e c t I n p u t ( " S t a t e " , l a b e l =" S t a t e : " ,
c h o i c e s=S t a t e s ,
s e l e c t e d=d e f a u l t S t a t e ) ,
s e l e c t I n p u t ( " County " , l a b e l ="County : " ,
c h o i c e s=C o u n t i e s ,
s e l e c t e d=d e f a u l t C o u n t y ) ,
server.R - Computations
# Define global r e a c t i v e v a r i a b l e s
v a l u e s < r e a c t i v e V a l u e s ( )
v < r e a c t i v e V a l u e s ( )
v $ C o u n t i e s < C o u n t i e s
v a l u e s $ P 2 R a v g < 0
# Formatting function
EMfmt < f u n c t i o n ( x ) f o r m a t ( r o u n d ( x , 0 ) , s c i e n t i f i c =FALSE ,
, b i g . mark =" ,")
s h i n y S e r v e r ( f u n c t i o n ( input , output , s e s s i o n ) {
o u t p u t $ d i s t P l o t < r e n d e r P l o t ( {
Application demo
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Application demo
Outline
1 Motivation
Motivation
De-motivation
Re-motivation
2 Model Overview
Brief model overview
3 Data
Price
Rent data
Other data
4 R/Shiny application
Shiny overview
Shiny code snippets
Application demo
5 Conclusion
Conclusion and future enhancements
Motivation Model Overview Data R/Shiny application Conclusion
Conclusion
Future enhancements
Contact information