Statistics treatment for a survey study designed to test the hypothesis: If the means of solar energy generation are more aesthetically pleasing consumers will be more willing to convert to solar energy.

Overall Spearman Rank Correlation is 0.3728067 (p = 3.108624510^{-15} )


Summary of survey data

summary(solarDat)
##   RespondentID        CollectorID            StartDate         EndDate   
##  Min.   :4.851e+09   Min.   :88545356   07/13/2016:323   07/13/2016:323  
##  1st Qu.:4.852e+09   1st Qu.:88545356   07/14/2016: 37   07/14/2016: 37  
##  Median :4.852e+09   Median :88545356   07/15/2016: 18   07/15/2016: 18  
##  Mean   :4.854e+09   Mean   :88545356   07/18/2016: 18   07/18/2016: 18  
##  3rd Qu.:4.853e+09   3rd Qu.:88545356   07/19/2016:  6   07/19/2016:  6  
##  Max.   :4.952e+09   Max.   :88545356   07/17/2016:  4   07/17/2016:  4  
##                                         (Other)   : 18   (Other)   : 18  
##     Consent1   USResident       StateCde     Homeowner1    ResidenceType  
##  Min.   :1   Min.   :1.000   FL     : 52   Min.   :1.000   Min.   :0.000  
##  1st Qu.:1   1st Qu.:1.000   GA     : 52   1st Qu.:1.000   1st Qu.:1.000  
##  Median :1   Median :1.000   CA     : 50   Median :1.000   Median :1.000  
##  Mean   :1   Mean   :1.014          : 48   Mean   :1.189   Mean   :1.007  
##  3rd Qu.:1   3rd Qu.:1.000   NY     : 47   3rd Qu.:1.000   3rd Qu.:1.000  
##  Max.   :1   Max.   :2.000   NJ     : 38   Max.   :2.000   Max.   :2.000  
##                              (Other):137   NA's   :1       NA's   :1      
##             ResidenceText  AesImportant   SolarPowerBetter
##                    :382   Min.   :1.000   Min.   :1.00    
##  Apartment         :  9   1st Qu.:4.000   1st Qu.:3.00    
##  Condo             :  9   Median :4.000   Median :4.00    
##  Condominium       :  3   Mean   :4.071   Mean   :3.83    
##  Townhouse         :  3   3rd Qu.:5.000   3rd Qu.:4.00    
##  Apartment Building:  2   Max.   :5.000   Max.   :5.00    
##  (Other)           : 16   NA's   :3       NA's   :1       
##  WouldConsiderSolar AesInfluencedDecision ConvPanelsPleasing
##  Min.   :1.000      Min.   :1.000         Min.   :1.000     
##  1st Qu.:3.000      1st Qu.:3.000         1st Qu.:2.000     
##  Median :4.000      Median :4.000         Median :2.000     
##  Mean   :3.592      Mean   :3.617         Mean   :2.158     
##  3rd Qu.:4.000      3rd Qu.:4.000         3rd Qu.:3.000     
##  Max.   :5.000      Max.   :5.000         Max.   :5.000     
##  NA's   :2          NA's   :1             NA's   :5         
##  WindowPanelsPleasing RoofTilesPleasing RoadsPleasing     WindowRate   
##  Min.   :1.00         Min.   :1.000     Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.25         1st Qu.:3.000     1st Qu.:4.000   1st Qu.:1.000  
##  Median :4.00         Median :3.000     Median :4.000   Median :2.000  
##  Mean   :3.86         Mean   :3.295     Mean   :3.939   Mean   :1.868  
##  3rd Qu.:4.00         3rd Qu.:4.000     3rd Qu.:4.000   3rd Qu.:2.000  
##  Max.   :5.00         Max.   :5.000     Max.   :5.000   Max.   :4.000  
##  NA's   :2                                                             
##    RoadsRate     RoofTileRate   ConvPanelsRate 
##  Min.   :1.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:1.00   1st Qu.:2.000   1st Qu.:3.000  
##  Median :2.00   Median :3.000   Median :4.000  
##  Mean   :2.12   Mean   :2.515   Mean   :3.461  
##  3rd Qu.:3.00   3rd Qu.:3.000   3rd Qu.:4.000  
##  Max.   :4.00   Max.   :4.000   Max.   :4.000  
##                 NA's   :1       NA's   :1      
##                                                        Comments  
##                                                            :335  
##  Good luck!                                                :  2  
##   The appearance and the price are my concerns.            :  1  
##  .                                                         :  1  
##  all are tough except windows in heavily treed areas       :  1  
##  Already have 34 solar panels on my roof saves $500 a month:  1  
##  (Other)                                                   : 83  
##  ConvPanelsRateFlip RoofTileRateFlip RoadsRateFlip  WindowRateFlip 
##  Min.   :1.000      Min.   :1.000    Min.   :1.00   Min.   :1.000  
##  1st Qu.:1.000      1st Qu.:2.000    1st Qu.:2.00   1st Qu.:3.000  
##  Median :1.000      Median :2.000    Median :3.00   Median :3.000  
##  Mean   :1.539      Mean   :2.485    Mean   :2.88   Mean   :3.132  
##  3rd Qu.:2.000      3rd Qu.:3.000    3rd Qu.:4.00   3rd Qu.:4.000  
##  Max.   :4.000      Max.   :4.000    Max.   :4.00   Max.   :4.000  
##  NA's   :1          NA's   :1

Setup variables

# Convert preference ratings from 1-4 to 4-1 to see positive correlation
solarDat$ConvPanelsRateFlip = abs(solarDat$ConvPanelsRate -5)
solarDat$RoofTileRateFlip = abs(solarDat$RoofTileRate -5)
solarDat$RoadsRateFlip = abs(solarDat$RoadsRate -5)
solarDat$WindowRateFlip = abs(solarDat$WindowRate -5)

# Common label sets
Likert5Labs = c("Strongly Disagree","Disagree","Neutral","Agree","Strongly Agree")
RevRankLabs = c("Rank 4th", "Rank 3rd", "Rank 2nd", "Rank 1st")

# Setup factor labels
Would_Consider_Solar = factor(solarDat$WouldConsiderSolar, labels=Likert5Labs)

Build function to plot results and return spearman correlation and p value

# Func to print scatterplot with jitter and LM and print Spearman Corr and p value
plot_lm_spearman_corr <- function(data, xLikert5, yPrefRank4, ttl, zFactor5=NULL, zLabel=NULL) {
  # get Spearman Rank Correlation and p value
  catXY = c(xLikert5, y=yPrefRank4)
  matXY = matrix(catXY, nrow=length(catXY)/2, ncol=2)
  spCorr = rcorr(matXY, type="spearman")
  # get lm intercept to use on plot
  lmMod = lm(yPrefRank4 ~ xLikert5)  
  # decide if 5 level color Factor included
  if (is.null(zFactor5)) {
    ggp <- ggplot(data, aes(x=xLikert5, y=yPrefRank4))
  } else {
    ggp <- ggplot(data, aes(x=xLikert5, y=yPrefRank4, color=zFactor5)) + 
      geom_smooth(method=lm, se=FALSE, fullrange=FALSE, alpha=.2)
  }
  # build the rest of the plot
  ggp <- ggp+
    geom_point(pch = 16, alpha=.7, position = position_jitter(width = .5, height = .5)) + 
    # geom_smooth(method=lm, se=FALSE, fullrange=FALSE, alpha=.2) + 
    # Instead of linear model, show Spearman correlation line on plot -
    # Since correlation has slope but does not have an intercept, use the intercept from lm
    geom_abline(intercept = lmMod$coefficients[1], slope = spCorr$r[2,1], alpha = .1, size = 5) +
    scale_x_continuous(breaks=c(1:5), labels=Likert5Labs) + 
    scale_y_continuous(breaks=c(1:4), labels=RevRankLabs) +
    scale_color_discrete(name=zLabel, guide = guide_legend(reverse=TRUE)) + 
    ggtitle(ttl) +
    labs(x="Aesthetically Pleasing", y="Preference Rank") + 
    theme(plot.title = element_text(color="#666666", face="bold", size=20, hjust=.5)) +
    theme(axis.title = element_text(color="#666666", face="bold", size=14))
  print(ggp);
  return(spCorr)

Show basic plots and correlations

spCor = plot_lm_spearman_corr(solarDat, solarDat$ConvPanelsPleasing, solarDat$ConvPanelsRateFlip, 
                      "Conventional Solar Panels")

Spearman Rank Correlation is 0.3728067 (p = 3.108624510^{-15} )


spCor = plot_lm_spearman_corr(solarDat, solarDat$RoofTilesPleasing, solarDat$RoofTileRateFlip,
                      "Solar Roof Tiles")

Spearman Rank Correlation is 0.3614585 (p = 1.68753910^{-14} )


spCor = plot_lm_spearman_corr(solarDat, solarDat$RoadsPleasing, solarDat$RoadsRateFlip,
                      "Solar Roadways")

Spearman Rank Correlation is 0.1373006 (p = 0.0046219 )


spCor = plot_lm_spearman_corr(solarDat, solarDat$WindowPanelsPleasing, solarDat$WindowRateFlip,
                      "Solar Window Panels")

Spearman Rank Correlation is 0.2939677 (p = 7.388689710^{-10} )


Add “Would Consider Solar” factor in color

NOTE: The “Would Consider Solar” factor plots show a simple linear regression only to illustrate the relative relationships. The Overall Spearman Rank Correlation noted below each diagram is the statistic that measures the relationship. Further analysis could be done to measure the Spearman Rank Correlation by factor, including “Would Consider Solar” as well as other independent variables in the study.

spCor = plot_lm_spearman_corr(solarDat, solarDat$ConvPanelsPleasing, solarDat$ConvPanelsRateFlip, 
                      "Conventional Solar Panels", Would_Consider_Solar, "Would\nConsider Solar")

Overall Spearman Rank Correlation is 0.3728067 (p = 3.108624510^{-15} )


spCor = plot_lm_spearman_corr(solarDat, solarDat$RoofTilesPleasing, solarDat$RoofTileRateFlip,
                      "Solar Roof Tiles", Would_Consider_Solar, "Would\nConsider Solar")

Overall Spearman Rank Correlation is 0.3614585 (p = 1.68753910^{-14} )


spCor = plot_lm_spearman_corr(solarDat, solarDat$RoadsPleasing, solarDat$RoadsRateFlip,
                      "Solar Roadways", Would_Consider_Solar, "Would\nConsider Solar")

Overall Spearman Rank Correlation is 0.1373006 (p = 0.0046219 )


spCor = plot_lm_spearman_corr(solarDat, solarDat$WindowPanelsPleasing, solarDat$WindowRateFlip,
                      "Solar Window Panels", Would_Consider_Solar, "Would\nConsider Solar")

Overall Spearman Rank Correlation is 0.2939677 (p = 7.388689710^{-10} )