Questions tagged [linear-discriminant]
103 questions
1
vote
1 answer
Comparing test performances
I'm trying to work with some data here and compare the test performance of glm and lda.
The data is attached here.
This is my general plan to try to do both of these:
training = read.csv("train.csv")
testing = read.csv("test.csv")
model_glm <-…

J. P.
- 289
- 4
- 14
1
vote
1 answer
R console gives output regardless of error, but Shiny app does't due to error. How can I bypass the error in the Shiny app?
When I run the code below in the R console, I get the following error in line 10:
"Error in lda.default(x, grouping, ...) :
variables 5 6 appear to be constant within groups"
However the rest of the code is still processed and the data is…

Anuraag
- 11
- 3
1
vote
1 answer
Canonical Discriminant Function in Python sklearn
I am learning about Linear Discriminant Analysis and am using the scikit-learn module. I am confused by the "coef_" attribute from the LinearDiscriminantAnalysis class. As far as I understand, these are the discriminant function coefficients…

SPL
- 11
- 4
1
vote
1 answer
What kind of LDA performs 'fitcdiscr' function?
I know that the new fitcdiscr MATLAB® function can perform several discriminant analysis, such as LDA or QDA. However, the mentions about 'regularization' and 'bayesian' inside the MATLAB® help confuse me.
What kind of discriminant analysis is…

Víctor Martínez
- 854
- 2
- 11
- 29
1
vote
1 answer
How to plot MASS:qda scores
From this question, I was wondering if it's possible to extract the Quadratic discriminant analysis (QDA's) scores and reuse them after like PCA scores.
## follow example from ?lda
Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
…

M. Beausoleil
- 3,141
- 6
- 29
- 61
1
vote
0 answers
R coefficients in linear versus flexible discriminant function analysis
I am trying to understand flexible discriminant function analysis and specifically the "fda" command in the "mda" package in R. My understanding is that the default method is a simple linear discriminant function analysis and that I can get a sense…

user2414840
- 721
- 1
- 7
- 15
1
vote
0 answers
How to reconstruct data from projections obtained with Linear Discriminant Analysis
I am trying to reconstruct data from the projections obtained with LDA. The idea would be to evaluate the reconstruction errors obtained from reduced sets of LDA factors. In the following matlab code, the question is how to obtain the reconstruction…

acadela
- 11
- 1
0
votes
0 answers
Python tool for applying Mixture Discriminant Analysis (MDA) resp. Flexible Discriminant Analyis (FDA) instead of Linear Discriminant Analysis (LDA)
I would like to use Flexible Discriminant Analysis (FDA) or Mixture Discriminant Analysis (MDA) for dimension reduction on my data using Python. According to "The Elements of Statistical Learning", pp. 438-444, these adaptations of Linear…

pascal_
- 61
- 5
0
votes
0 answers
Add Linear Discriminant Analysis Line and Show Equation on ggplot
Rather than using an incorrect line generated by lm using geom_smooth(method = lm), I wanted to plot the line that a linear discriminant analysis would consider "0." I understand how to get the output data with LD1 and LD2, but not the specific…

Zard22
- 13
- 2
0
votes
0 answers
Data points in ggplot of lda seem inverted
I am attempting to create a ggplot2 plot of a linear discriminant analysis of my data. I have done so without issues in the past. However, I notice that the plotted data appears 'inverted'--points that should be below zero on the Y axis/the…

Zard22
- 13
- 2
0
votes
1 answer
R: How do I remove the sub (error) label in partimat plot from klaR package
I am wanting to produce a klaR::partimat plot with as small margins as I can (so it shows up nicely in a quarto document.) I have managed to play with the margins & font size to get it close to what I want, but can't figure out how to remove the…

zos474
- 21
- 2
0
votes
1 answer
Most important variables for finding group membership
I have a dataset 8100 observations of 118 variables that are used to determine which one of 4 groups each respondent falls into. I am interested in which variables are the most important for predicting group membership. My data is a combination of…

thestral
- 491
- 1
- 4
- 16
0
votes
0 answers
How do I scatterplot LD1 vs LD2 in lda analysis?
I'm very very new to R, so thanks in advance for the help
I did the lda analysis on my dataset (tme.lda), in the console I get all my results with LD1, LD2, LD3, LD4, LD5 and LD6 but when I try to plot it I tried a lot of different methods but I get…
0
votes
0 answers
Why sklearn.discriminant_analysis uses priors for calculating within-class covariance matrix?
I found that Linear Discriminant Analysis of sklearn (discriminant_analysis.py) uses priors for calculating within-class covariance matrix.
I refered some books but they explained the priors are used for calculating intercepts.
Do you know any…

ginom
- 1
0
votes
1 answer
Problem with column names in a function in R when running linear discriminant analysis (lda)
This is my dataset of example, where column D is the factor one.
df <- data.frame(A=1:10, B=2:11, C=3:12, D="A")
df[6:10, 4] <- "B"
When I run a lda, it works nice:
model <- lda(D ~ B + C, data = df)
print(model)
Call:
lda(D ~ B + C, data =…

antecessor
- 2,688
- 6
- 29
- 61