Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9101661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:11:19+00:00 2026-06-17T01:11:19+00:00

Can anyone explain what the major differences between the prcomp and princomp functions are?

  • 0

Can anyone explain what the major differences between the prcomp and princomp functions are?

Is there any particular reason why I should choose one over the other? In case this is relevant, the type of application I am looking at is a quality control analysis for genomic (expression) data sets.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:11:20+00:00Added an answer on June 17, 2026 at 1:11 am

    There are differences between these two functions w/r/t

    • the function parameters (what you can/must pass in when you call the
      function);
    • the values returned by each; and
    • the numerical technique used by each to calculate principal
      components.

    Numerical Technique Used to Calculate PCA

    In particular, princomp should be a lot faster (and the performance difference will increase with the size of the data matrix) given that it calculates principal components via eigenvector decomposition on the covariance matrix, versus prcomp which calculates principal components via singular value decomposition (SVD) on the original data matrix.

    Eigenvalue decomp is only defined for square matrices (because the the technique is just solving the characteristic polynomial) but that’s not a practical limitation because the eigenvalue decomp always involves the predicate step of calculating from the original data matrix, the covariance matrix.

    Not only is the covariance matrix square, but is is usually much smaller than the original data matrix (as long as the number of attributes is less than the number of rows, or n < m, which is true in most of the time.

    The former (eigenvector decomp) is less accurate (the difference is often not material), but much faster because computation is performed on the covariance matrix rather than on the original data matrix; so for instance, if the data matrix has the usual shape such that n >> m, i.e., 1000 rows and 10 columns, then the covariance matrix is 10 x 10; by contrast prcomp calculates SVD on the original 1000 x 10 matrix.

    I don’t know the shape of data matrices for genomic expression data, but if the rows are in the thousands or even hundreds, then prcomp will be noticeably slower than princomp. I don’t know your context, eg, whether pca is performed as a single step in a larger data flow and whether net performance (execution speed) is of concern, so i can’t say whether this performance is indeed relevant for your use case. Likewise, it’s difficult to say whether the difference in numerical accuracy between the two techniques is significant and in fact it depends on the data.

    Return Values

    princomp returns a list comprised of seven items; prcomp returns a list of five.

    > names(pc1)    # prcomp
        [1] "sdev"     "rotation" "center"   "scale"    "x"       
    
    > names(pc2)    # princomp
        [1] "sdev"     "loadings" "center"   "scale"    "n.obs"    "scores"   "call"    
    

    For princomp, the most important items returnd are component scores and loadings.

    The values returned by the two functions can be reconciled (compared) this way: prcomp returns, among other things, a matrix called rotation which is equivalent to the loadings matrix returned by princomp.

    if you multiply prcomp’s rotation matrix by the original data matrix the result is stored in the matrix keyed to x

    finally, prcomp has a plot method which gives a scree plot (shows the relative and cumulative importance of each variable/column–the most useful visualization of PCA in my opinion).

    Function Arguments

    prcomp will scale (to unit variance) and mean center your data for you if you set to TRUE the arguments scale and center. That’s a trivial difference between the two given that you can both scale and mean center your data in a single line using the scale function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain if there is any benefit in either one of the following
Can anyone explain me what is a difference between these lines of code char
Can anyone explain me difference in python shell between output variable through print and
Can anyone explain me what is the difference between execution plan and explain plan.
Can anyone explain the difference between use and require , both when used directly
Can anyone explain the difference between the two very similar looking gems 'Arel' and
I am new to LabWindows/CVI. Can anyone please explain, what is the major difference
Can anyone explain what advantages there are to using a tool like MSBuild (or
Can anyone explain the difference between Server.MapPath(.) , Server.MapPath(~) , Server.MapPath(@\) and Server.MapPath(/) ?
I am new to JTA and it's underlying transaction managers. Can anyone explain the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.