The Geo Map Visualization has several built-in geographical units, including country and region names and codes, US state names and codes, and US zip codes. You can also define your own geographic units. This paper describes how to identify any geographic point of interest, or collection of points, on a map to create custom maps in SAS.
Introduced with SAS Visual Analytics 8.2 is a new object named: Key Value. The intent of this object is call attention to an aggregated value for a measure, a category, or both. For additional specifics,
I’ve mocked up several reports to show some of the combinations available to give you an idea of what the Key Value object can look like. Toward the end of the blog, I will add additional reports to provide design ideas for placement and action assignments. Click on any image to enlarge.
Text Style with Measure Value Highlight
Here you can see in the report, I am highlighting two measure values. Both are representing the Highest value but I selected one to show the aggregation and the other not. I was able to mimic similar headings by renaming my data item. Be sure to look at the Options and Roles pane for the assignments to understand how I accomplished this.
Infographic Style with Measure Value Highlight
Here is the same information represented using the Infographic style. Seeing the same report using the different styles allows you to quickly determine the most powerful and appropriate visualization to meet your needs. We cannot control the size of the circle, only the color. In this case, the circles are different thicknesses because of the number of characters used to represent the measure values inside the visual.
Text Style displaying both Measure Value and Category
In this report, I have shown how to use the Text style to display both a Category value and a Measure value. As you can see, only one can be Highlighted, i.e. given the largest font. Notice that in this report I used the object’s Title to help explain the key value being displayed, this is a recommended best practice.
Infographic Style displaying both Measure Value and Category
Below I am using the Infographic style and notice in the Options pane below that I had to use the Additional information attribute to better label the data. Make sure that when you are in the design phase and toggling between text and infographic to review and test the available Key Value Style attributes to better label the visual.
Text Style with Category Value Highlight
In this report, I show how to highlight the Category value using the Text style. Since I chose to not use any of the available label attributes it is critical that I use the object’s Title to better explain the key value displayed.
Infographic Style with Category Value Highlight
In this report, you can see how I changed the layout from the previous report to make the Key Value object side-by-side the other report objects. If you are interested in using the Infographic style with the circle enabled then you may have to adjust your report design to accommodate for the space the circle needs to display. Remember not to shy away from adding white space to your report, it can assist when adding emphasis to a particular visual, in this case a key value.
Some important things to remember about using the Key Value object in your reports:
- Use the Key Value object’s Title to inform your users what the number or category value represents so there is no ambiguity as to if they are looking at the maximum or minimum value.
- When determining which style you prefer, Text or Infographic, it may be easier to make a duplicate of the Page and then adjust the style attributes till you find the desired combination.
- Take time to adjust the arrangement of objects on your report to get the most pleasing configuration. Don’t shy away from leaving white space in your report. You can also experiment with the Container object using the Precision container type to layer the Key Value object.
- The Key Value object will be affected by Report and Page Prompts like any other report object and you can even define Actions to filter the Key Value object.
Here are some additional examples of using the Key Value object:
In this example, you can see from the Actions Diagram how the Key Value object is being filtered. First, by the two page prompts and second, there is a direct filter action defined from the List Control object
In this example, we can see from the Actions Diagram that I used the Container object. I then selected the Precision container type and overlaid the Key Value object on the Line Chart. The only filters applied to these report objects are the page prompts.
And in this last example, you can see how I have no Report or Page prompts or any other filters impacting the Key Value objects. Therefore, these values are representative for the entire data.
As a resident of Northern California, I was interested in learning more about the causes of wildfires. My area has recently experienced large fires that caused many residents to evacuate their homes and some who have even lost their lives. Last October there were more than 170 fires that burned [...]
During these hot summers in the southern US, many people regard Willis Carrier (the man who invented modern air conditioning) as a saint. But along with the comfortable indoor temperatures comes the high electricity bill at the end of the month. And how much does the electricity cost? That's a difficult [...]
The post What's the electricity bill for your air conditioner this summer? appeared first on SAS Learning Post.
We hear a lot about how various industries are using data visualization and analytics. But what about the education industry? The institutional research office (IR) at universities is the center for data, reports and analytics and provides decision makers with information about the university. The IR teams are working on [...]
Our company talks to utilities all over the world about the value of analytics. We help utility executives understand what the "digital utility company" looks like and share use cases to illustrate how these companies are using analytics across: assets and operations; customers; portfolio, and corporate operations (see diagram below). [...]
Analytics use cases for utilities: Assets and operations was published on SAS Voices by David Pope
This article describes how to obtain an initial guess for nonlinear regression models, especially nonlinear mixed models. The technique is to first fit a simpler fixed-effects model by replacing the random effects with their expected values. The parameter estimates for the fixed-effects model are often good initial guesses for the parameters in the full model.
Background: initial guesses for regression parameters
For linear regression models, you don't usually need to provide an initial guess for the parameters. Least squares methods directly solve for the parameter estimates by using the data. For iterative methods, such as logistic regression model, software usually starts with a pre-determined initial guess of the slope parameters and iteratively refine the guess by using an optimization technique. For example, PROC LOGISTIC in SAS begins by guessing that all slopes are zero. The "slopes all zero" model, which is better known as an intercept-only model, is a reduced model that is related to the full logistic model.
Several other regression procedures also fit a related (simpler) model and then use the estimates for the simpler model as an initial guess for the full model. For example, the "M method" in robust regression starts with a least squares solution and then iteratively refines the coefficients until a robust fit is obtained. Similarly, one way to fit a generalized linear mixed models is to first solve a linear mixed model and use those estimates as starting values for the generalized mixed model.
Fit a fixed-effect model to obtain estimates for a mixed model
The previous paragraphs named procedures that do not require the user to provide an initial guess for parameters. However, procedures such as PROC NLIN and PROC NLMIXED in SAS enable you to fit arbitrary nonlinear regression models. The cost for this generality is that the user must provide a good initial guess for the parameters.
This can be a challenge. To help, the NLIN and NLMIXED procedures enable you to specify a grid of initial values, which can be a valuable technique. For some maximum-likelihood estimates (MLE), you can use the method of moments to choose initial parameters. Although it is difficult to choose good initial parameters for a nonlinear mixed model, the following two-step process can be effective:
- Substitute the expected value for every random effect in the model. You obtain a fixed-effect model that is related to the original mixed model, but has fewer parameters. Estimate the parameters for the fixed-effect model. (Most random effects are assumed to be normally distributed with zero mean, so in practice you "drop" the random effects.)
- Use the estimates from the fixed-effect model as an initial guess for the full model. Hopefully, the initial guesses are close enough and the full model will converge quickly.
The following example shows how this two-step process works. The PROC NLMIXED documentation contains an example of data from an experiment that fed two different diets to pregnant rats and observed the survival of pups in the litters. The following SAS statements define the data and show the full nonlinear mixed model in the example:
data rats; input trt $ m x @@; x1 = (trt='c'); x2 = (trt='t'); litter = _n_; datalines; c 13 13 c 12 12 c 9 9 c 9 9 c 8 8 c 8 8 c 13 12 c 12 11 c 10 9 c 10 9 c 9 8 c 13 11 c 5 4 c 7 5 c 10 7 c 10 7 t 12 12 t 11 11 t 10 10 t 9 9 t 11 10 t 10 9 t 10 9 t 9 8 t 9 8 t 5 4 t 9 7 t 7 4 t 10 5 t 6 3 t 10 3 t 7 0 ; title "Full nonlinear mixed model"; proc nlmixed data=rats; parms t1=2 t2=2 s1=1 s2=1; /* <== documentation values. How to guess these??? */ bounds s1 s2 > 0; eta = x1*t1 + x2*t2 + alpha; p = probnorm(eta); model x ~ binomial(m,p); random alpha ~ normal(0,x1*s1*s1+x2*s2*s2) subject=litter; run;
The model converges in about 10 iterations for the initial guesses on the PARMS statement. But if you deviate from those values, you might encounter problems where the model does not converge.
Fit a fixed-effect model to obtain initial estimates for the mixed model
The full mixed model has one random effect that involves two variance parameters, s1 and s2. If you replace the random effect with its expected value (0), you obtain the following two-parameter fixed-effect model:
title "Reduced model: Fixed effects only"; proc nlmixed data=rats; parms t1=2 t2=2; eta = x1*t1 + x2*t2; p = probnorm(eta); model x ~ binomial(m,p); ods output ParameterEstimates = FixedEstimates; run;
Notice that the estimates for t1 and t2 in the two-parameter model are close to the values in the full model. However, the two-parameter model is much easier to work with, and you can use grids and other visualization techniques to guide you in estimating the parameters. Notice that the estimates for t1 and t2 are written to a SAS data set called FixedEstimates. You can read those estimates on the PARMS statement by using a second call to PROC NLMIXED. This second call fits a four-parameter model, but the t1 and t2 parameters are hopefully good guesses so you can focus on finding good guesses for s1 and s2 in the second call.
/* full random-effects model. The starting values for the fixed effects are the estimates from the fixed-effect-only model */ title "Full model: Estimates from a reduced model"; proc nlmixed data=rats; parms s1=0.1 s2=1 / data=FixedEstimates; /* read in initial values for t1, t2 */ bounds s1 s2 > 0; eta = x1*t1 + x2*t2 + alpha; p = probnorm(eta); /* standard normal quantile for eta */ model x ~ binomial(m,p); random alpha ~ normal(0,x1*s1*s1+x2*s2*s2) subject=litter; run;
Combining a grid search and a reduced (fixed-effect) model
You can combine the previous technique with a grid search for the random-effect parameters. You can use PROC TRANSPOSE to convert the FixedEstimates data set from long form (with the variables 'Parameter' and 'Estimate') to wide form (with variables 't1' and 't2'). You can then use a DATA step to add a grid of values for the s1 and s2 parameters that are used to estimate the random effect, as follows:
/* transpose fixed-effect estimates from long form to wide form */ proc transpose data=FixedEstimates(keep=Parameter Estimate) out=PE(drop=_NAME_); id Parameter; var Estimate; run; /* add grid of guesses for the parameters in the random effect */ data AllEstimates; set PE; do s1 = 0.5 to 1.5 by 0.5; /* s1 in [0.5, 1.5] */ do s2 = 0.5 to 2 by 0.5; /* s2 in [0.5, 2.0] */ output; end; end; run; title "Full model: Estimates from a reduced model and from a grid search"; proc nlmixed data=rats; parms / data=AllEstimates; /* use values from reduced model for t1, t2; grid for s1, s2 */ bounds s1 s2 > 0; eta = x1*t1 + x2*t2 + alpha; p = probnorm(eta); model x ~ binomial(m,p); random alpha ~ normal(0,x1*s1*s1+x2*s2*s2) subject=litter; run;
The output is the same as for the initial model and is not shown.
In summary, you can often use a two-step process to help choose initial values for the parameters in a many-parameter mixed model. The first step is to estimate the parameters in a smaller and simpler fixed-effect model by replacing the random effects with their expected values. You can then use those fixed-effect estimates in the full model. You can combine this reduced-model technique with a grid search.
I do not have a reference for this technique. It appears to be "folklore" that "everybody knows," but I was unable to locate an example nor a proof that indicates the conditions under which this technique to work. If you know a good reference for this technique, please leave a comment.
The post Reduced models: A way to choose initial parameters for a mixed model appeared first on The DO Loop.
I have lived in the Town of Cary for more than twenty years; two of my three children were born at the local WakeMed Cary Hospital. I’m a big fan of my city, or town as it prefers to be called – even though the population is over 160,000. That’s [...]
One of my favorite Eddie Murphy movies when I was growing up was Coming to America. And speaking of coming to America, there's been a lot in the news recently about people doing just that. So I thought I'd use my SAS skills to help people wanting to come to [...]