Skip to main content
Tweeted twitter.com/StackStats/status/834820871965462528
added 21 characters in body
Source Link
Agus Camacho
  • 580
  • 2
  • 4
  • 14

I am unclear whether scaling and centering my predictor variables in a multinomial model. I want that model for first determining the relative strength of single terms and interactions on a given dataset, and then i want to use that model to make predictions based on a new dataset. I found out that both the scaled and unscaled model have the same AIC, but the unscaled has higher t-values and a higher number of significant terms.How is that possible?

Here is a reproducible example (dataset):

Data <- data.frame(
  X = sample(1:100),
  D = sample(1:100),
  Y = sample(c("yes", "no"), 10, replace = TRUE),
  Z=sample(c("body", "tail", "fail"), 10, replace = TRUE)
)


require(nnet)

test=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
summary(test)

z=summary(test)$coefficients/summary(test)$standard.errors;z# t values

Data$X=scale(Data$X,F)
Data$D=scale(Data$D,F)
test1=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
z1=summary(test1)$coefficients/summary(test1)$standard.errors;z1# t    values

z# t values for unscaled predictors
z1# t values for scaled predictors

(1 - pnorm(abs(z), 0, 1)) * 2# z test p values
(1 - pnorm(abs(z1), 0, 1)) * 2# zz1 test p values

AIC(test, test1)

I am unclear whether scaling and centering my predictor variables in a multinomial model. I want that model for first determining the relative strength of single terms and interactions on a given dataset, and then i want to use that model to make predictions based on a new dataset. I found out that both the scaled and unscaled model have the same AIC, but the unscaled has higher t-values and a higher number of significant terms.How is that possible?

Here is a reproducible example (dataset):

Data <- data.frame(
  X = sample(1:100),
  D = sample(1:100),
  Y = sample(c("yes", "no"), 10, replace = TRUE),
  Z=sample(c("body", "tail", "fail"), 10, replace = TRUE)
)


require(nnet)

test=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
summary(test)

z=summary(test)$coefficients/summary(test)$standard.errors;z# t values

Data$X=scale(Data$X,F)
Data$D=scale(Data$D,F)
test1=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
z1=summary(test1)$coefficients/summary(test1)$standard.errors;z1# t    values

z# t values unscaled
z1# t values scaled

(1 - pnorm(abs(z), 0, 1)) * 2# z test p values
(1 - pnorm(abs(z1), 0, 1)) * 2# z test p values

AIC(test, test1)

I am unclear whether scaling and centering my predictor variables in a multinomial model. I want that model for first determining the relative strength of single terms and interactions on a given dataset, and then i want to use that model to make predictions based on a new dataset. I found out that both the scaled and unscaled model have the same AIC, but the unscaled has higher t-values and a higher number of significant terms.How is that possible?

Here is a reproducible example:

Data <- data.frame(
  X = sample(1:100),
  D = sample(1:100),
  Y = sample(c("yes", "no"), 10, replace = TRUE),
  Z=sample(c("body", "tail", "fail"), 10, replace = TRUE)
)


require(nnet)

test=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
summary(test)

z=summary(test)$coefficients/summary(test)$standard.errors;z# t values

Data$X=scale(Data$X,F)
Data$D=scale(Data$D,F)
test1=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
z1=summary(test1)$coefficients/summary(test1)$standard.errors;z1# t    values

z# t values for unscaled predictors
z1# t values for scaled predictors

(1 - pnorm(abs(z), 0, 1)) * 2# z test p values
(1 - pnorm(abs(z1), 0, 1)) * 2# z1 test p values

AIC(test, test1)
Source Link
Agus Camacho
  • 580
  • 2
  • 4
  • 14

scaling and centering in multinomial model changes significance of terms and interactions

I am unclear whether scaling and centering my predictor variables in a multinomial model. I want that model for first determining the relative strength of single terms and interactions on a given dataset, and then i want to use that model to make predictions based on a new dataset. I found out that both the scaled and unscaled model have the same AIC, but the unscaled has higher t-values and a higher number of significant terms.How is that possible?

Here is a reproducible example (dataset):

Data <- data.frame(
  X = sample(1:100),
  D = sample(1:100),
  Y = sample(c("yes", "no"), 10, replace = TRUE),
  Z=sample(c("body", "tail", "fail"), 10, replace = TRUE)
)


require(nnet)

test=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
summary(test)

z=summary(test)$coefficients/summary(test)$standard.errors;z# t values

Data$X=scale(Data$X,F)
Data$D=scale(Data$D,F)
test1=multinom(Z~Y+X+D+X:Y+D:X+D:Y,data=Data)
z1=summary(test1)$coefficients/summary(test1)$standard.errors;z1# t    values

z# t values unscaled
z1# t values scaled

(1 - pnorm(abs(z), 0, 1)) * 2# z test p values
(1 - pnorm(abs(z1), 0, 1)) * 2# z test p values

AIC(test, test1)