I have model where my dependent variable is Total money spend and then I have independent variable Income and some other variables. Is it okay to use log transformation on the dependent variable and one of the independent ones and keep the rest unchanged?
27313
When transforming variables, do you have to use all of the same transformation? For example, can I pick and choose differently transformed variables, as in:   Let, $x_1,x_2,x_3$ be age, length of employment, length of residence, and income.  Y = B1*sqrt(x1) + B2*-1/(x2) + B3*log(x3)   Or, must you be consistent with your transforms and use all of the same? As in:   Y = B1*log(x1) + B2*log(x2) + B3*log(x3)    My understanding is that the goal of transformation is to address the problem of normality. Looking at histograms of each variable we can see that they present very different distributions, which would lead me to believe that the transformations required are different on a variable by variable basis.   ## R Code df &lt;- read.spss(file="http://www.bertelsen.ca/R/logistic-regression.sav",                  use.value.labels=T, to.data.frame=T) hist(df[1:7])      Lastly, how valid is it to transform variables using $\log(x_n + 1)$ where $x_n$ has $0$ values? Does this transform need to be consistent across all variables or is it used adhoc even for those variables which do not include $0$'s?  ## R Code  plot(df[1:7])
79167
I am trying to run a linear regression model (ideally) to see whether age (continuous variable) affects levels of stress hormone (also continuous, dependent variable), i.e. hypothesis testing. My hormone level results are right-skewed and non-normal, and the residuals of a simple linear model have a similar distribution (see plots of residuals below). Age is normally distributed.  Scatter of raw data (has a couple outliers):  Histogram of residuals:    I have also tried various transformations of my dependent variable (hormone levels) to improve the outcome of the model. The best normality plots came from the Tukey transformation. See plots below.  Scatter of transformed hormone level on age:  Histogram of residuals:    However, the transformation yields a lower multiple R-squared and adjusted R-sqaured value than the original.  Further to this post (), I tried a model where the hormone level is log transformed and fitted with the exponent of age to correct for the log transformation. This is because I didn't know what the opposite of Tukey transformation would be and log seems to be the next best transformation for my data. The normality of residuals is good but the R2 values are even lower.  Given this information, which model is best - the one with best normality of residuals and lowest R2 or worst normality of residuals and highest R2?  Alternatively, is there another form of regression better suited to this data, given that it is continuous and has non-normal residuals?
118648
Background: I have the cross-sectional model:  $Y_{i}  = a + b X_{1,i} + c X_{2,i} + d X_{3,i} + e X_{4,i} + \nu_i$.  The application is corporate finance. So each $Y_i$ is something like the change in return on assets over a 1 year period for firm $i$, and the regressors are typical corporate finance variables.  In corporate finance, very small values of $R^2$ are common, even sometimes $1\%$. My $R^2$ is around $1\%$ but my Adjusted $R^2$ is $-0.2\%$.   I have never seen papers report negative Adjusted $R^2$ but this could just be because they omit the publication of their adjusted $R^2$ when they see that it is negative.   Question  Is there some problem when the adjusted $R^2$ is negative?
100494
I would like to know how to transform negative values to Log(), since I have heteroskedastic data. I read that it works with the formula Log(x+1) but this doesn't work with my database and I continue getting NaNs as result. E.g. I get this Warning message (I didn't put my complete database because I think with one of my negative values is enough to show an example):   &gt; log(-1.27+1) [1] NaN Warning message: In log(-1.27 + 1) : NaNs produced &gt;    Thanks in advance  UPDATE:  Here is an histogram of my data. I'm working with palaeontological time series of chemical measurements, E.g the difference between variables like Ca and Zn is too big, then I need some type of data standardization, that is why I'm testing the log() function.   This is my
62164
I have a data set on which i want to run a machine learning algorithm , some of the columns are skewed. If I apply a transformation (lets say log) to those columns and I want to display the matrix of correlation , should i do it before or after handling skewed columns or should i not do it all ?
121148
Some of the variables are questions that are not being asked to every single person in the questionaire depending on how they answered previous question(s). So would I still be able to use a logistic regression if some of the questions (the independent variables) are only measuring the responses of SOME of the respondents?
80561
How can I account for a nonlinear independent variable in a logistic regression?  For example, consider this data set:  b1  b2  b3  b4  b5 1   1   0   0   20 0   1   0   0   20 1   0   0   0   13 1   1   1   0   8 1   1   0   1   5 0   1   0   1   4 1   1   0   1   5 0   0   0   0   8 0   0   1   0   13 1   0   0   1   20 1   0   0   0   29 1   1   0   1   40 1   0   0   0   53 0   1   1   0   68   Suppose I gathered some data like the above (suppose I had 10,000 rows) and I want to use them to predict future sets of similar data with an equation generated by a logistic regression. I get the above data. My independent variables are b1 through b5. By looking at the data, I can clearly see that independent variables b1 through b4 are binary (maybe they are male/female, rent/own, etc).   However I see that b5 is clearly not binary. Upon graphing it and looking at the numbers I determine that the b5 variable has a bathtub shaped U curve with an equation of b5=(x-4)^2+4.   I understand that using the b5 variable as it is would screw up my logistic regression - since any interval independent variables must have a linear relationship with the dependent variable.   Yet, I must account for the variable b5 in my data set while doing a logistic regression for it to be accurate and predict well (right?).  Given the above data, how would I go about making a predictive model with a logistic regression? Any references online or in books would greatly be appreciated as I am having trouble finding a good explanation of the above.  Cheers =)  EDIT:  Sorry if my question is unclear.  Consider this: Suppose we had the following data on many people:  Y: Whether they had a stroke before the age of 50 or not 1. Whether they own a pet or not. 2. Whether they graduated college or not. 3. Whether they are male or female. 4. The number of hours they exercise every week.  We want to train a logistic regression model based on historical data to predict if someone in the future with the same data will be more apt or not to have a stroke before the age of 50.  The problem I am having is with the last variable. A continuous ratio variable like "number of hours exercised each week."  Exercising more each week may have diminishing returns on health and thus having a stroke. For example decreasing an increasing rate. Or maybe (totally made up) exercising a little bit is really good for you, exercising a moderate amount is really bad for you, and exercising a lot is really good for you again. We might have a U shaped curve like (x-4)^2+4 for example when plotting health to exercise.   I would image that having a curved, non-linear independent variable in a logistic regression like the one I described above would cause problems. Am I right? And if so, what kinds of things can you do to still include the variable in the logistic regression. Perhaps a transformation? Is that all?
92652
My question originally arises from reading this post .   Right now, I'm trying construct linear regression using "Bike Sharing dataset" from  which basically tries to regression bike rental count on different variables  One of the predictor that I have question is on using "Hour" of when the rental occurred, which takes value from 0 to 23. The original post suggests transforming the circular data (time of day) using sine function to maintain the circular characteristic.  I was trying to apply to same methodology to my situation to transform the Hour variable. However,transforming 0~23 using sin(π hour/180) lets 00:00 and 12:00 to have 0. But I think people will certainly display different behavior when renting bike at midnight(00:00) and afternoon(12:00)  In this case, is it better to just use 23 dummy variables to account for hour  or am I misunderstanding the concept of circular regression?
13429
Let's say there's one DV (Y) and three IVs (X1, X2, X3), and among IVs, X1 is a dummy variable. In the regression model without interaction terms, the results can be represented like this:  Y ~ X1 + X2 + X3  X1 : non-significant X2 : significant X3 : significant   In this case, is it meaningful to check some interaction terms (e.g. X1 $\cdot$ X2 or X1 $\cdot$ X3)? At first I thought I don't have to because the main effect of X1 indicates non-significance. But I'm afraid I'm missing something important.
49240
I'm working on a VAR model and am doing a log transformation of the raw data.   x = log(x)   After differencing, running various tests and running a VAR(2) model, I add the predicted differences cumulatively to the original time series (logged) like this:  prd.diffs &lt;- as.ts(prd$mean$d.x1) U &lt;- tail(undiff,2) cumu &lt;- cumsum(prd.diffs) + U[1]   However, while the output now looks as it should, it is still in logged values.  My question is as follows:  How does one return the logged output to original values? I'm under the impression that using exp() will not give the correct results, and having tried some variations it hasn't worked for me.   Does the fact that it is a VAR($p$) model (and possibly what lag it has) influence the method, and how should that be implemented to get the correct output?  P.S. I realise that the above code does not constitute a replicable example as I didn't deem that necessary for the question, but should that be desired I can add some more code.
79600
I have 3 variables. Income is the dependent variable(continuous), sex(binomial), workhrs(categorical) i fitted a linear model and obtained the result:  My question is: Is this model usable? The NA values come from the fact that workhrs is missing 4 categories. The fifth one is i think due to coliniarity. The adjusted R squared is pretty high, but is the model Usefull to predict? or the interaction is not useful and should be dropped?  Call: lm(formula = income ~ factor(sex) + factor(workhrs) + factor(sex):factor(workhrs))  Residuals:    Min     1Q Median     3Q    Max  -6.757 -1.261  0.000  1.531  5.690   Coefficients: (5 not defined because of singularities)                                Estimate Std. Error t value Pr(&gt;|t|)     (Intercept)                      31.330      4.645   6.744 8.42e-05 *** factor(sex)1                      0.160      6.569   0.024 0.981101     factor(workhrs)1                  2.930      5.689   0.515 0.618960     factor(workhrs)2                 13.240      8.691   1.523 0.161968     factor(workhrs)4                 10.935      5.689   1.922 0.086773 .   factor(workhrs)5                  6.960      6.569   1.059 0.316997     factor(workhrs)6                 30.045      8.691   3.457 0.007192 **  factor(workhrs)7                 18.315      5.689   3.219 0.010503 *   factor(workhrs)8                 26.947      5.364   5.024 0.000715 *** factor(workhrs)9                 25.340      6.569   3.857 0.003863 **  factor(workhrs)10                38.850      9.291   4.182 0.002370 **  factor(sex)1:factor(workhrs)1     9.160      8.691   1.054 0.319347     factor(sex)1:factor(workhrs)2        NA         NA      NA       NA     factor(sex)1:factor(workhrs)4     9.060      8.046   1.126 0.289276     factor(sex)1:factor(workhrs)5    23.035      8.691   2.651 0.026451 *   factor(sex)1:factor(workhrs)6        NA         NA      NA       NA     factor(sex)1:factor(workhrs)7     3.325      8.691   0.383 0.710895     factor(sex)1:factor(workhrs)8        NA         NA      NA       NA     factor(sex)1:factor(workhrs)9        NA         NA      NA       NA     factor(sex)1:factor(workhrs)10       NA         NA      NA       NA     --- Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1  Residual standard error: 4.645 on 9 degrees of freedom Multiple R-squared:  0.9263,    Adjusted R-squared:  0.8117  F-statistic: 8.083 on 14 and 9 DF,  p-value: 0.001742
42298
I have some data that is bounded between 0 and 1. I have used the betareg package in R to fit a regression model with the bounded data as the dependent variable. My question is: how do I interpret the coefficients from the regression?
110823
I am trying to predict what are the determinants for foreign direct investments in Lithuanian regions from 2011 to 2017.   My dependent variable is foreign direct investments per capita in Lithuanian regions. And I have a variety of explanatory variables such as unemployment rate, labor cost, infrastructure quality and so on.   However, the data is really not normally distributed. Data does not show any linearity.     That is why I cannot use the multiple linear regression.     I found out that for the data which has a Poisson distribution, two regressions are suitable: Poisson and Negative binomial regression.   According to my calculations the dispersion is higher that the mean, so I should use the negative binomial regression.   Please correct me if I am wrong.   Also, how do you account for changing variables in time? (From 2011 to 2017)
16252
I have some dependent variables related to the growth of a company having categories like (e.g. for variables indicating net profit, financial turnover etc.)   (1) decreasing,   (2) stable,   (3) increasing and   (4) rapidly increasing.  Now these variables are associated and ordinal in nature. I want to see the effect of a set of co-variates on these dependent variables. I understand that separate logistic regression will result in wrong formula of the variance and thus will produce wrong p-values. But what kind of regression should I run with more than one associated dependent categorical variables? Should that be a GEE model? Or anything else like multivariate regression (GLM)?   Can SPSS or R perform this?   Besides, I would like to have your suggestion regarding whether I should rather consider these variables as nominal and take "stable" as the reference category so that interpretations are more meaningful?  Kind regards.
113462
I have a dataset comprised of continuous values that have about 30-50% zeros and a large range (10^3 - 10^10). I believe these zeros are not a result of missing data and are the result of the sensitivity of the machine taking the measurements. I would like to log10 transform this data so I can look at the distribution, but I'm not sure how to handle the zeros  I've done a lot of searching and found the following   Add a small constant to the data like 0.5 and then log transform  something called a boxcox transformation   I looked up boxcox transformation and I only found it in regards to making a regression model. I just want to visualize the distribution and see how it is distributed.   Currently when I plot a historgram of data it looks like this    When I add a small constant 0.5 and log10 transform it looks like this    Is there a better way to visualize the distribution of this data? Im just trying to get a handle on what the data looks like in order to figure out what kind of tests are appropriate for it.
109084
I have learned that, for creating a regression model, we have to take care of categorical variables by converting them into dummy variables. As an example, if, in our data set, there is a variable like location:   Location  ---------- Californian NY Florida   We have to convert them like:  1  0  0 0  1  0 0  0  1   However, it was suggested that we have to discard one dummy variable, no matter how many dummy variables are there.   Why do we need to discard one dummy variable?
43225
I assume it is OK to mix different data transformations in the same analysis. I've had to transform some variables to squared and some to cubed in order to meet normal distribution requirements. I'm assuming that it's OK to then use the transformed variables together for regression analysis?