Are the "standard errors" that the glmRob command give you considered robust? - standards

I am running a glm to get PR for my binary outcome. I want to use the glmRob command to get robust standard errors. The output only says "std errors". Is the robust part implied given that in the description of the command on cran-project, it is called a robust generalized linear model? The description in cran does not specify either way whether output is assumed to be robust standard errors.

Related

can't fit GLM with family binomial and log link to estimate RR

I am trying to estimate relative risk using log-binomial model using the glm function. Although it works well with univariable analysis, it gives me an error message when I add multiple variables
This is the error message I get
Error: no valid set of coefficients has been found: please supply starting values.
I did some search but couldn't find a way to solve this issue
Thanks
This error can happen for one of two reasons. First, if any of the deviances are infinite, and second, if invalid starting values have been supplied. Assuming that you haven't supplied starting values, then I suggest doing so, by using the start = option in glm.
Having said that, the only times I have seen this problem is when either the dataset is pathological, or the model is wrong (for example using an inappropriate link function). Since you don't supply a reproducible example, there isn't much more we can say.

Cannot estimate standard errors associated with Vegan function fisher.alpha

All the documents associated with BiodiversityR and Vegan suggest that argument se=TRUE can be used to estimate standard errors on calculation of fisher's alpha diversity index. But I can't seem to get these values in the output? Any body knowns of any associated bug?
I tried :
fisher.alpha(x,MARGIN=1,se=TRUE)
and also, fisherfit(x)
The output for both gives me an estimate of alpha, but no standard errors. My community data frame is too large to be loaded here, but it is in the standard format as required by these functions.
Vegan version 2.4.2
The standard errors were not removed because they were non-normal and skewed, but because I was not convinced that they were correct. (There is nothing wrong in being non-Normal and skewed.). If you want to play with those standard errors, you can get vegan version 2.0-9 from the CRAN archive, or revert commit 2c44f2b7c9 in the github tree of vegan. However, you should verify the correctness of those standard errors yourself: they may be OK, but I do not know, and therefore I removed them.

How to deal with heteroscedasticity in OLS with R

I am fitting a standard multiple regression with OLS method. I have 5 predictors (2 continuous and 3 categorical) plus 2 two-way interaction terms. I did regression diagnostics using residuals vs. fitted plot. Heteroscedasticity is quite evident, which is also confirmed by bptest().
I don't know what to do next. First, my dependent variable is reasonably symmetric (I don't think I need to try transformations of my DV). My continuous predictors are also not highly skewed. I want to use weights in lm(); however, how do I know what weights to use?
Is there a way to automatically generate weights for performing weighted least squares? or Are you other ways to go about it?
One obvious way to deal with heteroscedasticity is the estimation of heteroscedasticity consistent standard errors. Most often they are referred to as robust or white standard errors.
You can obtain robust standard errors in R in several ways. The following page describes one possible and simple way to obtain robust standard errors in R:
https://economictheoryblog.com/2016/08/08/robust-standard-errors-in-r
However, sometimes there are more subtle and often more precise ways to deal with heteroscedasticity. For instance, you might encounter grouped data and find yourself in a situation where standard errors are heterogeneous in your dataset, but homogenous within groups (clusters). In this case you might want to apply clustered standard errors. See the following link to calculate clustered standard errors in R:
https://economictheoryblog.com/2016/12/13/clustered-standard-errors-in-r
What is your sample size? I would suggest that you make your standard errors robust to heteroskedasticity, but that you do not worry about heteroskedasticity otherwise. The reason is that with or without heteroskedasticity, your parameter estimates are unbiased (i.e. they are fine as they are). The only thing that is affected (in linear models!) is the variance-covariance matrix, i.e. the standard errors of your parameter estimates will be affected. Unless you only care about prediction, adjusting the standard errors to be robust to heteroskedasticity should be enough.
See e.g. here how to do this in R.
Btw, for your solution with weights (which is not what I would recommend), you may want to look into ?gls from the nlme package.

standard errors for loess in R

I am attempting to find a reference which explains how one computes standard errors for local polynomial regression? Specifically, in R one can use the loess function to get a model object and then use the predict function to retrieve standard errors. Is there a reference somewhere to what is actually happening? What about in the case when there may be serial correlation in the residuals, one must adjust this using Newey-West type methods, is there a way to use the sandwich package to do this as you would for a regular OLS using lm?
I tried looking at the source but the standard error computation calls a C function.
The "Source" section of ?loess tells you that the underlying C-code comes from the cloess package of Cleveland et al., and points you to its web home:
Source:
The 1998 version of ‘cloess’ package of Cleveland, Grosse and
Shyu. A later version is available as ‘dloess’ at http://www.netlib.org/a>.
Going there, you will find a link to a 50 page document (warning: postscript doc) that should tell you everything you need to know about this implementation of loess. In Cleveland's words:
This guide describes crucial steps in the proper analysis of data using
loess. Please read it.
Of particular interest will be the first couple pages of "Section 4: Statistical and Computational Methods".

Standard error of the ARIMA constant

I am trying to manually calculate the standard error of the constant in an ARIMA model, if it is included. I have referred to Box and Jenkins (1994) text, specially Section 7.2, but my understanding is that the methods mentioned here calculates the variance-covariance matrix for the ARIMA parameters only, not the constant. Tried searching on the Internet, but couldn't find any theory. Software like Minitab, R etc. calculate this, so I was wondering what is the way? Can someone provide any pointer(s) on this topic?
Thanks.
arima() will fit a regression model with ARMA errors. The constant is treated as the coefficient of a regression variable consisting only of 1s. So you need the covariance matrix of the regression coefficients which is usually calculated separately from the covariance matrix of the ARMA coefficients. Look at Section 8.3 of Hamilton's "Time series analysis"
One of the nicest things about R is that you can access a lot of the source code to R itself from within the environment. If you simply type arima at the command prompt, you get the high-level source code for the arima() function. I got several pages of code here, when I tried it.
You do miss out on anything implemented internally within the R executable in native code, but often the high-level code tells you everything you want to know.
Perhaps a shift of perspective can solve this problem.
Rather than seeing the constant as something special, just consider the problem without constant and with a variable that is a vector of ones.

Resources