

Hi,
I keep getting an error message
>Warning # 602
>The argument for the natural log function is less than or equal to zero.
The
>result has been set to the systemmissing value.
when I run this syntax:
COMPUTE sexshun_LN=LN(sexshun)
EXECUTE.
How can I fix this?
(Sexshun is a binary variable)
thanks for any help

Sent from: http://spssxdiscussion.1045642.n5.nabble.com/=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Don't ever transform a binary variable.
 Unless it is a linear transformation, like adding 1 (0,1 becomes 1,2)
or deciding to center it (0,1 becomes 1, 1); or multiplying by a
constant (probably, to change the scale of the regression coefficient).
The message tells you that you can't take the log of zero. This time,
the incidental error saves you from the embarrassment of trying to
explain to someone else WHY you took the log of a binary variable.

Rich Ulrich
Hi,
I keep getting an error message
>Warning # 602
>The argument for the natural log function is less than or equal to zero.
The
>result has been set to the systemmissing value.
when I run this syntax:
COMPUTE sexshun_LN=LN(sexshun)
EXECUTE.
How can I fix this?
(Sexshun is a binary variable)
thanks for any help

Sent from: http://spssxdiscussion.1045642.n5.nabble.com/
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Thankyou,
So all I need to do is recode the varible to (1,2) instead of (0,1)?

Sent from: http://spssxdiscussion.1045642.n5.nabble.com/=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Administrator

What is your objection to 0/1 coding?
It would also be helpful if you provided more context. What kind of model
are you estimating? (You mentioned log odds, so I suspect it is logistic
regression, but you've not said.) What is the outcome variable? What are
the explanatory variables? Why do you think you need to transform the
variable you are asking about?
Thanks for clarifying.
mllx4eg5 wrote
> Thankyou,
> So all I need to do is recode the varible to (1,2) instead of (0,1)?
>
>
>
>
> 
> Sent from: http://spssxdiscussion.1045642.n5.nabble.com/>
> =====================
> To manage your subscription to SPSSXL, send a message to
> LISTSERV@.UGA
> (not to SPSSXL), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSXL
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD


Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/"When all else fails, RTFM."
NOTE: My Hotmail account is not monitored regularly.
To send me an email, please use the address shown above.

Sent from: http://spssxdiscussion.1045642.n5.nabble.com/=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


I think the OP wants to take the natural log of a binary DV to evaluate the linearity assumption in the context of binary logistic regression. That’s not the way to evaluate linearity, and it’s mathematically impossible to take the natural log when values = zero.
Assuming there is only one explanatory variable which happens to be continuous, one quick and dirty approach would be to create bins of the continuous explanatory variable, refit the binary logistic regression model with the new categorical explanatory variable, output the predicted values on the logodds scale, and then plot the original continuous explanatory variable against the predicted logodds.
Ryan
Sent from my iPhone
> On Sep 15, 2019, at 9:48 PM, Bruce Weaver < [hidden email]> wrote:
>
> What is your objection to 0/1 coding?
>
> It would also be helpful if you provided more context. What kind of model
> are you estimating? (You mentioned log odds, so I suspect it is logistic
> regression, but you've not said.) What is the outcome variable? What are
> the explanatory variables? Why do you think you need to transform the
> variable you are asking about?
>
> Thanks for clarifying.
>
>
>
> mllx4eg5 wrote
>> Thankyou,
>> So all I need to do is recode the varible to (1,2) instead of (0,1)?
>>
>>
>>
>>
>> 
>> Sent from: http://spssxdiscussion.1045642.n5.nabble.com/>>
>> =====================
>> To manage your subscription to SPSSXL, send a message to
>
>> LISTSERV@.UGA
>
>> (not to SPSSXL), with no body text except the
>> command. To leave the list, send the command
>> SIGNOFF SPSSXL
>> For a list of commands to manage subscriptions, send the command
>> INFO REFCARD
>
>
>
>
>
> 
> 
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an email, please use the address shown above.
>
> 
> Sent from: http://spssxdiscussion.1045642.n5.nabble.com/>
> =====================
> To manage your subscription to SPSSXL, send a message to
> [hidden email] (not to SPSSXL), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSXL
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Mind the missing dot at the end of COMPUTE.
Mario Giesel Munich, Germany
Am Montag, 16. September 2019, 01:10:27 MESZ hat mllx4eg5 < [hidden email]> Folgendes geschrieben:
Hi,
I keep getting an error message
>Warning # 602
>The argument for the natural log function is less than or equal to zero.
The
>result has been set to the systemmissing value.
when I run this syntax:
COMPUTE sexshun_LN=LN(sexshun)
EXECUTE.
How can I fix this?
(Sexshun is a binary variable)
thanks for any help

=====================
To manage your subscription to SPSSXL, send a message to
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Administrator

If so, then another approach would be the BoxTidwell Transformation
testpoint #3 here:
http://www.statisticalassociates.com/logistic10.htmGiven that it entails taking the log of X, negative values of X are
precluded.
Here's a question for Jon (or anyone else who might know): Is there a way
to make SPSS do the equivalent of Stata's lowess outcome predictor, logit
as described here?
https://www.statalist.org/forums/forum/generalstatadiscussion/general/1516231logisticregressionhttps://www.stata.com/manuals/rlowess.pdfRyan Black wrote
> I think the OP wants to take the natural log of a binary DV to evaluate
> the linearity assumption in the context of binary logistic regression.
> That’s not the way to evaluate linearity, and it’s mathematically
> impossible to take the natural log when values = zero.
>
> Assuming there is only one explanatory variable which happens to be
> continuous, one quick and dirty approach would be to create bins of the
> continuous explanatory variable, refit the binary logistic regression
> model with the new categorical explanatory variable, output the predicted
> values on the logodds scale, and then plot the original continuous
> explanatory variable against the predicted logodds.
>
> Ryan
>
> Sent from my iPhone


Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/"When all else fails, RTFM."
NOTE: My Hotmail account is not monitored regularly.
To send me an email, please use the address shown above.

Sent from: http://spssxdiscussion.1045642.n5.nabble.com/=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


I don't know the details of the Stata procedure, but there are a few Statistics extension commands that might be relevant. These can, as usual, be installed via Extensions > Extension Hub. They require the R Essentials, which can be obtained from the IBM Predictive Analytics site
STATS LOESS (Analyze > Regression > LOESS fit) does a loess fit and can calculate corresponding predicted values. It has several options. From the dialog help... Alpha Specify the proportion of cases to be used for the fit at each point. The value will usually be less than or equal to 1, but larger values are allowed. Values greater than 1 mean to use all the points but taper the weights more slowly as the distance increases. Polynomial degree A value of 0 means locally constant (use with caution), 1 means linear, and 2 means quadratic. Family Gaussian means fit by least squares. Symmmetric means fit by an redescending M estimator with a Tukey biweight function. The STATS GAM (Analyze > Generalized Linear Models > Generalized Additive Model) extension command fits a generalized additive model. From the dialog help... This procedure calculates a generalized additive model (GAM). GAMs are linear in predictor terms that can be simple variables or various kinds of splines or polynomials. This preserves the simplicity of the linear model while allowing flexibly for predictors to have a nonlinear effect on the dependent variable. In addition, you can specify the error distribution and link function for the model. The dialog box supports only a subset of the functionality available in syntax. See the Additional Features section below for details. Split files and the Statistics case weights are not supported by this procedure. Dependent Variable Specify the dependent variable. Since the default error distribution and link are for a continuous dependent variable, if it is categorical, change the error distribution and link specification appropriately. Linear Terms Select the linear predictors for the model, if any. Type of Nonlinearity, Parameter 1, and Parameter2 Specify the type of predictor nonlinearity and corresponding parameters. The dropdown list provides five types: smoothing spline, loess, orthogonal polynomials, bspline, and natural spline. The same type will be used for all the nonlinear terms. Each type takes one or two parameters, shown as parm1 and parm2 in the list. Enter the parameter value or values in the Parameter fields. The degrees of freedom parameter is a smoothing parameter. For spline, the difference between the degree and degrees of freedom is the number of knots. The natural spline is always cubic. If so, then another approach would be the BoxTidwell Transformation
testpoint #3 here:
http://www.statisticalassociates.com/logistic10.htm
Given that it entails taking the log of X, negative values of X are
precluded.
Here's a question for Jon (or anyone else who might know): Is there a way
to make SPSS do the equivalent of Stata's lowess outcome predictor, logit
as described here?
https://www.statalist.org/forums/forum/generalstatadiscussion/general/1516231logisticregression
https://www.stata.com/manuals/rlowess.pdf
Ryan Black wrote
> I think the OP wants to take the natural log of a binary DV to evaluate
> the linearity assumption in the context of binary logistic regression.
> That’s not the way to evaluate linearity, and it’s mathematically
> impossible to take the natural log when values = zero.
>
> Assuming there is only one explanatory variable which happens to be
> continuous, one quick and dirty approach would be to create bins of the
> continuous explanatory variable, refit the binary logistic regression
> model with the new categorical explanatory variable, output the predicted
> values on the logodds scale, and then plot the original continuous
> explanatory variable against the predicted logodds.
>
> Ryan
>
> Sent from my iPhone


Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
NOTE: My Hotmail account is not monitored regularly.
To send me an email, please use the address shown above.

Sent from: http://spssxdiscussion.1045642.n5.nabble.com/
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Assuming Ryan is right  I think that a pretty good guide to the
regression is provided by what SPSS provides, as the
HosmerLemeshow goodnessoffit statistic.
I think there is an associated plot which shows some more.

Rich Ulrich
I think the OP wants to take the natural log of a binary DV to evaluate the linearity assumption in the context of binary logistic regression. That’s not the way to evaluate linearity, and it’s mathematically impossible to take the natural
log when values = zero.
Assuming there is only one explanatory variable which happens to be continuous, one quick and dirty approach would be to create bins of the continuous explanatory variable, refit the binary logistic regression model with the new categorical explanatory variable,
output the predicted values on the logodds scale, and then plot the original continuous explanatory variable against the predicted logodds.
Ryan
Sent from my iPhone
> On Sep 15, 2019, at 9:48 PM, Bruce Weaver < [hidden email]> wrote:
>
> What is your objection to 0/1 coding?
>
> It would also be helpful if you provided more context. What kind of model
> are you estimating? (You mentioned log odds, so I suspect it is logistic
> regression, but you've not said.) What is the outcome variable? What are
> the explanatory variables? Why do you think you need to transform the
> variable you are asking about?
>
> Thanks for clarifying.
>
>
>
> mllx4eg5 wrote
>> Thankyou,
>> So all I need to do is recode the varible to (1,2) instead of (0,1)?
>>
>>
>>
>>
>> 
>> Sent from: http://spssxdiscussion.1045642.n5.nabble.com/
>>
>> =====================
>> To manage your subscription to SPSSXL, send a message to
>
>> LISTSERV@.UGA
>
>> (not to SPSSXL), with no body text except the
>> command. To leave the list, send the command
>> SIGNOFF SPSSXL
>> For a list of commands to manage subscriptions, send the command
>> INFO REFCARD
>
>
>
>
>
> 
> 
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an email, please use the address shown above.
>
> 
> Sent from: http://spssxdiscussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSXL, send a message to
> [hidden email] (not to SPSSXL), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSXL
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

